apiVersion: batch/v1
kind: Job
metadata:
  name: install-postgres-operator
  labels:
    app.kubernetes.io/name: '${OPERATOR_NAME}'
spec:
  template:
    spec:
      serviceAccountName: '${INSTALLER_SERVICE_ACCOUNT}'
      restartPolicy: Never
      containers:
        - name: installer
          image: '${INSTALLER_IMAGE}'
          imagePullPolicy: Always
          command: ['/opt/postgres-operator/install.sh']
          env:
            - { name: NAMESPACE, value: '${OPERATOR_NAMESPACE}' }
            - { name: NAME,      value: '${OPERATOR_NAME}' }
          volumeMounts:
            - { mountPath: /etc/ansible, name: configuration }
      volumes:
        - { name: configuration, secret: { secretName: install-postgres-operator } }
