{{- if .Values.cluster.enabled -}}
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: {{ include "Archmeister.fullname" . }}
  annotations:
    linkerd.io/inject: disabled
  labels:
    {{- include "Archmeister.labels" . | nindent 4 }}
spec:
  imageName: {{ .Values.cluster.imageName | default "ghcr.io/cloudnative-pg/postgresql:15-3" }}
  instances: {{ .Values.cluster.instances | default "2" }}

  # Example of rolling update strategy:
  # - unsupervised: automated update of the primary once all
  #                 replicas have been upgraded (default)
  # - supervised: requires manual supervision to perform
  #               the switchover of the primary
  primaryUpdateStrategy: unsupervised
  backup:
    retentionPolicy: {{ .Values.cluster.backupRetention | default "60d" }}

  storage:
    size: {{ .Values.cluster.size | default "5Gi" }}

  {{- with .Values.cluster.bootstrap }}
  bootstrap:
  {{- toYaml . | nindent 4 }}
  {{- end }}

{{- end }}


