Merge pull request #3393 from strowk/extra-init-containers

Introduce extraInitContainers to helm chart
This commit is contained in:
Joe Previte 2021-05-20 12:16:08 -07:00 committed by GitHub
commit ac965176ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 2 deletions

View File

@ -3,12 +3,14 @@
# Changelog
- [Changelog](#changelog)
- [Next Version](#next-version)
- [New Features](#new-features)
- [3.10.1](#3101)
- [Bug Fixes](#bug-fixes)
- [Documentation](#documentation)
- [Development](#development)
- [3.10.0](#3100)
- [New Features](#new-features)
- [New Features](#new-features-1)
- [Bug Fixes](#bug-fixes-1)
- [Documentation](#documentation-1)
- [Development](#development-1)
@ -51,6 +53,15 @@ VS Code v0.00.0
-->
## Next Version
VS Code v1.56.1
### New Features
- feat: support `extraInitContainers` in helm chart values
- feat: change `extraContainers` to support templating in helm chart
## 3.10.1
VS Code v1.56.1

View File

@ -65,6 +65,7 @@ and their default values.
| extraArgs | list | `[]` | |
| extraConfigmapMounts | list | `[]` | |
| extraContainers | string | `""` | |
| extraInitContainers | string | `""` | |
| extraSecretMounts | list | `[]` | |
| extraVars | list | `[]` | |
| extraVolumeMounts | list | `[]` | |
@ -115,3 +116,47 @@ $ helm upgrade --install code-server ci/helm-chart -f values.yaml
```
> **Tip**: You can use the default [values.yaml](values.yaml)
# Extra Containers
There are two parameters which allow to add more containers to pod.
Use `extraContainers` to add regular containers
and `extraInitContainers` to add init containers. You can read more
about init containers in [k8s documentation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/).
Both parameters accept strings and use them as a templates
Example of using `extraInitContainers`:
``` yaml
extraInitContainers: |
- name: customization
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
env:
- name: SERVICE_URL
value: https://open-vsx.org/vscode/gallery
- name: ITEM_URL
value: https://open-vsx.org/vscode/item
command:
- sh
- -c
- |
code-server --install-extension ms-python.python
code-server --install-extension golang.Go
volumeMounts:
- name: data
mountPath: /home/coder
```
With this yaml in file `init.yaml`, you can execute
```console
$ helm upgrade --install code-server \
ci/helm-chart \
--values init.yaml
```
to deploy code-server with python and golang extensions preinstalled
before main container have started.

View File

@ -43,10 +43,13 @@ spec:
volumeMounts:
- name: data
mountPath: /home/coder
{{- if .Values.extraInitContainers }}
{{ tpl .Values.extraInitContainers . | indent 6}}
{{- end }}
{{- end }}
containers:
{{- if .Values.extraContainers }}
{{ toYaml .Values.extraContainers | indent 8}}
{{ tpl .Values.extraContainers . | indent 8}}
{{- end }}
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"