apiVersion: apps/v1
kind: Deployment

metadata:
  namespace: singouins-dev
  name: sep-backend-grafana
  labels:
    tier: sep-backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
      tier: sep-backend
  template:
    metadata:
      labels:
        app: grafana
        tier: sep-backend
    spec:

      containers:
        - name: sep-backend-grafana
          image: grafana/grafana:8.3.3
          resources:
            limits:
              memory: 128Mi
              cpu: 50m
            requests:
              memory: 32Mi
              cpu: 10m
          env:
            - name: GF_DATABASE_TYPE
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-db-type
            - name: GF_DATABASE_HOST
              valueFrom:
                secretKeyRef:
                  name: sep-backend-mariadb-secret
                  key: mariadb-host
            - name: GF_DATABASE_USER
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-db-user
            - name: GF_DATABASE_NAME
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-db-base
            - name: GF_DATABASE_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-db-pass
            - name: GF_SECURITY_ADMIN_USER
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-admin-user
            - name: GF_SECURITY_ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sep-backend-grafana-secret
                  key: grafana-admin-pass
