From 1ffca5751c36235af686d13c788c8ace5bb0a117 Mon Sep 17 00:00:00 2001 From: Timur Sultanaev Date: Fri, 14 May 2021 22:59:01 +0200 Subject: [PATCH 1/3] introduce extraInitContainers to helm chart New extraInitContainers configuration added. It allows to pass template with a list of containers to execute before main code-server container started. Main container will only start when all init containers are completed (exited with 0 code). Additionally changes the way extraContainers is used - instead of toYaml use tpl, because this allows to reference any values from extraContainers string. --- CHANGELOG.md | 10 ++++++ ci/helm-chart/README.md | 45 +++++++++++++++++++++++++ ci/helm-chart/templates/deployment.yaml | 5 ++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d1b306..994125b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ # Changelog - [Changelog](#changelog) + - [Next Version](#next-version) - [3.10.1](#3101) - [Bug Fixes](#bug-fixes) - [Documentation](#documentation) @@ -51,6 +52,15 @@ VS Code v0.00.0 --> +## Next Version + +VS Code v1.56.1 + +### New Features + +- feat: supported `extraInitContainers` in helm chart values +- feat: changed `extraContainers` to support templating in helm chart + ## 3.10.1 VS Code v1.56.1 diff --git a/ci/helm-chart/README.md b/ci/helm-chart/README.md index 30a9e9e4..65cb204e 100644 --- a/ci/helm-chart/README.md +++ b/ci/helm-chart/README.md @@ -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. \ No newline at end of file diff --git a/ci/helm-chart/templates/deployment.yaml b/ci/helm-chart/templates/deployment.yaml index 9364a470..201e3e6c 100644 --- a/ci/helm-chart/templates/deployment.yaml +++ b/ci/helm-chart/templates/deployment.yaml @@ -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 }}" From 75e6ab11978030fcc8f5d469e2e124fff02fbe10 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 20 May 2021 11:57:53 -0700 Subject: [PATCH 2/3] fix(dependabot): limit limiter updates --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d4d0c12f..816f8afe 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -26,3 +26,7 @@ updates: # We can't use it until we switch to ESM across the project # See release notes: https://github.com/sindresorhus/xdg-basedir/releases/tag/v5.0.0 versions: ["5.x"] + - dependency-name: "limiter" + # 2.0.0 has breaking changes + # so we can't update yet. + versions: ["2.x"] From 43d72c59bc5f7b175ec9c68d2f6d5aa7aab4214b Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 20 May 2021 12:11:31 -0700 Subject: [PATCH 3/3] chore: update CHANGELOG --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 994125b7..353119cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@ - [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) @@ -58,8 +59,8 @@ VS Code v1.56.1 ### New Features -- feat: supported `extraInitContainers` in helm chart values -- feat: changed `extraContainers` to support templating in helm chart +- feat: support `extraInitContainers` in helm chart values +- feat: change `extraContainers` to support templating in helm chart ## 3.10.1