Skip to content

Commit

Permalink
Add option to preload workspace image via DaemonSet
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningCash committed Nov 9, 2021
1 parent 3721bc2 commit 536eac7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/codefreak/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions charts/codefreak/templates/preload-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions charts/codefreak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 536eac7

Please sign in to comment.