Skip to content

Commit ac96517

Browse files
authored
Merge pull request #3393 from strowk/extra-init-containers
Introduce extraInitContainers to helm chart
2 parents 8f3de91 + 43d72c5 commit ac96517

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
# Changelog
44

55
- [Changelog](#changelog)
6+
- [Next Version](#next-version)
7+
- [New Features](#new-features)
68
- [3.10.1](#3101)
79
- [Bug Fixes](#bug-fixes)
810
- [Documentation](#documentation)
911
- [Development](#development)
1012
- [3.10.0](#3100)
11-
- [New Features](#new-features)
13+
- [New Features](#new-features-1)
1214
- [Bug Fixes](#bug-fixes-1)
1315
- [Documentation](#documentation-1)
1416
- [Development](#development-1)
@@ -51,6 +53,15 @@ VS Code v0.00.0
5153
5254
-->
5355

56+
## Next Version
57+
58+
VS Code v1.56.1
59+
60+
### New Features
61+
62+
- feat: support `extraInitContainers` in helm chart values
63+
- feat: change `extraContainers` to support templating in helm chart
64+
5465
## 3.10.1
5566

5667
VS Code v1.56.1

ci/helm-chart/README.md

+45
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ and their default values.
6565
| extraArgs | list | `[]` | |
6666
| extraConfigmapMounts | list | `[]` | |
6767
| extraContainers | string | `""` | |
68+
| extraInitContainers | string | `""` | |
6869
| extraSecretMounts | list | `[]` | |
6970
| extraVars | list | `[]` | |
7071
| extraVolumeMounts | list | `[]` | |
@@ -115,3 +116,47 @@ $ helm upgrade --install code-server ci/helm-chart -f values.yaml
115116
```
116117

117118
> **Tip**: You can use the default [values.yaml](values.yaml)
119+
120+
# Extra Containers
121+
122+
There are two parameters which allow to add more containers to pod.
123+
Use `extraContainers` to add regular containers
124+
and `extraInitContainers` to add init containers. You can read more
125+
about init containers in [k8s documentation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/).
126+
127+
Both parameters accept strings and use them as a templates
128+
129+
Example of using `extraInitContainers`:
130+
131+
``` yaml
132+
extraInitContainers: |
133+
- name: customization
134+
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
135+
imagePullPolicy: IfNotPresent
136+
env:
137+
- name: SERVICE_URL
138+
value: https://open-vsx.org/vscode/gallery
139+
- name: ITEM_URL
140+
value: https://open-vsx.org/vscode/item
141+
command:
142+
- sh
143+
- -c
144+
- |
145+
code-server --install-extension ms-python.python
146+
code-server --install-extension golang.Go
147+
volumeMounts:
148+
- name: data
149+
mountPath: /home/coder
150+
151+
```
152+
153+
With this yaml in file `init.yaml`, you can execute
154+
155+
```console
156+
$ helm upgrade --install code-server \
157+
ci/helm-chart \
158+
--values init.yaml
159+
```
160+
161+
to deploy code-server with python and golang extensions preinstalled
162+
before main container have started.

ci/helm-chart/templates/deployment.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ spec:
4343
volumeMounts:
4444
- name: data
4545
mountPath: /home/coder
46+
{{- if .Values.extraInitContainers }}
47+
{{ tpl .Values.extraInitContainers . | indent 6}}
48+
{{- end }}
4649
{{- end }}
4750
containers:
4851
{{- if .Values.extraContainers }}
49-
{{ toYaml .Values.extraContainers | indent 8}}
52+
{{ tpl .Values.extraContainers . | indent 8}}
5053
{{- end }}
5154
- name: {{ .Chart.Name }}
5255
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

0 commit comments

Comments
 (0)