apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: grafana
  name: grafana
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - env: []
        image: grafana/grafana:7.1.3
        name: grafana
        ports:
        - containerPort: 3000
          name: http
        readinessProbe:
          httpGet:
            path: /api/health
            port: http
        resources:
          limits:
            cpu: 200m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - mountPath: /etc/grafana/provisioning/datasources
          name: grafana-datasources
          readOnly: false
        - mountPath: /etc/grafana/provisioning/dashboards
          name: grafana-dashboards
          readOnly: false          
        - mountPath: /grafana-dashboard-definitions/0/nodeexporter
          name: grafana-dashboard-nodeexporter
          readOnly: false
      initContainers:
        - name: dashboard
          image: busybox
          command:
            - wget
            - "-O"
            - "/grafana-dashboard-nodeexporter/node-exporter-full.json"
            - https://raw.githubusercontent.com/rh-eu/for-sake-of-testing/master/kubernetes/monitoring/grafana/node-exporter-full.json
          volumeMounts:
          - name: grafana-dashboard-nodeexporter
            mountPath: "/grafana-dashboard-nodeexporter"
            readOnly: false               
      volumes:
      - configMap:
          name: grafana-datasources
        name: grafana-datasources
      - configMap:
          name: grafana-dashboards
        name: grafana-dashboards      
      #- configMap:
      #    name: grafana-dashboard-nodeexporter
      #  name: grafana-dashboard-nodeexporter
      - name: grafana-dashboard-nodeexporter
        emptyDir: {}          