Skip to content

Commit 9dc4bf6

Browse files
feat(cluster): Add support for passing inheritedMetadata to Cluster spec
Signed-off-by: Sebastian Pohl <sebastian.pohl@materna.group>
1 parent de10713 commit 9dc4bf6

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

charts/cluster/templates/cluster.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ spec:
4545
{{- if .Values.cluster.priorityClassName }}
4646
priorityClassName: {{ .Values.cluster.priorityClassName }}
4747
{{- end }}
48+
inheritedMetadata:
49+
{{- toYaml . | nindent 4 }}
50+
{{ end }}
4851

4952
primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }}
5053
primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }}

charts/cluster/test/postgresql-cluster-configuration/01-non_default_configuration_cluster-assert.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ spec:
1212
postgresUID: 1001
1313
postgresGID: 1002
1414
instances: 2
15+
inheritedMetadata:
16+
labels:
17+
azure.workload.identity/use: "true"
1518
postgresql:
1619
parameters:
1720
max_connections: "42"

charts/cluster/test/postgresql-cluster-configuration/01-non_default_configuration_cluster.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ cluster:
8080
foo: bar
8181
annotations:
8282
foo: bar
83+
inheritedMetadata:
84+
annotations:
85+
super.annotation: "super-annotation"
86+
labels:
87+
azure.workload.identity/use: "true"
8388
serviceAccountTemplate:
8489
metadata:
8590
annotations:

charts/cluster/values.schema.json

21.4 KB
Binary file not shown.

charts/cluster/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,15 @@ cluster:
298298

299299
additionalLabels: {}
300300
annotations: {}
301-
301+
# -- Metadata to be inherited by all resources related to a Cluster, annotations and labels defined here will be added to all cluster resources
302+
# See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-EmbeddedObjectMetadata
303+
inheritedMetadata: {}
304+
# annotations:
305+
# my.custom: annotation
306+
# another.custom: annotation
307+
# labels:
308+
# my.custom: label
309+
# another.custom: label
302310

303311
backups:
304312
# -- You need to configure backups manually, so backups are disabled by default.

0 commit comments

Comments
 (0)