---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ansible
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ansible
  template:
    metadata:
      labels:
        name: ansible
{% if hash is defined %}
        image_hash: "{{ hash }}"
{% endif %}
    spec:
      serviceAccountName: ansible
      containers:
        - name: operator
          # Replace this with the built image name
          image: "{{ image }}"
          imagePullPolicy: "{{ pull_policy }}"
          volumeMounts:
          - mountPath: /tmp/ansible-operator/runner
            name: runner
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "ansible"
            - name: ANSIBLE_GATHERING
              value: explicit
            - name: ANSIBLE_INVENTORY
              value: /opt/ansible/inventory
            - name: ANSIBLE_DEBUG_LOGS
              value: "TRUE"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 6789
            initialDelaySeconds: 5
            periodSeconds: 3
      volumes:
        - name: runner
          emptyDir: {}
