Skip to content

Commit 7edcf3e

Browse files
committed
feat(cloudnative-pg): add annotations to all CRDs
We want to be able to pass annotations to all CustomResourceDefinitions. This is helpful in that it allows passing an annotation to ArgoCD to enable ServerSideApply: ``` crds: annotations: argocd.argoproj.io/sync-options: ServerSideApply=true ``` Fixes #656
1 parent 0dcefbe commit 7edcf3e

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

charts/cloudnative-pg/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ CloudNativePG Operator Helm Chart
3838
| config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap. |
3939
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001,"seccompProfile":{"type":"RuntimeDefault"}}` | Container Security Context. |
4040
| crds.create | bool | `true` | Specifies whether the CRDs should be created when installing the chart. |
41+
| crds.annotations | dict | `{}` | Annotations to pass to the CRDs created. Useful e.g. for ArgoCD ServerSideApply |
4142
| dnsPolicy | string | `""` | |
4243
| fullnameOverride | string | `""` | |
4344
| hostNetwork | bool | `false` | |

charts/cloudnative-pg/templates/crds/crds.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.18.0
77
helm.sh/resource-policy: keep
8+
{{- with .Values.crds.annotations }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
811
name: backups.postgresql.cnpg.io
912
spec:
1013
group: postgresql.cnpg.io
@@ -451,6 +454,9 @@ metadata:
451454
annotations:
452455
controller-gen.kubebuilder.io/version: v0.18.0
453456
helm.sh/resource-policy: keep
457+
{{- with .Values.crds.annotations }}
458+
{{- toYaml . | nindent 4 }}
459+
{{- end }}
454460
name: clusterimagecatalogs.postgresql.cnpg.io
455461
spec:
456462
group: postgresql.cnpg.io
@@ -533,6 +539,9 @@ metadata:
533539
annotations:
534540
controller-gen.kubebuilder.io/version: v0.18.0
535541
helm.sh/resource-policy: keep
542+
{{- with .Values.crds.annotations }}
543+
{{- toYaml . | nindent 4 }}
544+
{{- end }}
536545
name: clusters.postgresql.cnpg.io
537546
spec:
538547
group: postgresql.cnpg.io
@@ -7104,6 +7113,9 @@ metadata:
71047113
annotations:
71057114
controller-gen.kubebuilder.io/version: v0.18.0
71067115
helm.sh/resource-policy: keep
7116+
{{- with .Values.crds.annotations }}
7117+
{{- toYaml . | nindent 4 }}
7118+
{{- end }}
71077119
name: databases.postgresql.cnpg.io
71087120
spec:
71097121
group: postgresql.cnpg.io
@@ -7477,6 +7489,9 @@ metadata:
74777489
annotations:
74787490
controller-gen.kubebuilder.io/version: v0.18.0
74797491
helm.sh/resource-policy: keep
7492+
{{- with .Values.crds.annotations }}
7493+
{{- toYaml . | nindent 4 }}
7494+
{{- end }}
74807495
name: failoverquorums.postgresql.cnpg.io
74817496
spec:
74827497
group: postgresql.cnpg.io
@@ -7555,6 +7570,9 @@ metadata:
75557570
annotations:
75567571
controller-gen.kubebuilder.io/version: v0.18.0
75577572
helm.sh/resource-policy: keep
7573+
{{- with .Values.crds.annotations }}
7574+
{{- toYaml . | nindent 4 }}
7575+
{{- end }}
75587576
name: imagecatalogs.postgresql.cnpg.io
75597577
spec:
75607578
group: postgresql.cnpg.io
@@ -7636,6 +7654,9 @@ metadata:
76367654
annotations:
76377655
controller-gen.kubebuilder.io/version: v0.18.0
76387656
helm.sh/resource-policy: keep
7657+
{{- with .Values.crds.annotations }}
7658+
{{- toYaml . | nindent 4 }}
7659+
{{- end }}
76397660
name: poolers.postgresql.cnpg.io
76407661
spec:
76417662
group: postgresql.cnpg.io
@@ -16503,6 +16524,9 @@ metadata:
1650316524
annotations:
1650416525
controller-gen.kubebuilder.io/version: v0.18.0
1650516526
helm.sh/resource-policy: keep
16527+
{{- with .Values.crds.annotations }}
16528+
{{- toYaml . | nindent 4 }}
16529+
{{- end }}
1650616530
name: publications.postgresql.cnpg.io
1650716531
spec:
1650816532
group: postgresql.cnpg.io
@@ -16699,6 +16723,9 @@ metadata:
1669916723
annotations:
1670016724
controller-gen.kubebuilder.io/version: v0.18.0
1670116725
helm.sh/resource-policy: keep
16726+
{{- with .Values.crds.annotations }}
16727+
{{- toYaml . | nindent 4 }}
16728+
{{- end }}
1670216729
name: scheduledbackups.postgresql.cnpg.io
1670316730
spec:
1670416731
group: postgresql.cnpg.io
@@ -16891,6 +16918,9 @@ metadata:
1689116918
annotations:
1689216919
controller-gen.kubebuilder.io/version: v0.18.0
1689316920
helm.sh/resource-policy: keep
16921+
{{- with .Values.crds.annotations }}
16922+
{{- toYaml . | nindent 4 }}
16923+
{{- end }}
1689416924
name: subscriptions.postgresql.cnpg.io
1689516925
spec:
1689616926
group: postgresql.cnpg.io

charts/cloudnative-pg/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ updateStrategy: {}
4545
crds:
4646
# -- Specifies whether the CRDs should be created when installing the chart.
4747
create: true
48-
48+
# -- Annotations to pass to the CRDs created. Useful e.g. for ArgoCD ServerSideApply
49+
annotations: {}
4950
# -- The webhook configuration.
5051
webhook:
5152
port: 9443

0 commit comments

Comments
 (0)