From a9915dfb045c4c93a5256d0f5f415bd3101ae034 Mon Sep 17 00:00:00 2001 From: yandongxiao Date: Mon, 15 Jan 2024 15:29:07 +0800 Subject: [PATCH] [Enhancement] support use map to define feEnvVars/beEnvVars to do merge on multiple values files Signed-off-by: yandongxiao --- .../starrocks/templates/starrockscluster.yaml | 42 ++++++++++++++++++- .../charts/starrocks/values.yaml | 31 ++++++++------ helm-charts/charts/kube-starrocks/values.yaml | 31 ++++++++------ 3 files changed, 76 insertions(+), 28 deletions(-) diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml index a5f9e4ed..0fb649b3 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml @@ -94,9 +94,21 @@ spec: key: password {{- end }} {{- if .Values.starrocksFESpec.feEnvVars }} + {{- /* if it is a map, we use range to iterate to merge environment variables */}} + {{- if eq (kindOf .Values.starrocksFESpec.feEnvVars) "map" }} + {{- range $key, $value := .Values.starrocksFESpec.feEnvVars }} + - name: {{ $key }} + {{- if eq (kindOf $value) "string" }} + value: {{ $value | quote }} + {{- else }} + {{- toYaml $value | nindent 8 }} + {{- end }} + {{- end }} + {{- else }} + {{- /* the default kind is slice, we keep backward compatibility */}} {{- toYaml .Values.starrocksFESpec.feEnvVars | nindent 6 }} {{- end }} - + {{- end }} {{- if .Values.starrocksFESpec.affinity }} affinity: {{ toYaml .Values.starrocksFESpec.affinity | indent 6 }} @@ -239,9 +251,21 @@ spec: key: password {{- end }} {{- if .Values.starrocksBeSpec.beEnvVars }} + {{- /* if it is a map, we use range to iterate to merge environment variables */}} + {{- if eq (kindOf .Values.starrocksBeSpec.beEnvVars) "map" }} + {{- range $key, $value := .Values.starrocksBeSpec.beEnvVars }} + - name: {{ $key }} + {{- if eq (kindOf $value) "string" }} + value: {{ $value | quote }} + {{- else }} + {{- toYaml $value | nindent 8 }} + {{- end }} + {{- end }} + {{- else }} + {{- /* the default kind is slice, we keep backward compatibility */}} {{- toYaml .Values.starrocksBeSpec.beEnvVars | nindent 6 }} {{- end }} - + {{- end }} {{- if .Values.starrocksBeSpec.affinity }} affinity: {{ toYaml .Values.starrocksBeSpec.affinity | indent 6 }} @@ -340,8 +364,22 @@ spec: key: password {{- end }} {{- if .Values.starrocksCnSpec.cnEnvVars }} + {{- /* if it is a map, we use range to iterate to merge environment variables */}} + {{- if eq (kindOf .Values.starrocksCnSpec.cnEnvVars) "map" }} + {{- range $key, $value := .Values.starrocksCnSpec.cnEnvVars }} + - name: {{ $key }} + {{- if eq (kindOf $value) "string" }} + value: {{ $value | quote }} + {{- else }} + {{- toYaml $value | nindent 8 }} + {{- end }} + {{- end }} + {{- else }} + {{- /* the default kind is slice, we keep backward compatibility */}} {{- toYaml .Values.starrocksCnSpec.cnEnvVars | nindent 6 }} {{- end }} + {{- end }} + {{- if .Values.starrocksCnSpec.affinity }} affinity: {{ toYaml .Values.starrocksCnSpec.affinity | indent 6 }} diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml index d12576ae..e753f0cd 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml @@ -104,11 +104,13 @@ starrocksFESpec: # - "example.com" # schedulerName allows you to specify which scheduler will be used for your pods. schedulerName: "" - # Additional fe container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional fe container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. feEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment" @@ -262,11 +264,13 @@ starrocksCnSpec: # - "example.com" # schedulerName allows you to specify which scheduler will be used for the pod schedulerName: "" - # Additional cn container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional cn container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. cnEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment" @@ -435,12 +439,13 @@ starrocksBeSpec: # - "example.com" # schedulerName allows you to specify which scheduler will be used for the pod schedulerName: "" - - # Additional be container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional be container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. beEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment" diff --git a/helm-charts/charts/kube-starrocks/values.yaml b/helm-charts/charts/kube-starrocks/values.yaml index 0bc7f75a..b8b0c5b3 100644 --- a/helm-charts/charts/kube-starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/values.yaml @@ -184,11 +184,13 @@ starrocks: # - "example.com" # schedulerName allows you to specify which scheduler will be used for your pods. schedulerName: "" - # Additional fe container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional fe container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. feEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment" @@ -342,11 +344,13 @@ starrocks: # - "example.com" # schedulerName allows you to specify which scheduler will be used for the pod schedulerName: "" - # Additional cn container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional cn container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. cnEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment" @@ -515,12 +519,13 @@ starrocks: # - "example.com" # schedulerName allows you to specify which scheduler will be used for the pod schedulerName: "" - - # Additional be container environment variables - # You specify this manually like you would a raw deployment manifest. - # This means you can bind in environment variables from secrets. - # Ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ + # Additional be container environment variables. + # See https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ for how to define environment variables. + # Note: If you use slice to define environment variables, and if there are multiple values files, the values in the last values file will take effect. + # If you use map to define environment variables, and if there are multiple values files, the values in the last values file will be merged. + # You can only use one of slice and map to define environment variables. beEnvVars: [] + # define environment variables by slice. # e.g. static environment variable: # - name: DEMO_GREETING # value: "Hello from the environment"