|
2 | 2 | {{- $builderName := .Values.imageBuilderType -}}
|
3 | 3 | {{- $builder := index .Values $builderName -}}
|
4 | 4 | {{- $daemonset := $builder.daemonset -}}
|
| 5 | +{{- $hostSocketPath := printf "%s/%s" $builder.hostSocketDir $builder.hostSocketName }} |
5 | 6 |
|
6 | 7 | apiVersion: apps/v1
|
7 | 8 | kind: DaemonSet
|
@@ -36,10 +37,33 @@ spec:
|
36 | 37 | value: user
|
37 | 38 | nodeSelector: {{ .Values.config.BinderHub.build_node_selector | toJson }}
|
38 | 39 |
|
39 |
| - {{- with $builder.initContainers }} |
| 40 | + {{- if or $builder.cleanupIncorrectSocketDir $builder.initContainers }} |
40 | 41 | initContainers:
|
| 42 | + {{- if $builder.cleanupIncorrectSocketDir }} |
| 43 | + - name: filesystem |
| 44 | + # Reuse the main container image since this is a simple shell command |
| 45 | + image: {{ $daemonset.image.name }}:{{ $daemonset.image.tag }} |
| 46 | + {{- with $daemonset.image.pullPolicy }} |
| 47 | + imagePullPolicy: {{ . }} |
| 48 | + {{- end }} |
| 49 | + command: |
| 50 | + - sh |
| 51 | + - -c |
| 52 | + - > |
| 53 | + if [ -d "{{ $hostSocketPath }}" ]; then |
| 54 | + echo "Removing incorrect socket directory {{ $hostSocketPath }}"; |
| 55 | + rmdir "{{ $hostSocketPath }}""; |
| 56 | + fi |
| 57 | + securityContext: |
| 58 | + privileged: true |
| 59 | + volumeMounts: |
| 60 | + - name: run-{{ $builderName }} |
| 61 | + mountPath: {{ $builder.hostSocketDir }} |
| 62 | + {{- end }} |
| 63 | + {{- with $builder.initContainers }} |
41 | 64 | {{- . | toYaml | nindent 8 }}
|
42 | 65 | {{- end }}
|
| 66 | + {{- end }} |
43 | 67 |
|
44 | 68 | containers:
|
45 | 69 | - name: {{ $builderName }}
|
|
55 | 79 | args:
|
56 | 80 | - dockerd
|
57 | 81 | - --storage-driver={{ $builder.storageDriver }}
|
58 |
| - - -H unix://{{ $builder.hostSocketDir }}/{{ $builder.hostSocketName }} |
| 82 | + - -H unix://{{ $hostSocketPath }} |
59 | 83 | {{- with $daemonset.extraArgs }}
|
60 | 84 | {{- . | toYaml | nindent 12 }}
|
61 | 85 | {{- end }}
|
|
73 | 97 | - system
|
74 | 98 | - service
|
75 | 99 | - --time=0
|
76 |
| - - unix://{{ $builder.hostSocketDir }}/{{ $builder.hostSocketName }} |
| 100 | + - unix://{{ $hostSocketPath }} |
77 | 101 | {{- with $daemonset.extraArgs }}
|
78 | 102 | {{- . | toYaml | nindent 12 }}
|
79 | 103 | {{- end }}
|
|
0 commit comments