diff --git a/docs/public/installation.md b/docs/public/installation.md index a87c2845..0956136f 100644 --- a/docs/public/installation.md +++ b/docs/public/installation.md @@ -198,16 +198,17 @@ This sections describes all possible deploy parameters per Helm Chart per compon The general parameters used for the configurations are specified below. -| Parameter | Type | Mandatory | Default value | Description | -|-----------------------|--------|-----------|---------------|----------------------------------------------------------------------------------------| -| postgresUser | string | no | postgres | Specifies the name of the database superuser. | -| postgresPassword | string | yes | p@ssWOrD1 | Specifies the password for the database superuser. | -| replicatorPassword | string | no | replicator | Specifies the password for the database replicator. | -| serviceAccount.create | bool | no | true | Specifies whether a service account needs to be created. | -| serviceAccount.name | string | no | postgres-sa | Specifies name of the Service Account under which Postgres Operator will work. | -| runTestsOnly | bool | no | false | Indicates whether to run Integration Tests (skipping deploy step) only or not. | -| affinity | json | no | n/a | Defines affinity scheduling rules for all components. Can be overridden per component. | -| podLabels | yaml | no | n/a | Specifies custom pod labels for all the components. Can be overridden per component. | +| Parameter | Type | Mandatory | Default value | Description | +|----------------------------|--------|-----------|---------------|----------------------------------------------------------------------------------------| +| pvc.metadata.annotations | map[string]string | no | n/a | Global annotations applied to all PVCs created by the operator. Use `argocd.argoproj.io/sync-options: Prune=false` to protect all PVCs from ArgoCD pruning. Storage-specific annotations override global ones. | +| postgresUser | string | no | postgres | Specifies the name of the database superuser. | +| postgresPassword | string | yes | p@ssWOrD1 | Specifies the password for the database superuser. | +| replicatorPassword | string | no | replicator | Specifies the password for the database replicator. | +| serviceAccount.create | bool | no | true | Specifies whether a service account needs to be created. | +| serviceAccount.name | string | no | postgres-sa | Specifies name of the Service Account under which Postgres Operator will work. | +| runTestsOnly | bool | no | false | Indicates whether to run Integration Tests (skipping deploy step) only or not. | +| affinity | json | no | n/a | Defines affinity scheduling rules for all components. Can be overridden per component. | +| podLabels | yaml | no | n/a | Specifies custom pod labels for all the components. Can be overridden per component. | **Note**: `postgresUser` is not the user which will be created during deployment. You should mention here the user which is already present with superuser role. If you need to use some other user instead of postgres, you should create the desired user manually with superuser role. @@ -340,16 +341,17 @@ Patroni Core Operator allows configuration of TLS for PostgreSQL. By default, re The general parameters used for the configurations are specified below. -| Parameter | Type | Mandatory | Default value | Description | -|------------------------|--------|-----------|---------------|----------------------------------------------------------------------------------------| -| postgresUser | string | no | postgres | Specifies the name of the database superuser. | -| postgresPassword | string | yes | p@ssWOrD1 | Specifies the password for the database superuser. | -| replicatorPassword | string | no | replicator | Specifies the password for the database replicator. | -| serviceAccount.create | bool | no | true | Specifies whether a service account needs to be created. | -| serviceAccount.name | string | no | postgres-sa | Specifies name of the Service Account under which Postgres Operator will work. | -| runTestsOnly | bool | no | false | Indicates whether to run Integration Tests (skipping deploy step) only or not. | -| affinity | json | no | n/a | Defines affinity scheduling rules for all components. Can be overridden per component. | -| podLabels | yaml | no | n/a | Specifies custom pod labels for all the components. Can be overridden per component. | +| Parameter | Type | Mandatory | Default value | Description | +|--------------------------|--------|-----------|---------------|----------------------------------------------------------------------------------------| +| pvc.metadata.annotations | map[string]string | no | n/a | Global annotations applied to all PVCs created by the operator. Use `argocd.argoproj.io/sync-options: Prune=false` to protect all PVCs from ArgoCD pruning. Storage-specific annotations override global ones. | +| postgresUser | string | no | postgres | Specifies the name of the database superuser. | +| postgresPassword | string | yes | p@ssWOrD1 | Specifies the password for the database superuser. | +| replicatorPassword | string | no | replicator | Specifies the password for the database replicator. | +| serviceAccount.create | bool | no | true | Specifies whether a service account needs to be created. | +| serviceAccount.name | string | no | postgres-sa | Specifies name of the Service Account under which Postgres Operator will work. | +| runTestsOnly | bool | no | false | Indicates whether to run Integration Tests (skipping deploy step) only or not. | +| affinity | json | no | n/a | Defines affinity scheduling rules for all components. Can be overridden per component. | +| podLabels | yaml | no | n/a | Specifies custom pod labels for all the components. Can be overridden per component. | **Note**: `postgresUser` is not the user which will be created during deployment. You should mention here the user which is already present with superuser role. If you need to use some other user instead of postgres, you should create the desired user manually with superuser role. diff --git a/operator/charts/patroni-core/templates/cr.yaml b/operator/charts/patroni-core/templates/cr.yaml index 9054babf..da1a8d66 100644 --- a/operator/charts/patroni-core/templates/cr.yaml +++ b/operator/charts/patroni-core/templates/cr.yaml @@ -124,10 +124,15 @@ spec: - {{ . }} {{- end }} {{ end }} - {{ if .Values.patroni.storage.annotations }} + {{- if or .Values.pvc.metadata.annotations .Values.patroni.storage.annotations }} annotations: - {{- toYaml .Values.patroni.storage.annotations | nindent 8 }} - {{ end }} + {{- if .Values.pvc.metadata.annotations }} + {{- toYaml .Values.pvc.metadata.annotations | nindent 8 }} + {{- end }} + {{- if .Values.patroni.storage.annotations }} + {{- toYaml .Values.patroni.storage.annotations | nindent 8 }} + {{- end }} + {{- end }} {{ if .Values.patroni.standbyCluster }} standbyCluster: host: {{ .Values.patroni.standbyCluster.host }} @@ -149,7 +154,14 @@ spec: {{ if .Values.patroni.pgWalStorage }} pgWalStorageAutoManage: {{ default "false" .Values.patroni.pgWalStorageAutoManage }} pgWalStorage: -{{ toYaml .Values.patroni.pgWalStorage | indent 6 }} + {{- $walStorage := .Values.patroni.pgWalStorage | deepCopy }} + {{- if and .Values.pvc.metadata.annotations (not $walStorage.annotations) }} + {{- $_ := set $walStorage "annotations" .Values.pvc.metadata.annotations }} + {{- else if and .Values.pvc.metadata.annotations $walStorage.annotations }} + {{- $merged := merge $walStorage.annotations .Values.pvc.metadata.annotations }} + {{- $_ := set $walStorage "annotations" $merged }} + {{- end }} +{{ toYaml $walStorage | indent 6 }} {{ end }} forceCollationVersionUpgrade: {{ default "false" .Values.patroni.forceCollationVersionUpgrade }} {{- if .Values.patroni.ignoreSlots }} @@ -183,7 +195,14 @@ spec: backupFromStandby: {{ .Values.pgBackRest.backupFromStandby | default false }} {{ if .Values.pgBackRest.rwx }} rwx: -{{ toYaml .Values.pgBackRest.rwx | indent 6 }} + {{- $rwxStorage := .Values.pgBackRest.rwx | deepCopy }} + {{- if and .Values.pvc.metadata.annotations (not $rwxStorage.annotations) }} + {{- $_ := set $rwxStorage "annotations" .Values.pvc.metadata.annotations }} + {{- else if and .Values.pvc.metadata.annotations $rwxStorage.annotations }} + {{- $merged := merge $rwxStorage.annotations .Values.pvc.metadata.annotations }} + {{- $_ := set $rwxStorage "annotations" $merged }} + {{- end }} +{{ toYaml $rwxStorage | indent 6 }} {{ end }} {{ if .Values.pgBackRest.s3 }} s3: diff --git a/operator/charts/patroni-core/values.schema.json b/operator/charts/patroni-core/values.schema.json index 6b3ee064..0bd01896 100644 --- a/operator/charts/patroni-core/values.schema.json +++ b/operator/charts/patroni-core/values.schema.json @@ -4,6 +4,26 @@ "type": "object", "additionalProperties": true, "properties": { + "pvc": { + "type": "object", + "additionalProperties": false, + "description": "Global PVC configuration", + "properties": { + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Global annotations applied to all PVCs. Storage-specific annotations will override these." + } + } + } + } + }, "postgresUser": { "type": "string", "default": "postgres", diff --git a/operator/charts/patroni-core/values.yaml b/operator/charts/patroni-core/values.yaml index 60d75610..a0e53676 100644 --- a/operator/charts/patroni-core/values.yaml +++ b/operator/charts/patroni-core/values.yaml @@ -2,6 +2,18 @@ ## This is a YAML-formatted file. ## Declare variables to be passed into your templates. +# Global PVC annotations applied to all PersistentVolumeClaims created by the operator. +# Use this to protect PVCs from ArgoCD pruning or add custom metadata. +# Storage-specific annotations will override these global annotations if both are set. +# Example: +# pvc: +# metadata: +# annotations: +# argocd.argoproj.io/sync-options: Prune=false +pvc: + metadata: + annotations: {} + # The name of database superuser. postgresUser: postgres # The password for the database superuser. @@ -185,11 +197,6 @@ patroni: type: pv # Size of the PVC that will be create for each of Patroni Pod as mount for data files size: 5Gi - # Optional annotations to apply to PVCs created for Patroni storage. - # Use this to protect PVCs from ArgoCD pruning or add custom metadata. - # Example: Prevent ArgoCD from deleting PVCs during sync: - # annotations: - # argocd.argoproj.io/sync-options: Prune=false # Parameter specifies the list of labels that is used to bind suitable # persistent volumes with the persistent volume claims # selectors: @@ -233,10 +240,6 @@ patroni: # type: provisioned # Size of the PVC that will be created for each of Patroni Pod as mount for data files # size: 10Gi - # Optional annotations to apply to PVCs created for WAL storage. - # Use this to protect PVCs from ArgoCD pruning or add custom metadata. - # annotations: - # argocd.argoproj.io/sync-options: Prune=false # Parameter specifies the list of labels that is used to bind suitable # persistent volumes with the persistent volume claims # selectors: @@ -269,8 +272,6 @@ patroni: # size: 3Gi # volumes: # - pg-backrest-backups-pv-1 -# annotations: -# argocd.argoproj.io/sync-options: Prune=false # s3: # bucket: "pgbackrest" # endpoint: "https://minio-service" diff --git a/operator/charts/patroni-services/templates/cr.yaml b/operator/charts/patroni-services/templates/cr.yaml index f24afe67..65aba3ca 100644 --- a/operator/charts/patroni-services/templates/cr.yaml +++ b/operator/charts/patroni-services/templates/cr.yaml @@ -98,10 +98,15 @@ spec: - {{ . }} {{- end }} {{ end }} - {{ if .Values.backupDaemon.storage.annotations }} + {{- if or .Values.pvc.metadata.annotations .Values.backupDaemon.storage.annotations }} annotations: - {{- toYaml .Values.backupDaemon.storage.annotations | nindent 8 }} - {{ end }} + {{- if .Values.pvc.metadata.annotations }} + {{- toYaml .Values.pvc.metadata.annotations | nindent 8 }} + {{- end }} + {{- if .Values.backupDaemon.storage.annotations }} + {{- toYaml .Values.backupDaemon.storage.annotations | nindent 8 }} + {{- end }} + {{- end }} {{ if .Values.backupDaemon.priorityClassName }} priorityClassName: {{ .Values.backupDaemon.priorityClassName }} {{ end }} diff --git a/operator/charts/patroni-services/values.schema.json b/operator/charts/patroni-services/values.schema.json index 1d1c1327..0d188d78 100644 --- a/operator/charts/patroni-services/values.schema.json +++ b/operator/charts/patroni-services/values.schema.json @@ -4,6 +4,26 @@ "type": "object", "additionalProperties": true, "properties": { + "pvc": { + "type": "object", + "additionalProperties": false, + "description": "Global PVC configuration", + "properties": { + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Global annotations applied to all PVCs. Storage-specific annotations will override these." + } + } + } + } + }, "postgresUser": { "type": "string", "default": "postgres", diff --git a/operator/charts/patroni-services/values.yaml b/operator/charts/patroni-services/values.yaml index 65caf328..84652f9d 100644 --- a/operator/charts/patroni-services/values.yaml +++ b/operator/charts/patroni-services/values.yaml @@ -2,6 +2,18 @@ ## This is a YAML-formatted file. ## Declare variables to be passed into your templates. +# Global PVC annotations applied to all PersistentVolumeClaims created by the operator. +# Use this to protect PVCs from ArgoCD pruning or add custom metadata. +# Storage-specific annotations will override these global annotations if both are set. +# Example: +# pvc: +# metadata: +# annotations: +# argocd.argoproj.io/sync-options: Prune=false +pvc: + metadata: + annotations: {} + # The name of database superuser. postgresUser: postgres # The password for the database superuser. @@ -213,11 +225,6 @@ backupDaemon: type: provisioned # Size of the PVC that will be create for each of Patroni Pod as mount for data files size: 1Gi - # Optional annotations to apply to PVCs created for backup daemon storage. - # Use this to protect PVCs from ArgoCD pruning or add custom metadata. - # Example: Prevent ArgoCD from deleting PVCs during sync: - # annotations: - # argocd.argoproj.io/sync-options: Prune=false # Parameter specifies the list of labels that is used to bind suitable # persistent volumes with the persistent volume claims # selectors: @@ -245,8 +252,6 @@ backupDaemon: # size: 3Gi # volumes: # - pg-backrest-backups-pv-1 -# annotations: -# argocd.argoproj.io/sync-options: Prune=false # s3: # bucket: "pgbackrest" # endpoint: "https://minio-service"