From abf1dd13d2d08e93004e78aa21977ff7d804eb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien?= Date: Thu, 22 Feb 2024 10:57:00 +0100 Subject: [PATCH] k8s-chart-helm: unify extraEnvironmentVars (#5327) --- .../seaweedfs/templates/filer-statefulset.yaml | 5 +++++ .../seaweedfs/templates/master-statefulset.yaml | 10 ++++++++++ .../seaweedfs/templates/s3-deployment.yaml | 16 ++++++++++++++++ .../seaweedfs/templates/volume-statefulset.yaml | 16 ++++++++++++++++ k8s/charts/seaweedfs/values.yaml | 16 ++++++++++++---- 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml index c62ec45dc..6da7ecbe0 100644 --- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml @@ -105,7 +105,12 @@ spec: {{- if .Values.global.extraEnvironmentVars }} {{- range $key, $value := .Values.global.extraEnvironmentVars }} - name: {{ $key }} + {{- if kindIs "string" $value }} value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} {{- end }} {{- end }} {{- if .Values.filer.secretExtraEnvironmentVars }} diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml index 0a7e6198a..61252c5a3 100644 --- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml @@ -83,13 +83,23 @@ spec: {{- if .Values.master.extraEnvironmentVars }} {{- range $key, $value := .Values.master.extraEnvironmentVars }} - name: {{ $key }} + {{- if kindIs "string" $value }} value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} {{- end }} {{- end }} {{- if .Values.global.extraEnvironmentVars }} {{- range $key, $value := .Values.global.extraEnvironmentVars }} - name: {{ $key }} + {{- if kindIs "string" $value }} value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} {{- end }} {{- end }} command: diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml index 0b04f6381..2882e863e 100644 --- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml @@ -69,10 +69,26 @@ spec: fieldPath: metadata.namespace - name: SEAWEEDFS_FULLNAME value: "{{ template "seaweedfs.name" . }}" + {{- if .Values.s3.extraEnvironmentVars }} + {{- range $key, $value := .Values.s3.extraEnvironmentVars }} + - name: {{ $key }} + {{- if kindIs "string" $value }} + value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} + {{- end }} + {{- end }} {{- if .Values.global.extraEnvironmentVars }} {{- range $key, $value := .Values.global.extraEnvironmentVars }} - name: {{ $key }} + {{- if kindIs "string" $value }} value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} {{- end }} {{- end }} command: diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml index 2bd058cff..688b4cb16 100644 --- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml @@ -91,10 +91,26 @@ spec: fieldPath: status.hostIP - name: SEAWEEDFS_FULLNAME value: "{{ template "seaweedfs.name" . }}" + {{- if .Values.volume.extraEnvironmentVars }} + {{- range $key, $value := .Values.volume.extraEnvironmentVars }} + - name: {{ $key }} + {{- if kindIs "string" $value }} + value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} + {{- end }} + {{- end }} {{- if .Values.global.extraEnvironmentVars }} {{- range $key, $value := .Values.global.extraEnvironmentVars }} - name: {{ $key }} + {{- if kindIs "string" $value }} value: {{ $value | quote }} + {{- else }} + valueFrom: + {{ toYaml $value | nindent 16 | trim }} + {{- end -}} {{- end }} {{- end }} command: diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 527db2315..9381f9046 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -36,6 +36,10 @@ global: WEED_CLUSTER_DEFAULT: "sw" WEED_CLUSTER_SW_MASTER: "seaweedfs-master.seaweedfs:9333" WEED_CLUSTER_SW_FILER: "seaweedfs-filer-client.seaweedfs:8888" + # WEED_JWT_SIGNING_KEY: + # secretKeyRef: + # name: seaweedfs-signing-key + # key: signingKey image: registry: "" @@ -186,10 +190,10 @@ master: tls: [] extraEnvironmentVars: - WEED_MASTER_VOLUME_GROWTH_COPY_1: 7 - WEED_MASTER_VOLUME_GROWTH_COPY_2: 6 - WEED_MASTER_VOLUME_GROWTH_COPY_3: 3 - WEED_MASTER_VOLUME_GROWTH_COPY_OTHER: 1 + WEED_MASTER_VOLUME_GROWTH_COPY_1: '7' + WEED_MASTER_VOLUME_GROWTH_COPY_2: '6' + WEED_MASTER_VOLUME_GROWTH_COPY_3: '3' + WEED_MASTER_VOLUME_GROWTH_COPY_OTHER: '1' # used to configure livenessProbe on master-server containers # @@ -371,6 +375,8 @@ volume: # ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ serviceAccountName: "" + extraEnvironmentVars: + # used to configure livenessProbe on volume-server containers # livenessProbe: @@ -706,6 +712,8 @@ s3: storageClass: "" hostPathPrefix: /storage + extraEnvironmentVars: + # used to configure livenessProbe on s3 containers # livenessProbe: