apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: zalando-postgres-operator
  namespace: postgres-system
spec:
  releaseName: zalando-postgres-operator
  chart:
    spec:
      chart: postgres-operator
      sourceRef:
        kind: HelmRepository
        name: zalando-postgres-operator
        namespace: postgres-system
      valuesFiles:
        - values.yaml
      version: 1.8.2
  interval: 5m
  install:
    crds: CreateReplace
  upgrade:
    crds: CreateReplace
  values:
    rbac:
      createAggregateClusterRoles: true
    configGeneral:
      sidecars:
        - name: "exporter"
          # renovate:
          image: "quay.io/prometheuscommunity/postgres-exporter:v0.11.1"
          ports:
            - name: exporter
              containerPort: 9187
              protocol: TCP
          resources:
            limits:
              cpu: 500m
              memory: 256M
            requests:
              cpu: 100m
              memory: 200M
          env:
          - name: "DATA_SOURCE_URI"
            value: "$(POD_NAME)/postgres?sslmode=require"
          - name: "DATA_SOURCE_USER"
            value: "$(POSTGRES_USER)"
          - name: "DATA_SOURCE_PASS"
            value: "$(POSTGRES_PASSWORD)"
          - name: "PG_EXPORTER_AUTO_DISCOVER_DATABASES"
            value: "true"
    configKubernetes:
      enable_pod_antiaffinity: true
