---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pgo
  namespace: postgres-system
  labels:
    postgres-operator.crunchydata.com/control-plane: postgres-operator
spec:
  replicas: 1
  strategy: { type: Recreate }
  selector:
    matchLabels:
      postgres-operator.crunchydata.com/control-plane: postgres-operator
  template:
    metadata:
      labels:
        postgres-operator.crunchydata.com/control-plane: postgres-operator
    spec:
      containers:
      - name: operator
        image: postgres-operator
        env:
        - name: PGO_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: CRUNCHY_DEBUG
          value: "true"
        - name: RELATED_IMAGE_POSTGRES_14
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.9-1"
        - name: RELATED_IMAGE_POSTGRES_14_GIS_3.1
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.9-3.1-1"
        - name: RELATED_IMAGE_POSTGRES_14_GIS_3.2
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.9-3.2-1"
        - name: RELATED_IMAGE_POSTGRES_14_GIS_3.3
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.9-3.3-1"
        - name: RELATED_IMAGE_POSTGRES_15
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-15.4-1"
        - name: RELATED_IMAGE_POSTGRES_15_GIS_3.3
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-15.4-3.3-1"
        - name: RELATED_IMAGE_POSTGRES_16
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.0-0"
        - name: RELATED_IMAGE_POSTGRES_16_GIS_3.3
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.0-3.3-0"
        - name: RELATED_IMAGE_POSTGRES_16_GIS_3.4
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.0-3.4-0"
        - name: RELATED_IMAGE_PGADMIN
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-18"
        - name: RELATED_IMAGE_PGBACKREST
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.47-1"
        - name: RELATED_IMAGE_PGBOUNCER
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.19-5"
        - name: RELATED_IMAGE_PGEXPORTER
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.4.3-0"
        - name: RELATED_IMAGE_PGUPGRADE
          value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.4.3-0"
        securityContext:
          allowPrivilegeEscalation: false
          capabilities: { drop: [ALL] }
          readOnlyRootFilesystem: true
          runAsNonRoot: true
      serviceAccountName: pgo
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              preference:
                matchExpressions:
                  - key: kubernetes.io/arch
                    operator: In
                    values:
                      - arm64