From 9ec31b021ac99efaa7d028ad3cbe0dabb7209742 Mon Sep 17 00:00:00 2001 From: Gallardot Date: Wed, 17 Jul 2024 17:12:09 +0800 Subject: [PATCH] [Improvement][Helm] Support for updateStrategy (#16334) --- deploy/kubernetes/dolphinscheduler/README.md | 2 ++ .../dolphinscheduler/templates/_helpers.tpl | 13 +++++++++++++ .../statefulset-dolphinscheduler-master.yaml | 1 + .../statefulset-dolphinscheduler-worker.yaml | 1 + deploy/kubernetes/dolphinscheduler/values.yaml | 14 ++++++++++++++ 5 files changed, 31 insertions(+) diff --git a/deploy/kubernetes/dolphinscheduler/README.md b/deploy/kubernetes/dolphinscheduler/README.md index 4a6b880293..af5ec4680f 100644 --- a/deploy/kubernetes/dolphinscheduler/README.md +++ b/deploy/kubernetes/dolphinscheduler/README.md @@ -246,6 +246,7 @@ Please refer to the [Quick Start in Kubernetes](../../../docs/docs/en/guide/inst | master.service.serviceMonitor.labels | object | `{}` | serviceMonitor.labels ServiceMonitor extra labels | | master.service.serviceMonitor.path | string | `"/actuator/prometheus"` | serviceMonitor.path path of the metrics endpoint | | master.tolerations | list | `[]` | Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. | +| master.updateStrategy | object | `{"rollingUpdate":{"partition":0},"type":"RollingUpdate"}` | Update strategy ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies | | minio.auth.rootPassword | string | `"minioadmin"` | minio password | | minio.auth.rootUser | string | `"minioadmin"` | minio username | | minio.defaultBuckets | string | `"dolphinscheduler"` | minio default buckets | @@ -358,6 +359,7 @@ Please refer to the [Quick Start in Kubernetes](../../../docs/docs/en/guide/inst | worker.service.serviceMonitor.labels | object | `{}` | serviceMonitor.labels ServiceMonitor extra labels | | worker.service.serviceMonitor.path | string | `"/actuator/prometheus"` | serviceMonitor.path path of the metrics endpoint | | worker.tolerations | list | `[]` | Tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. | +| worker.updateStrategy | object | `{"rollingUpdate":{"partition":0},"type":"RollingUpdate"}` | Update strategy ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies | | zookeeper.enabled | bool | `true` | If not exists external registry, the zookeeper registry will be used by default. | | zookeeper.fourlwCommandsWhitelist | string | `"srvr,ruok,wchs,cons"` | A list of comma separated Four Letter Words commands to use | | zookeeper.persistence.enabled | bool | `false` | Set `zookeeper.persistence.enabled` to true to mount a new volume for internal ZooKeeper | diff --git a/deploy/kubernetes/dolphinscheduler/templates/_helpers.tpl b/deploy/kubernetes/dolphinscheduler/templates/_helpers.tpl index 368e0b290f..ba3c8e367e 100644 --- a/deploy/kubernetes/dolphinscheduler/templates/_helpers.tpl +++ b/deploy/kubernetes/dolphinscheduler/templates/_helpers.tpl @@ -398,3 +398,16 @@ Create a ldap ssl volumeMount. subPath: jks-file {{- end -}} {{- end -}} + +{{/* +Renders a value that contains template. +Usage: +{{ include "dolphinscheduler.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "dolphinscheduler.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml b/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml index c4174b9ca0..43d61ea764 100644 --- a/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml +++ b/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml @@ -23,6 +23,7 @@ metadata: {{- include "dolphinscheduler.master.labels" . | nindent 4 }} spec: podManagementPolicy: {{ .Values.master.podManagementPolicy }} + updateStrategy: {{- include "dolphinscheduler.tplvalues.render" (dict "value" .Values.master.updateStrategy "context" $ ) | nindent 4 }} replicas: {{ .Values.master.replicas }} selector: matchLabels: diff --git a/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml b/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml index 4c66ca5ffe..9349461608 100644 --- a/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml +++ b/deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml @@ -23,6 +23,7 @@ metadata: {{- include "dolphinscheduler.worker.labels" . | nindent 4 }} spec: podManagementPolicy: {{ .Values.worker.podManagementPolicy }} + updateStrategy: {{- include "dolphinscheduler.tplvalues.render" (dict "value" .Values.worker.updateStrategy "context" $ ) | nindent 4 }} replicas: {{ .Values.worker.replicas }} selector: matchLabels: diff --git a/deploy/kubernetes/dolphinscheduler/values.yaml b/deploy/kubernetes/dolphinscheduler/values.yaml index 5d924d6bba..0df7f7455b 100644 --- a/deploy/kubernetes/dolphinscheduler/values.yaml +++ b/deploy/kubernetes/dolphinscheduler/values.yaml @@ -424,6 +424,13 @@ master: enabled: true # -- PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" + # -- Update strategy + # ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + # + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 0 # -- Replicas is the desired number of replicas of the given Template. replicas: "3" # -- You can use annotations to attach arbitrary non-identifying metadata to objects. @@ -562,6 +569,13 @@ worker: enabled: true # -- PodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. podManagementPolicy: "Parallel" + # -- Update strategy + # ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + # + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 0 # -- Replicas is the desired number of replicas of the given Template. replicas: "3" # -- You can use annotations to attach arbitrary non-identifying metadata to objects.