apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: keycloak-db
spec:
  instances: 2
  storage:
    size: 20Gi
  {{- $configMap := lookup "v1" "ConfigMap" "cozy-system" "cozystack-scheduling" }}
  {{- if $configMap }}
  {{- $rawConstraints := get $configMap.data "globalAppTopologySpreadConstraints" }}
  {{- if $rawConstraints }}
  {{- $rawConstraints | fromYaml | toYaml | nindent 2 }}
    labelSelector:
      matchLabels:
        cnpg.io/cluster: keycloak-db
  {{- end }}
  {{- end }}
  monitoring:
    enablePodMonitor: true

  inheritedMetadata:
    labels:
      policy.cozystack.io/allow-to-apiserver: "true"
