Skip to content

Commit 96aa46f

Browse files
authored
Merge pull request #2030 from manics/docker-socket-dir
Image-cleaner: mount docker dir instead of socket
2 parents 8fd36e8 + a7e36d9 commit 96aa46f

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ make it easier to track what has changed over time_
1313

1414
## Breaking changes
1515

16+
### `imageCleaner.host.dockerSocket` is replaced by `dockerSocketDir` and `dockerSocketName`
17+
18+
`imageCleaner.host.dockerSocket` is replaced by `imageCleaner.host.dockerSocketDir` and `imageCleaner.host.dockerSocketHost` [#2030](https://github.com/jupyterhub/binderhub/pull/2030).
19+
This gives us more control over how the socket is mounted to work around some bugs.
20+
1621
### `binderhub_config.py` is mounted at runtime
1722

1823
The `binderhub_config.py` file is now mounted at runtime instead of being built into the BinderHub image

helm-chart/binderhub/schema.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ properties:
495495
host:
496496
type: object
497497
additionalProperties: false
498-
required: [dockerSocket, dockerLibDir]
498+
required: [dockerSocketDir, dockerSocketName, dockerLibDir]
499499
properties:
500500
enabled:
501501
type: boolean
@@ -504,7 +504,15 @@ properties:
504504
dockerSocket:
505505
type: string
506506
description: |
507-
TODO
507+
REMOVED: use imageCleaner.host.dockerSocketDir and imageCleaner.host.dockerSocketHost instead.
508+
dockerSocketDir:
509+
type: string
510+
description: |
511+
Host directory containing the docker socket.
512+
dockerSocketName:
513+
type: string
514+
description: |
515+
Filename of the docker socket.
508516
dockerLibDir:
509517
type: string
510518
description: |

helm-chart/binderhub/templates/NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ config:
200200
{{- $breaking = print $breaking "\n\nThe image cleaner is either disabled or adapted to the value of imageBuilderType." }}
201201
{{- end }}
202202

203+
{{- if hasKey .Values.imageCleaner.host "dockerSocket" }}
204+
{{- $breaking = print $breaking "\n\nCHANGED: imageCleaner.host.dockerSocket has been removed, use imageCleaner.host.dockerSocketDir and imageCleaner.host.dockerSocketHost instead" }}
205+
{{- end }}
206+
203207
{{- if $breaking }}
204208
{{- fail (print $breaking_title $breaking) }}
205209
{{- end }}

helm-chart/binderhub/templates/image-cleaner.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ spec:
4949
volumeMounts:
5050
- name: storage-{{ $builderName }}
5151
mountPath: /var/lib/{{ $builderName }}
52-
- name: socket-{{ $builderName }}
53-
mountPath: /var/run/docker.sock
52+
- name: socketdir-{{ $builderName }}
53+
mountPath: /var/run
5454
env:
5555
{{- if .Values.imageCleaner.cordon }}
5656
- name: DOCKER_IMAGE_CLEANER_NODE_NAME
@@ -68,6 +68,8 @@ spec:
6868
value: {{ .Values.imageCleaner.imageGCThresholdHigh | quote }}
6969
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_LOW
7070
value: {{ .Values.imageCleaner.imageGCThresholdLow | quote }}
71+
- name: DOCKER_HOST
72+
value: unix:///var/run/{{ eq $builderName "host" | ternary .Values.imageCleaner.host.dockerSocketName $builder.hostSocketName }}
7173
{{- with .Values.imageCleaner.extraEnv }}
7274
{{- include "jupyterhub.extraEnv" . | nindent 8 }}
7375
{{- end }}
@@ -77,19 +79,19 @@ spec:
7779
- name: storage-host
7880
hostPath:
7981
path: {{ .Values.imageCleaner.host.dockerLibDir }}
80-
- name: socket-host
82+
- name: socketdir-host
8183
hostPath:
82-
path: {{ .Values.imageCleaner.host.dockerSocket }}
83-
type: Socket
84+
path: {{ .Values.imageCleaner.host.dockerSocketDir }}
85+
type: Directory
8486
{{- end }}
8587
{{- if or (eq $builderName "dind") (eq $builderName "pink") }}
8688
- name: storage-{{ $builderName }}
8789
hostPath:
8890
path: {{ eq $builderName "dind" | ternary $builder.hostLibDir $builder.hostStorageDir }}
89-
type: DirectoryOrCreate
90-
- name: socket-{{ $builderName }}
91+
type: Directory
92+
- name: socketdir-{{ $builderName }}
9193
hostPath:
92-
path: {{ $builder.hostSocketDir }}/{{ $builder.hostSocketName }}
93-
type: Socket
94+
path: {{ $builder.hostSocketDir }}
95+
type: Directory
9496
{{- end }}
9597
{{- end }}

helm-chart/binderhub/values.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ imageCleaner:
335335
# cull images until it drops below 60%
336336
imageGCThresholdHigh: 80
337337
imageGCThresholdLow: 60
338-
# cull images on the host docker as well as dind
338+
# cull images on the host docker
339339
# configuration to use if `imageBuilderType: host` is configured
340340
host:
341-
dockerSocket: /var/run/docker.sock
341+
dockerSocketDir: /var/run
342+
dockerSocketName: docker.sock
342343
dockerLibDir: /var/lib/docker
343344

344345
ingress:

tools/templates/lint-and-validate-values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ imageCleaner:
128128
imageGCThresholdHigh: 2
129129
imageGCThresholdLow: 1
130130
host:
131-
dockerSocket: /var/run/docker.sock
131+
dockerSocketDir: /var/run
132+
dockerSocketName: docker.sock
132133
dockerLibDir: /var/lib/docker
133134

134135
ingress:

0 commit comments

Comments
 (0)