Skip to content

Commit

Permalink
[Enhancement] support use map to define feEnvVars/beEnvVars to do mer…
Browse files Browse the repository at this point in the history
…ge on multiple values files (#396)

Signed-off-by: yandongxiao <yandongxiao@starrocks.com>
  • Loading branch information
yandongxiao authored Jan 16, 2024
1 parent 8ea054c commit 0695544
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
31 changes: 18 additions & 13 deletions helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
31 changes: 18 additions & 13 deletions helm-charts/charts/kube-starrocks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 0695544

Please sign in to comment.