From b132451581e456d202881991f675cb7665af0eb1 Mon Sep 17 00:00:00 2001 From: Sergey Shevchenko Date: Tue, 24 Jan 2023 01:41:28 +0200 Subject: [PATCH] feat(helm): Add ability to customize affinity per deployment (#22827) --- helm/superset/Chart.yaml | 2 +- helm/superset/README.md | 17 ++++++++++--- helm/superset/templates/deployment-beat.yaml | 18 +++++++++++-- .../superset/templates/deployment-flower.yaml | 18 +++++++++++-- .../superset/templates/deployment-worker.yaml | 16 +++++++++++- helm/superset/templates/deployment-ws.yaml | 16 +++++++++++- helm/superset/templates/deployment.yaml | 16 +++++++++++- helm/superset/values.yaml | 25 ++++++++++++++++--- 8 files changed, 113 insertions(+), 15 deletions(-) diff --git a/helm/superset/Chart.yaml b/helm/superset/Chart.yaml index 63816fbc7a..2de0f2636b 100644 --- a/helm/superset/Chart.yaml +++ b/helm/superset/Chart.yaml @@ -29,7 +29,7 @@ maintainers: - name: craig-rueda email: craig@craigrueda.com url: https://github.com/craig-rueda -version: 0.8.3 +version: 0.8.4 dependencies: - name: postgresql version: 12.1.6 diff --git a/helm/superset/README.md b/helm/superset/README.md index 52a55b472c..d777b8ba45 100644 --- a/helm/superset/README.md +++ b/helm/superset/README.md @@ -23,7 +23,7 @@ NOTE: This file is generated by helm-docs: https://github.com/norwoodj/helm-docs # superset -![Version: 0.8.3](https://img.shields.io/badge/Version-0.8.3-informational?style=flat-square) +![Version: 0.8.4](https://img.shields.io/badge/Version-0.8.4-informational?style=flat-square) Apache Superset is a modern, enterprise-ready business intelligence web application @@ -107,6 +107,7 @@ helm install my-superset superset/superset | service.type | string | `"ClusterIP"` | | | serviceAccount.annotations | object | `{}` | | | serviceAccount.create | bool | `false` | Create custom service account for Superset. If create: true and name is not provided, `superset.fullname` will be used. | +| supersetCeleryBeat.affinity | object | `{}` | Affinity to be added to supersetCeleryBeat deployment | | supersetCeleryBeat.command | list | a `celery beat` command | Command | | supersetCeleryBeat.containerSecurityContext | object | `{}` | | | supersetCeleryBeat.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryBeat deployment | @@ -117,9 +118,11 @@ helm install my-superset superset/superset | supersetCeleryBeat.podLabels | object | `{}` | Labels to be added to supersetCeleryBeat pods | | supersetCeleryBeat.podSecurityContext | object | `{}` | | | supersetCeleryBeat.resources | object | `{}` | Resource settings for the CeleryBeat pods - these settings overwrite might existing values from the global resources object defined above. | +| supersetCeleryBeat.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetCeleryBeat deployments | +| supersetCeleryFlower.affinity | object | `{}` | Affinity to be added to supersetCeleryFlower deployment | | supersetCeleryFlower.command | list | a `celery flower` command | Command | | supersetCeleryFlower.containerSecurityContext | object | `{}` | | -| supersetCeleryFlower.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryBeat deployment | +| supersetCeleryFlower.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryFlower deployment | | supersetCeleryFlower.enabled | bool | `false` | Enables a Celery flower deployment (management UI to monitor celery jobs) WARNING: on superset 1.x, this requires a Superset image that has `flower<1.0.0` installed (which is NOT the case of the default images) flower>=1.0.0 requires Celery 5+ which Superset 1.5 does not support | | supersetCeleryFlower.initContainers | list | a container waiting for postgres and redis | List of init containers | | supersetCeleryFlower.livenessProbe.failureThreshold | int | `3` | | @@ -129,8 +132,8 @@ helm install my-superset superset/superset | supersetCeleryFlower.livenessProbe.periodSeconds | int | `5` | | | supersetCeleryFlower.livenessProbe.successThreshold | int | `1` | | | supersetCeleryFlower.livenessProbe.timeoutSeconds | int | `1` | | -| supersetCeleryFlower.podAnnotations | object | `{}` | Annotations to be added to supersetCeleryBeat pods | -| supersetCeleryFlower.podLabels | object | `{}` | Labels to be added to supersetCeleryBeat pods | +| supersetCeleryFlower.podAnnotations | object | `{}` | Annotations to be added to supersetCeleryFlower pods | +| supersetCeleryFlower.podLabels | object | `{}` | Labels to be added to supersetCeleryFlower pods | | supersetCeleryFlower.podSecurityContext | object | `{}` | | | supersetCeleryFlower.readinessProbe.failureThreshold | int | `3` | | | supersetCeleryFlower.readinessProbe.httpGet.path | string | `"/api/workers"` | | @@ -151,6 +154,8 @@ helm install my-superset superset/superset | supersetCeleryFlower.startupProbe.periodSeconds | int | `5` | | | supersetCeleryFlower.startupProbe.successThreshold | int | `1` | | | supersetCeleryFlower.startupProbe.timeoutSeconds | int | `1` | | +| supersetCeleryFlower.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetCeleryFlower deployments | +| supersetNode.affinity | object | `{}` | Affinity to be added to supersetNode deployment | | supersetNode.command | list | See `values.yaml` | Startup command | | supersetNode.connections.db_host | string | `"{{ template \"superset.fullname\" . }}-postgresql"` | | | supersetNode.connections.db_name | string | `"superset"` | | @@ -192,6 +197,8 @@ helm install my-superset superset/superset | supersetNode.startupProbe.successThreshold | int | `1` | | | supersetNode.startupProbe.timeoutSeconds | int | `1` | | | supersetNode.strategy | object | `{}` | | +| supersetNode.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetNode deployments | +| supersetWebsockets.affinity | object | `{}` | Affinity to be added to supersetWebsockets deployment | | supersetWebsockets.command | list | `[]` | | | supersetWebsockets.config | object | see `values.yaml` | The config.json to pass to the server, see https://github.com/apache/superset/tree/master/superset-websocket Note that the configuration can also read from environment variables (which will have priority), see https://github.com/apache/superset/blob/master/superset-websocket/src/config.ts for a list of supported variables | | supersetWebsockets.containerSecurityContext | object | `{}` | | @@ -232,6 +239,7 @@ helm install my-superset superset/superset | supersetWebsockets.startupProbe.successThreshold | int | `1` | | | supersetWebsockets.startupProbe.timeoutSeconds | int | `1` | | | supersetWebsockets.strategy | object | `{}` | | +| supersetWebsockets.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetWebsockets deployments | | supersetWorker.command | list | a `celery worker` command | Worker startup command | | supersetWorker.containerSecurityContext | object | `{}` | | | supersetWorker.deploymentAnnotations | object | `{}` | Annotations to be added to supersetWorker deployment | @@ -253,3 +261,4 @@ helm install my-superset superset/superset | supersetWorker.startupProbe | object | `{}` | No startup/readiness probes by default since we don't really care about its startup time (it doesn't serve traffic) | | supersetWorker.strategy | object | `{}` | | | tolerations | list | `[]` | | +| topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to all deployments | diff --git a/helm/superset/templates/deployment-beat.yaml b/helm/superset/templates/deployment-beat.yaml index d4242425fe..a69b2b5b4a 100644 --- a/helm/superset/templates/deployment-beat.yaml +++ b/helm/superset/templates/deployment-beat.yaml @@ -122,9 +122,23 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- if or .Values.affinity .Values.supersetCeleryBeat.affinity }} affinity: - {{- toYaml . | nindent 8 }} + {{- with .Values.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetCeleryBeat.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if or .Values.topologySpreadConstraints .Values.supersetCeleryBeat.topologySpreadConstraints }} + topologySpreadConstraints: + {{- with .Values.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetCeleryBeat.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: diff --git a/helm/superset/templates/deployment-flower.yaml b/helm/superset/templates/deployment-flower.yaml index 197aa5822f..1961ee12b2 100644 --- a/helm/superset/templates/deployment-flower.yaml +++ b/helm/superset/templates/deployment-flower.yaml @@ -121,9 +121,23 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- if or .Values.affinity .Values.supersetCeleryFlower.affinity }} affinity: - {{- toYaml . | nindent 8 }} + {{- with .Values.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetCeleryFlower.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if or .Values.topologySpreadConstraints .Values.supersetCeleryFlower.topologySpreadConstraints }} + topologySpreadConstraints: + {{- with .Values.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetCeleryFlower.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: diff --git a/helm/superset/templates/deployment-worker.yaml b/helm/superset/templates/deployment-worker.yaml index 178b5ac26f..33023c93ff 100644 --- a/helm/superset/templates/deployment-worker.yaml +++ b/helm/superset/templates/deployment-worker.yaml @@ -139,9 +139,23 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- if or .Values.affinity .Values.supersetWorker.affinity }} affinity: + {{- with .Values.affinity }} {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetWorker.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if or .Values.topologySpreadConstraints .Values.supersetWorker.topologySpreadConstraints }} + topologySpreadConstraints: + {{- with .Values.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetWorker.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: diff --git a/helm/superset/templates/deployment-ws.yaml b/helm/superset/templates/deployment-ws.yaml index 1713ee74c5..0bbc822ef9 100644 --- a/helm/superset/templates/deployment-ws.yaml +++ b/helm/superset/templates/deployment-ws.yaml @@ -120,9 +120,23 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- if or .Values.affinity .Values.supersetWebsockets.affinity }} affinity: + {{- with .Values.affinity }} {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetWebsockets.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if or .Values.topologySpreadConstraints .Values.supersetWebsockets.topologySpreadConstraints }} + topologySpreadConstraints: + {{- with .Values.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetWebsockets.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: diff --git a/helm/superset/templates/deployment.yaml b/helm/superset/templates/deployment.yaml index 8869280f67..278326e624 100644 --- a/helm/superset/templates/deployment.yaml +++ b/helm/superset/templates/deployment.yaml @@ -150,9 +150,23 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- if or .Values.affinity .Values.supersetNode.affinity }} affinity: + {{- with .Values.affinity }} {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetNode.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if or .Values.topologySpreadConstraints .Values.supersetNode.topologySpreadConstraints }} + topologySpreadConstraints: + {{- with .Values.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.supersetNode.topologySpreadConstraints }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index 143d6c13f1..ff5dd0ed0a 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -283,6 +283,10 @@ supersetNode: deploymentAnnotations: {} # -- Labels to be added to supersetNode deployment deploymentLabels: {} + # -- Affinity to be added to supersetNode deployment + affinity: {} + # -- TopologySpreadConstrains to be added to supersetNode deployments + topologySpreadConstraints: [] # -- Annotations to be added to supersetNode pods podAnnotations: {} # -- Labels to be added to supersetNode pods @@ -426,6 +430,10 @@ supersetCeleryBeat: - dockerize -wait "tcp://$DB_HOST:$DB_PORT" -wait "tcp://$REDIS_HOST:$REDIS_PORT" -timeout 120s # -- Annotations to be added to supersetCeleryBeat deployment deploymentAnnotations: {} + # -- Affinity to be added to supersetCeleryBeat deployment + affinity: {} + # -- TopologySpreadConstrains to be added to supersetCeleryBeat deployments + topologySpreadConstraints: [] # -- Annotations to be added to supersetCeleryBeat pods podAnnotations: {} # -- Labels to be added to supersetCeleryBeat pods @@ -498,11 +506,15 @@ supersetCeleryFlower: - /bin/sh - -c - dockerize -wait "tcp://$DB_HOST:$DB_PORT" -wait "tcp://$REDIS_HOST:$REDIS_PORT" -timeout 120s - # -- Annotations to be added to supersetCeleryBeat deployment + # -- Annotations to be added to supersetCeleryFlower deployment deploymentAnnotations: {} - # -- Annotations to be added to supersetCeleryBeat pods + # -- Affinity to be added to supersetCeleryFlower deployment + affinity: {} + # -- TopologySpreadConstrains to be added to supersetCeleryFlower deployments + topologySpreadConstraints: [] + # -- Annotations to be added to supersetCeleryFlower pods podAnnotations: {} - # -- Labels to be added to supersetCeleryBeat pods + # -- Labels to be added to supersetCeleryFlower pods podLabels: {} # -- Resource settings for the CeleryBeat pods - these settings overwrite might existing values from the global resources object defined above. resources: @@ -558,6 +570,10 @@ supersetWebsockets: command: [] resources: {} deploymentAnnotations: {} + # -- Affinity to be added to supersetWebsockets deployment + affinity: {} + # -- TopologySpreadConstrains to be added to supersetWebsockets deployments + topologySpreadConstraints: [] podAnnotations: {} podLabels: {} strategy: {} @@ -765,3 +781,6 @@ nodeSelector: {} tolerations: [] affinity: {} + +# -- TopologySpreadConstrains to be added to all deployments +topologySpreadConstraints: []