From 536eac7149e02c5869788350e3652acb3f375c79 Mon Sep 17 00:00:00 2001 From: Henning Kasch Date: Tue, 9 Nov 2021 16:32:17 +0100 Subject: [PATCH] Add option to preload workspace image via DaemonSet --- charts/codefreak/Chart.yaml | 2 +- .../templates/preload-daemonset.yaml | 25 +++++++++++++++++++ charts/codefreak/values.yaml | 7 ++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 charts/codefreak/templates/preload-daemonset.yaml diff --git a/charts/codefreak/Chart.yaml b/charts/codefreak/Chart.yaml index 37aced5..e0a4495 100644 --- a/charts/codefreak/Chart.yaml +++ b/charts/codefreak/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.1 +version: 0.2.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/codefreak/templates/preload-daemonset.yaml b/charts/codefreak/templates/preload-daemonset.yaml new file mode 100644 index 0000000..a413e38 --- /dev/null +++ b/charts/codefreak/templates/preload-daemonset.yaml @@ -0,0 +1,25 @@ +{{- if .Values.workspaces.imagePreloading.enabled -}} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "codefreak.fullname" . }}-image-preload + labels: + {{- include "codefreak.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "codefreak.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "codefreak.selectorLabels" . | nindent 8 }} + spec: + initContainers: + - name: preload-container + image: {{ .Values.workspaces.companionImage }} + command: + - "/usr/bin/true" + containers: + - name: pause + image: {{ .Values.workspaces.imagePreloading.idleImage }} +{{- end }} diff --git a/charts/codefreak/values.yaml b/charts/codefreak/values.yaml index b2878c6..d36b5ec 100644 --- a/charts/codefreak/values.yaml +++ b/charts/codefreak/values.yaml @@ -103,6 +103,13 @@ database: passwordSecretKey: workspaces: + # Image preloading ensures all workspace nodes have the needed image available and do not have to pull them when + # a workspaces starts up + imagePreloading: + # Enable preloading of workspaces images to all nodes by creating a DaemonSet with the workspace image + enabled: true + # Image that will be used for idling + idleImage: gcr.io/google_containers/pause # Namespace where workspaces should be started in. If blank workspaces will be deployed in the same namespace as # the Code FREAK server (which is not recommended) namespace: