Skip to content

Commit f6d36f2

Browse files
feat(cluster): Add support for passing inheritedMetadata to Cluster spec
1 parent ca84da1 commit f6d36f2

File tree

8 files changed

+52
-3
lines changed

8 files changed

+52
-3
lines changed

charts/cloudnative-pg/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ CloudNativePG Operator Helm Chart
7777
| serviceAccount.create | bool | `true` | Specifies whether the service account should be created. |
7878
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |
7979
| tolerations | list | `[]` | Tolerations for the operator to be installed. |
80-
| updateStrategy | object | `{}` | Update strategy for the operator. |
80+
| updateStrategy | object | `{}` | Update strategy for the operator. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy For example: type: RollingUpdate rollingUpdate: maxSurge: 25% maxUnavailable: 25% |
8181
| webhook | object | `{"livenessProbe":{"initialDelaySeconds":3},"mutating":{"create":true,"failurePolicy":"Fail"},"port":9443,"readinessProbe":{"initialDelaySeconds":3},"validating":{"create":true,"failurePolicy":"Fail"}}` | The webhook configuration. |
8282

83+
----------------------------------------------
84+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/cloudnative-pg/values.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@
246246
"tolerations": {
247247
"type": "array"
248248
},
249+
"updateStrategy": {
250+
"type": "object"
251+
},
249252
"webhook": {
250253
"type": "object",
251254
"properties": {

charts/cluster/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# cluster
22

3-
![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
3+
4+
5+
6+
7+
8+
![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
9+
410

511
> **Warning**
612
> ### This chart is under active development.
713
> ### Advised caution when using in production!
814
15+
916
A note on the chart's purpose
1017
-----------------------------
1118

@@ -26,6 +33,7 @@ That being said, we welcome PRs that improve the chart, but please keep in mind
2633
single configuration that the operator provides and we may reject PRs that add too much complexity and maintenance
2734
difficulty to the chart.
2835

36+
2937
Getting Started
3038
---------------
3139

@@ -53,6 +61,7 @@ cnpg/cluster
5361

5462
A more detailed guide can be found in the [Getting Started docs](<./docs/Getting Started.md>).
5563

64+
5665
Cluster Configuration
5766
---------------------
5867

@@ -97,17 +106,23 @@ Each backup adapter takes it's own set of parameters, listed in the [Configurati
97106
below. Refer to the table for the full list of parameters and place the configuration under the appropriate key: `backup.s3`,
98107
`backup.azure`, or `backup.google`.
99108

109+
100110
Recovery
101111
--------
102112

103113
There is a separate document outlining the recovery procedure here: **[Recovery](docs/recovery.md)**
104114

115+
105116
Examples
106117
--------
107118

108119
There are several configuration examples in the [examples](examples) directory. Refer to them for a basic setup and
109120
refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentation/current/) for more advanced configurations.
110121

122+
123+
124+
125+
111126
## Values
112127

113128
| Key | Type | Default | Description |
@@ -159,6 +174,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
159174
| cluster.imageName | string | `""` | Name of the container image, supporting both tags (<image>:<tag>) and digests for deterministic and repeatable deployments: <image>:<tag>@sha256:<digestValue> |
160175
| cluster.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy. One of Always, Never or IfNotPresent. If not defined, it defaults to IfNotPresent. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images |
161176
| cluster.imagePullSecrets | list | `[]` | The list of pull secrets to be used to pull the images. See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-LocalObjectReference |
177+
| cluster.inheritedMetadata | object | `{}` | Metadata to be inherited by all resources related to a Cluster, annotations and labels defined here will be added to all cluster resources See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-EmbeddedObjectMetadata |
162178
| cluster.initdb | object | `{}` | BootstrapInitDB is the configuration of the bootstrap process when initdb is used. See: https://cloudnative-pg.io/documentation/current/bootstrap/ See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-bootstrapinitdb |
163179
| cluster.instances | int | `3` | Number of instances |
164180
| cluster.logLevel | string | `"info"` | The instances' log level, one of the following values: error, warning, info (default), debug, trace |
@@ -269,6 +285,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
269285
| ---- | ------ | --- |
270286
| itay-grudev | <itay+cloudnativepg-charts+github.com@grudev.com> | |
271287

288+
272289
Features that require feedback
273290
------------------------------
274291

@@ -278,8 +295,13 @@ Alternatively a ticket and a PR if you have found that something needs a change
278295
- [ ] Google Cloud Storage Backups
279296
- [ ] Google Cloud Storage Recovery
280297

298+
281299
TODO
282300
----
283301
* IAM Role for S3 Service Account
284302
* Automatic provisioning of a Alert Manager configuration
285303

304+
305+
306+
----------------------------------------------
307+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

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
ldap:
1720
server: 'openldap.default.svc.cluster.local'

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
@@ -101,6 +101,11 @@ cluster:
101101
foo: bar
102102
annotations:
103103
foo: bar
104+
inheritedMetadata:
105+
annotations:
106+
super.annotation: "super-annotation"
107+
labels:
108+
azure.workload.identity/use: "true"
104109
serviceAccountTemplate:
105110
metadata:
106111
annotations:

charts/cluster/values.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@
205205
"imagePullSecrets": {
206206
"type": "array"
207207
},
208+
"inheritedMetadata": {
209+
"type": "object"
210+
},
208211
"initdb": {
209212
"type": "object"
210213
},

charts/cluster/values.yaml

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

314314
additionalLabels: {}
315315
annotations: {}
316-
316+
# -- Metadata to be inherited by all resources related to a Cluster, annotations and labels defined here will be added to all cluster resources
317+
# See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-EmbeddedObjectMetadata
318+
inheritedMetadata: {}
319+
# annotations:
320+
# my.custom: annotation
321+
# another.custom: annotation
322+
# labels:
323+
# my.custom: label
324+
# another.custom: label
317325

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

0 commit comments

Comments
 (0)