From c09c81dd3f37e56e1b5013a97e48f0a848c53c7d Mon Sep 17 00:00:00 2001 From: Elliot Courant Date: Fri, 30 Aug 2024 20:24:40 -0500 Subject: [PATCH] feat(cnpg): Adding `topologySpreadConstraints` support to the deployment This adds support for specifying [`topologySpreadConstraints`](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) for the cloudnative-pg operator deployment. Resolves #371 Signed-off-by: Elliot Courant --- charts/cloudnative-pg/README.md | 1 + charts/cloudnative-pg/templates/deployment.yaml | 4 ++++ charts/cloudnative-pg/values.schema.json | 3 +++ charts/cloudnative-pg/values.yaml | 3 +++ 4 files changed, 11 insertions(+) diff --git a/charts/cloudnative-pg/README.md b/charts/cloudnative-pg/README.md index 3083109e8..6d9a689bc 100644 --- a/charts/cloudnative-pg/README.md +++ b/charts/cloudnative-pg/README.md @@ -73,5 +73,6 @@ CloudNativePG Operator Helm Chart | serviceAccount.create | bool | `true` | Specifies whether the service account should be created. | | 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. | | tolerations | list | `[]` | Tolerations for the operator to be installed. | +| topologySpreadConstraints | list | `[]` | [Topology Spread Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) for the operator to be installed. | | webhook | object | `{"livenessProbe":{"initialDelaySeconds":3},"mutating":{"create":true,"failurePolicy":"Fail"},"port":9443,"readinessProbe":{"initialDelaySeconds":3},"validating":{"create":true,"failurePolicy":"Fail"}}` | The webhook configuration. | diff --git a/charts/cloudnative-pg/templates/deployment.yaml b/charts/cloudnative-pg/templates/deployment.yaml index 569752007..9d590c656 100644 --- a/charts/cloudnative-pg/templates/deployment.yaml +++ b/charts/cloudnative-pg/templates/deployment.yaml @@ -127,6 +127,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/cloudnative-pg/values.schema.json b/charts/cloudnative-pg/values.schema.json index 63fba0454..784463cf1 100644 --- a/charts/cloudnative-pg/values.schema.json +++ b/charts/cloudnative-pg/values.schema.json @@ -11,6 +11,9 @@ "affinity": { "type": "object" }, + "topologySpreadConstraints": { + "type": "array" + }, "commonAnnotations": { "type": "object" }, diff --git a/charts/cloudnative-pg/values.yaml b/charts/cloudnative-pg/values.yaml index a95165ffd..39c1fd764 100644 --- a/charts/cloudnative-pg/values.yaml +++ b/charts/cloudnative-pg/values.yaml @@ -141,6 +141,9 @@ resources: {} # -- Nodeselector for the operator to be installed. nodeSelector: {} +# -- Topology Spread Constraints for the operator to be installed. +topologySpreadConstraints: [] + # -- Tolerations for the operator to be installed. tolerations: []