Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions helm-chart/binderhub/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ properties:

imageBuilderType:
type: string
enum: ["local", "dind", "pink"]
default: "local"
enum: ["host", "dind", "pink"]
default: "host"
description: |
Selected image builder type

Expand Down Expand Up @@ -470,12 +470,12 @@ properties:
host:
type: object
additionalProperties: false
required: [enabled, dockerSocket, dockerLibDir]
required: [dockerSocket, dockerLibDir]
properties:
enabled:
type: boolean
description: |
TODO
DEPRECATED: use imageCleaner.enabled if the cleaner shall not used.
dockerSocket:
type: string
description: |
Expand Down
9 changes: 9 additions & 0 deletions helm-chart/binderhub/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ config:
{{- $breaking = print $breaking "\n\nimageBuilderType: dind" }}
{{- end }}

{{- if hasKey .Values.imageCleaner.host "enabled" }}
{{- $breaking = print $breaking "\n\nCHANGED:" }}
{{- $breaking = print $breaking "\n\nimageCleaner:" }}
{{- $breaking = print $breaking "\n host:" }}
{{- $breaking = print $breaking "\n enabled: true" }}
{{- $breaking = print $breaking "\n\nas of version 0.3.0 is not used anymore." }}
{{- $breaking = print $breaking "\n\nThe image cleaner is either disabled or adapted to the value of imageBuilderType." }}
{{- end }}

{{- if $breaking }}
{{- fail (print $breaking_title $breaking) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- if ne .Values.imageBuilderType "local" -}}
{{- if ne .Values.imageBuilderType "host" -}}
{{- $builderName := .Values.imageBuilderType -}}
{{- $builder := index .Values $builderName -}}
{{- $daemonset := $builder.daemonset -}}

apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -46,9 +47,9 @@ spec:
{{- with $daemonset.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- with $daemonset.resources }}
{{- with $builder.resources }}
resources:
{{- $daemonset.resources | toYaml | nindent 12 }}
{{- $builder.resources | toYaml | nindent 12 }}
{{- end }}
{{- if eq $builderName "dind" }}
args:
Expand Down
34 changes: 14 additions & 20 deletions helm-chart/binderhub/templates/image-cleaner.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- if .Values.imageCleaner.enabled -}}
{{- $Values := .Values -}}
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -36,38 +35,34 @@ spec:
serviceAccountName: {{ .Release.Name }}-image-cleaner
{{- end }}
containers:
{{- range $i, $kind := tuple "host" "dind" "pink" }}
{{- if or (and (eq $kind "dind") (eq $Values.imageBuilderType "dind")) (and (eq $kind "pink") (eq $Values.imageBuilderType "pink")) (and (eq $kind "host") $Values.imageCleaner.host.enabled) }}
- name: image-cleaner-{{ $kind }}
image: {{ $Values.imageCleaner.image.name }}:{{ $Values.imageCleaner.image.tag }}
{{- with $Values.imageCleaner.image.pullPolicy }}
- name: image-cleaner-{{ .Values.imageBuilderType }}
image: {{ .Values.imageCleaner.image.name }}:{{ .Values.imageCleaner.image.tag }}
{{- with .Values.imageCleaner.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
volumeMounts:
- name: storage-{{ $kind }}
mountPath: /var/lib/{{ $kind }}
- name: socket-{{ $kind }}
- name: storage-{{ .Values.imageBuilderType }}
mountPath: /var/lib/{{ .Values.imageBuilderType }}
- name: socket-{{ .Values.imageBuilderType }}
mountPath: /var/run/docker.sock
env:
- name: DOCKER_IMAGE_CLEANER_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: DOCKER_IMAGE_CLEANER_PATH_TO_CHECK
value: /var/lib/{{ $kind }}
value: /var/lib/{{ .Values.imageBuilderType }}
- name: DOCKER_IMAGE_CLEANER_DELAY_SECONDS
value: {{ $Values.imageCleaner.delay | quote }}
value: {{ .Values.imageCleaner.delay | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_TYPE
value: {{ $Values.imageCleaner.imageGCThresholdType | quote }}
value: {{ .Values.imageCleaner.imageGCThresholdType | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_HIGH
value: {{ $Values.imageCleaner.imageGCThresholdHigh | quote }}
value: {{ .Values.imageCleaner.imageGCThresholdHigh | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_LOW
value: {{ $Values.imageCleaner.imageGCThresholdLow | quote }}
{{- end }}
{{- end }}
value: {{ .Values.imageCleaner.imageGCThresholdLow | quote }}
terminationGracePeriodSeconds: 0
volumes:
{{- if .Values.imageCleaner.host.enabled }}
{{- if eq .Values.imageBuilderType "host" }}
- name: storage-host
hostPath:
path: {{ .Values.imageCleaner.host.dockerLibDir }}
Expand All @@ -76,7 +71,7 @@ spec:
path: {{ .Values.imageCleaner.host.dockerSocket }}
type: Socket
{{- end }}
{{- if eq $Values.imageBuilderType "dind" }}
{{- if eq .Values.imageBuilderType "dind" }}
- name: storage-dind
hostPath:
path: {{ .Values.dind.hostLibDir }}
Expand All @@ -86,7 +81,7 @@ spec:
path: {{ .Values.dind.hostSocketDir }}/docker.sock
type: Socket
{{- end }}
{{- if eq $Values.imageBuilderType "pink" }}
{{- if eq .Values.imageBuilderType "pink" }}
- name: storage-pink
hostPath:
path: {{ .Values.pink.hostStorageDir }}
Expand All @@ -96,5 +91,4 @@ spec:
path: {{ .Values.pink.hostSocketDir }}/podman.sock
type: Socket
{{- end }}

{{- end }}
4 changes: 2 additions & 2 deletions helm-chart/binderhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ deployment:
timeoutSeconds: 10
labels: {}

imageBuilderType: "local"
imageBuilderType: "host"

dind:
initContainers: []
Expand Down Expand Up @@ -299,8 +299,8 @@ imageCleaner:
imageGCThresholdHigh: 80
imageGCThresholdLow: 60
# cull images on the host docker as well as dind
# configuration to use if `imageBuilderType: host` is configured
host:
enabled: true
dockerSocket: /var/run/docker.sock
dockerLibDir: /var/lib/docker

Expand Down
4 changes: 2 additions & 2 deletions testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ ingress:
# used actively in our CI system.
enabled: true

# No in cluster builder to test the creation/update of the image-cleaner DaemonSet
# No "in cluster" builder to test the creation/update of the image-cleaner DaemonSet
# resource because it also requires us to setup a container registry to test
# against which we haven't. We currently only test this through the use of
# lint-and-validate-values.yaml and setting this value explicitly to make sure
# our rendered templates are valid against a k8s api-server.
imageBuilderType: "local"
imageBuilderType: "host"

# NOTE: This is a mirror of the jupyterhub section in
# jupyterhub-chart-config.yaml in testing/local-binder-k8s-hub, keep these
Expand Down
3 changes: 1 addition & 2 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ deployment:
livenessProbe: *probe
labels: *labels

imageBuilderType: local
imageBuilderType: host

dind:
initContainers: &initContainers
Expand Down Expand Up @@ -128,7 +128,6 @@ imageCleaner:
imageGCThresholdHigh: 2
imageGCThresholdLow: 1
host:
enabled: true
dockerSocket: /var/run/docker.sock
dockerLibDir: /var/lib/docker

Expand Down