---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pulumi-kubernetes-operator
spec:
  # Currently only 1 replica supported, until leader election: https://github.com/pulumi/pulumi-kubernetes-operator/issues/33
  replicas: 1
  selector:
    matchLabels:
      name: pulumi-kubernetes-operator
  template:
    metadata:
      labels:
        name: pulumi-kubernetes-operator
    spec:
      serviceAccountName: pulumi-kubernetes-operator
      volumes:
        - name: tmp-dir
          emptyDir: {}
      containers:
        - name: pulumi-kubernetes-operator
          image: <IMG_NAME>:<IMG_VERSION>
          args:
            - "--zap-level=error"
            - "--zap-time-encoding=iso8601"
          volumeMounts:
            - mountPath: /tmp
              name: tmp-dir
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "pulumi-kubernetes-operator"
            - name: GRACEFUL_SHUTDOWN_TIMEOUT_DURATION
              value: "5m"
            - name: MAX_CONCURRENT_RECONCILES
              value: "10"
      terminationGracePeriodSeconds: 300 # Should be same or larger than GRACEFUL_SHUTDOWN_TIMEOUT_DURATION
