apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    a8r.io/repository: ssh://git@git.tr1ceracop.de:222/gitea_admin/k8s-and-chill.git
  labels:
    app.kubernetes.io/instance: grafana
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 12.3.1
    helm.sh/chart: grafana-10.5.15
  name: grafana
  namespace: monitoring
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: grafana
      app.kubernetes.io/name: grafana
  strategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/config: 5be4357fd6e211fab2024add34069a0a3555e629a11081fb4461a2c09fdeff49
        checksum/dashboards-json-config: 02278b031cbf8831bf02b7a4256e61be096aaeb31d9a25dabd282b6933b1abcb
        checksum/sc-dashboard-provider-config: e70bf6a851099d385178a76de9757bb0bef8299da6d8443602590e44f05fdf24
        kubectl.kubernetes.io/default-container: grafana
      labels:
        app.kubernetes.io/instance: grafana
        app.kubernetes.io/name: grafana
        app.kubernetes.io/version: 12.3.1
        helm.sh/chart: grafana-10.5.15
    spec:
      automountServiceAccountToken: true
      containers:
        - env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: GF_SECURITY_ADMIN_USER
              valueFrom:
                secretKeyRef:
                  key: admin-user
                  name: grafana-admin
            - name: GF_SECURITY_ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: admin-password
                  name: grafana-admin
            - name: GF_PATHS_DATA
              value: /var/lib/grafana/
            - name: GF_PATHS_LOGS
              value: /var/log/grafana
            - name: GF_PATHS_PLUGINS
              value: /var/lib/grafana/plugins
            - name: GF_PATHS_PROVISIONING
              value: /etc/grafana/provisioning
            - name: GF_UNIFIED_STORAGE_INDEX_PATH
              value: /var/lib/grafana-search/bleve
            - name: GOMEMLIMIT
              valueFrom:
                resourceFieldRef:
                  divisor: "1"
                  resource: limits.memory
          image: docker.io/grafana/grafana:12.3.1
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 10
            httpGet:
              path: /api/health
              port: grafana
            initialDelaySeconds: 60
            timeoutSeconds: 30
          name: grafana
          ports:
            - containerPort: 3000
              name: grafana
              protocol: TCP
            - containerPort: 9094
              name: gossip-tcp
              protocol: TCP
            - containerPort: 9094
              name: gossip-udp
              protocol: UDP
            - containerPort: 6060
              name: profiling
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /api/health
              port: grafana
          resources:
            limits:
              memory: 256Mi
            requests:
              cpu: 50m
              memory: 128Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            privileged: false
            seccompProfile:
              type: RuntimeDefault
          volumeMounts:
            - mountPath: /etc/grafana/grafana.ini
              name: config
              subPath: grafana.ini
            - mountPath: /var/lib/grafana
              name: storage
            - mountPath: /var/lib/grafana-search
              name: search
            - mountPath: /var/lib/grafana/dashboards/default/ocis.json
              name: dashboards-default
              subPath: ocis.json
            - mountPath: /etc/grafana/provisioning/datasources/datasources.yaml
              name: config
              subPath: datasources.yaml
            - mountPath: /etc/grafana/provisioning/dashboards/dashboardproviders.yaml
              name: config
              subPath: dashboardproviders.yaml
      enableServiceLinks: true
      initContainers:
        - args:
            - -c
            - mkdir -p /var/lib/grafana/dashboards/default && /bin/sh -x /etc/grafana/download_dashboards.sh
          command:
            - /bin/sh
          env: null
          image: docker.io/curlimages/curl:8.9.1
          imagePullPolicy: IfNotPresent
          name: download-dashboards
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            seccompProfile:
              type: RuntimeDefault
          volumeMounts:
            - mountPath: /etc/grafana/download_dashboards.sh
              name: config
              subPath: download_dashboards.sh
            - mountPath: /var/lib/grafana
              name: storage
      securityContext:
        fsGroup: 472
        runAsGroup: 472
        runAsNonRoot: true
        runAsUser: 472
      serviceAccountName: grafana
      shareProcessNamespace: false
      volumes:
        - configMap:
            name: grafana
          name: config
        - configMap:
            name: grafana-dashboards-default
          name: dashboards-default
        - name: storage
          persistentVolumeClaim:
            claimName: grafana
        - emptyDir: {}
          name: search
