apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: grafana-operator
  template:
    metadata:
      labels:
        name: grafana-operator
    spec:
      serviceAccountName: grafana-operator
      containers:
        - name: grafana-operator
          image: fishu/grafana-operator:latest
          command:
            - grafana-operator
          imagePullPolicy: Always
          resources:
            limits:
              cpu: "1"
              memory: 1Gi
            requests:
              cpu: 100m
              memory: 200Mi
          env:
            - name: WATCH_NAMESPACE
              value: ""
            - name: ENABLE_WEBHOOKS
              value: "true"
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "grafana-operator"
          volumeMounts:
            - name: webhook-certs
              mountPath: /etc/webhook/certs
              readOnly: true
      volumes:
        - name: webhook-certs
          secret:
            secretName: grafana-webhook-cert
