Skip to content

Commit 4e7a63c

Browse files
authored
Helm: support adding backend environment variables from supercharts (#9214)
I have a need to add an environment variable for backend containers in the Enterprise version. `additionalEnv` doesn't work very well for this, because: * It is an array, so if a user specifies a different value for it with `--set`, any defaults set by the superchart will disappear. * It is inserted into the resource definition verbatim, so you can't refer to things like the release name. This patch introduces a separate setting for this purpose. It takes a map, and runs the variable values through `tpl` to support interpolation.
1 parent 94a52a6 commit 4e7a63c

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Added
2+
3+
- \[Helm\] Added a new value, `cvat.backend.extensionEnv`, to support
4+
supercharts adding environment variables to backend containers
5+
(<https://github.com/cvat-ai/cvat/pull/9214>)

helm-chart/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ The name of the service account to use for backend pods
138138
- name: CVAT_NUCLIO_FUNCTION_NAMESPACE
139139
value: "{{ .Release.Namespace }}"
140140
{{- end }}
141+
142+
{{- range $envName, $envValueTemplate := .Values.cvat.backend.extensionEnv }}
143+
- name: {{ $envName | toYaml }}
144+
value: {{ tpl $envValueTemplate $ | toYaml }}
145+
{{- end }}
141146
{{- end }}
142147

143148
{{- define "cvat.sharedClickhouseEnv" }}

helm-chart/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ cvat:
1515
affinity: {}
1616
tolerations: []
1717
additionalEnv: []
18+
19+
# This should only be used by supercharts;
20+
# to set custom environment for a Helm release, use additionalEnv.
21+
extensionEnv: {}
22+
1823
additionalVolumes: []
1924
additionalVolumeMounts: []
2025
# -- The service account the backend pods will use to interact with the Kubernetes API

0 commit comments

Comments
 (0)