apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: ibm-monitoring
    app.kubernetes.io/instance: grafana
    app.kubernetes.io/managed-by: ibm-monitoring-grafana-operator
    operatorframework.io/arch.s390x: supported
    operatorframework.io/os.linux: supported
    operatorframework.io/arch.amd64: supported
    operatorframework.io/arch.ppc64le: supported
  name: ibm-monitoring-grafana-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ibm-monitoring-grafana-operator
  template:
    metadata:
      labels:
        app.kubernetes.io/name: ibm-monitoring
        app.kubernetes.io/instance: grafana
        app.kubernetes.io/managed-by: ibm-monitoring-grafana-operator
        name: ibm-monitoring-grafana-operator
        intent: projected
      annotations:
        productName: IBM Cloud Platform Common Services
        productID: "068a62892a1e4db39641342e592daa25"
        productMetric: FREE
    spec:
      serviceAccountName: ibm-monitoring-grafana-operator
      hostIPC: false
      hostNetwork: false
      hostPID: false
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/arch
                    operator: In
                    values:
                      - amd64
                      - ppc64le
                      - s390x
      containers:
        - name: grafana
          # Replace this with the built image name
          image: quay.io/opencloudio/ibm-monitoring-grafana-operator
          command:
            - ibm-monitoring-grafana-operator
          imagePullPolicy: Always
          securityContext:
            privileged: false
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            capabilities:
              drop:
                - ALL
          resources:
            limits:
              cpu: 50m
              memory: 512Mi
            requests:
              cpu: 20m
              memory: 64Mi
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.annotations['olm.targetNamespaces']
            - name: DASH_NAMESPACES
              valueFrom:
                configMapKeyRef:
                  name: namespace-scope
                  key: namespaces
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: ibm-monitoring-grafana-operator
            - name: GRAFANA_IMAGE
              value: quay.io/opencloudio/grafana:v7.1.5-build.10
            - name: ICP_MANAGEMENT_INGRESS_IMAGE
              value: quay.io/opencloudio/icp-management-ingress:2.5.15
            - name: DASHBOARD_CONTROLLER_IMAGE
              value: quay.io/opencloudio/dashboard-controller:v1.2.2-build.10
            - name: GRAFANA_OCPTHANOS_PROXY_IMAGE
              value: quay.io/opencloudio/grafana-ocpthanos-proxy:1.0.11