---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kiali-operator
  namespace: ${OPERATOR_NAMESPACE}
  labels:
    app: kiali-operator
    version: ${OPERATOR_VERSION_LABEL}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kiali-operator
  template:
    metadata:
      name: kiali-operator
      labels:
        app: kiali-operator
        # required for the operator SDK metric service selector
        name: kiali-operator
        version: ${OPERATOR_VERSION_LABEL}
      annotations:
        prometheus.io/scrape: "true"
    spec:
      serviceAccountName: kiali-operator
      containers:
      - name: operator
        image: ${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_VERSION}
        imagePullPolicy: ${OPERATOR_IMAGE_PULL_POLICY}
        args:
        - "--zap-level=info"
        volumeMounts:
        - mountPath: /tmp/ansible-operator/runner
          name: runner
        env:
        - name: WATCH_NAMESPACE
          value: ${OPERATOR_WATCH_NAMESPACE}
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: OPERATOR_NAME
          value: "kiali-operator"
        - name: ANSIBLE_DEBUG_LOGS
          value: "True"
        - name: ANSIBLE_VERBOSITY_KIALI_KIALI_IO
          value: "1"
        ports:
        - name: http-metrics
          containerPort: 8383
        - name: cr-metrics
          containerPort: 8686
      volumes:
      - name: runner
        emptyDir: {}
