diff --git a/CHANGES.md b/CHANGES.md index 7267ec956..c63c3be3d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,11 @@ make it easier to track what has changed over time_ ## Breaking changes +### `imageCleaner.host.dockerSocket` is replaced by `dockerSocketDir` and `dockerSocketName` + +`imageCleaner.host.dockerSocket` is replaced by `imageCleaner.host.dockerSocketDir` and `imageCleaner.host.dockerSocketHost` [#2030](https://github.com/jupyterhub/binderhub/pull/2030). +This gives us more control over how the socket is mounted to work around some bugs. + ### `binderhub_config.py` is mounted at runtime The `binderhub_config.py` file is now mounted at runtime instead of being built into the BinderHub image diff --git a/helm-chart/binderhub/schema.yaml b/helm-chart/binderhub/schema.yaml index 2a9587716..a79e1ed52 100644 --- a/helm-chart/binderhub/schema.yaml +++ b/helm-chart/binderhub/schema.yaml @@ -495,7 +495,7 @@ properties: host: type: object additionalProperties: false - required: [dockerSocket, dockerLibDir] + required: [dockerSocketDir, dockerSocketName, dockerLibDir] properties: enabled: type: boolean @@ -504,7 +504,15 @@ properties: dockerSocket: type: string description: | - TODO + REMOVED: use imageCleaner.host.dockerSocketDir and imageCleaner.host.dockerSocketHost instead. + dockerSocketDir: + type: string + description: | + Host directory containing the docker socket. + dockerSocketName: + type: string + description: | + Filename of the docker socket. dockerLibDir: type: string description: | diff --git a/helm-chart/binderhub/templates/NOTES.txt b/helm-chart/binderhub/templates/NOTES.txt index 1b8a4f649..f8ff225ad 100644 --- a/helm-chart/binderhub/templates/NOTES.txt +++ b/helm-chart/binderhub/templates/NOTES.txt @@ -200,6 +200,10 @@ config: {{- $breaking = print $breaking "\n\nThe image cleaner is either disabled or adapted to the value of imageBuilderType." }} {{- end }} +{{- if hasKey .Values.imageCleaner.host "dockerSocket" }} +{{- $breaking = print $breaking "\n\nCHANGED: imageCleaner.host.dockerSocket has been removed, use imageCleaner.host.dockerSocketDir and imageCleaner.host.dockerSocketHost instead" }} +{{- end }} + {{- if $breaking }} {{- fail (print $breaking_title $breaking) }} {{- end }} diff --git a/helm-chart/binderhub/templates/image-cleaner.yaml b/helm-chart/binderhub/templates/image-cleaner.yaml index 46eb1b4b5..7a825d342 100644 --- a/helm-chart/binderhub/templates/image-cleaner.yaml +++ b/helm-chart/binderhub/templates/image-cleaner.yaml @@ -49,8 +49,8 @@ spec: volumeMounts: - name: storage-{{ $builderName }} mountPath: /var/lib/{{ $builderName }} - - name: socket-{{ $builderName }} - mountPath: /var/run/docker.sock + - name: socketdir-{{ $builderName }} + mountPath: /var/run env: {{- if .Values.imageCleaner.cordon }} - name: DOCKER_IMAGE_CLEANER_NODE_NAME @@ -68,6 +68,8 @@ spec: value: {{ .Values.imageCleaner.imageGCThresholdHigh | quote }} - name: DOCKER_IMAGE_CLEANER_THRESHOLD_LOW value: {{ .Values.imageCleaner.imageGCThresholdLow | quote }} + - name: DOCKER_HOST + value: unix:///var/run/{{ eq $builderName "host" | ternary .Values.imageCleaner.host.dockerSocketName $builder.hostSocketName }} {{- with .Values.imageCleaner.extraEnv }} {{- include "jupyterhub.extraEnv" . | nindent 8 }} {{- end }} @@ -77,19 +79,19 @@ spec: - name: storage-host hostPath: path: {{ .Values.imageCleaner.host.dockerLibDir }} - - name: socket-host + - name: socketdir-host hostPath: - path: {{ .Values.imageCleaner.host.dockerSocket }} - type: Socket + path: {{ .Values.imageCleaner.host.dockerSocketDir }} + type: Directory {{- end }} {{- if or (eq $builderName "dind") (eq $builderName "pink") }} - name: storage-{{ $builderName }} hostPath: path: {{ eq $builderName "dind" | ternary $builder.hostLibDir $builder.hostStorageDir }} - type: DirectoryOrCreate - - name: socket-{{ $builderName }} + type: Directory + - name: socketdir-{{ $builderName }} hostPath: - path: {{ $builder.hostSocketDir }}/{{ $builder.hostSocketName }} - type: Socket + path: {{ $builder.hostSocketDir }} + type: Directory {{- end }} {{- end }} diff --git a/helm-chart/binderhub/values.yaml b/helm-chart/binderhub/values.yaml index 907a04601..2617435bb 100644 --- a/helm-chart/binderhub/values.yaml +++ b/helm-chart/binderhub/values.yaml @@ -335,10 +335,11 @@ imageCleaner: # cull images until it drops below 60% imageGCThresholdHigh: 80 imageGCThresholdLow: 60 - # cull images on the host docker as well as dind + # cull images on the host docker # configuration to use if `imageBuilderType: host` is configured host: - dockerSocket: /var/run/docker.sock + dockerSocketDir: /var/run + dockerSocketName: docker.sock dockerLibDir: /var/lib/docker ingress: diff --git a/tools/templates/lint-and-validate-values.yaml b/tools/templates/lint-and-validate-values.yaml index 92af3d540..823cc56cc 100644 --- a/tools/templates/lint-and-validate-values.yaml +++ b/tools/templates/lint-and-validate-values.yaml @@ -128,7 +128,8 @@ imageCleaner: imageGCThresholdHigh: 2 imageGCThresholdLow: 1 host: - dockerSocket: /var/run/docker.sock + dockerSocketDir: /var/run + dockerSocketName: docker.sock dockerLibDir: /var/lib/docker ingress: