|
1 | 1 | {{- if .Values.imageCleaner.enabled -}} |
2 | | -{{- $Values := .Values -}} |
3 | 2 | apiVersion: apps/v1 |
4 | 3 | kind: DaemonSet |
5 | 4 | metadata: |
@@ -36,38 +35,34 @@ spec: |
36 | 35 | serviceAccountName: {{ .Release.Name }}-image-cleaner |
37 | 36 | {{- end }} |
38 | 37 | containers: |
39 | | - {{- range $i, $kind := tuple "host" "dind" "pink" }} |
40 | | - {{- 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) }} |
41 | | - - name: image-cleaner-{{ $kind }} |
42 | | - image: {{ $Values.imageCleaner.image.name }}:{{ $Values.imageCleaner.image.tag }} |
43 | | - {{- with $Values.imageCleaner.image.pullPolicy }} |
| 38 | + - name: image-cleaner-{{ .Values.imageBuilderType }} |
| 39 | + image: {{ .Values.imageCleaner.image.name }}:{{ .Values.imageCleaner.image.tag }} |
| 40 | + {{- with .Values.imageCleaner.image.pullPolicy }} |
44 | 41 | imagePullPolicy: {{ . }} |
45 | 42 | {{- end }} |
46 | 43 | volumeMounts: |
47 | | - - name: storage-{{ $kind }} |
48 | | - mountPath: /var/lib/{{ $kind }} |
49 | | - - name: socket-{{ $kind }} |
| 44 | + - name: storage-{{ .Values.imageBuilderType }} |
| 45 | + mountPath: /var/lib/{{ .Values.imageBuilderType }} |
| 46 | + - name: socket-{{ .Values.imageBuilderType }} |
50 | 47 | mountPath: /var/run/docker.sock |
51 | 48 | env: |
52 | 49 | - name: DOCKER_IMAGE_CLEANER_NODE_NAME |
53 | 50 | valueFrom: |
54 | 51 | fieldRef: |
55 | 52 | fieldPath: spec.nodeName |
56 | 53 | - name: DOCKER_IMAGE_CLEANER_PATH_TO_CHECK |
57 | | - value: /var/lib/{{ $kind }} |
| 54 | + value: /var/lib/{{ .Values.imageBuilderType }} |
58 | 55 | - name: DOCKER_IMAGE_CLEANER_DELAY_SECONDS |
59 | | - value: {{ $Values.imageCleaner.delay | quote }} |
| 56 | + value: {{ .Values.imageCleaner.delay | quote }} |
60 | 57 | - name: DOCKER_IMAGE_CLEANER_THRESHOLD_TYPE |
61 | | - value: {{ $Values.imageCleaner.imageGCThresholdType | quote }} |
| 58 | + value: {{ .Values.imageCleaner.imageGCThresholdType | quote }} |
62 | 59 | - name: DOCKER_IMAGE_CLEANER_THRESHOLD_HIGH |
63 | | - value: {{ $Values.imageCleaner.imageGCThresholdHigh | quote }} |
| 60 | + value: {{ .Values.imageCleaner.imageGCThresholdHigh | quote }} |
64 | 61 | - name: DOCKER_IMAGE_CLEANER_THRESHOLD_LOW |
65 | | - value: {{ $Values.imageCleaner.imageGCThresholdLow | quote }} |
66 | | - {{- end }} |
67 | | - {{- end }} |
| 62 | + value: {{ .Values.imageCleaner.imageGCThresholdLow | quote }} |
68 | 63 | terminationGracePeriodSeconds: 0 |
69 | 64 | volumes: |
70 | | - {{- if .Values.imageCleaner.host.enabled }} |
| 65 | + {{- if eq .Values.imageBuilderType "host" }} |
71 | 66 | - name: storage-host |
72 | 67 | hostPath: |
73 | 68 | path: {{ .Values.imageCleaner.host.dockerLibDir }} |
|
76 | 71 | path: {{ .Values.imageCleaner.host.dockerSocket }} |
77 | 72 | type: Socket |
78 | 73 | {{- end }} |
79 | | - {{- if eq $Values.imageBuilderType "dind" }} |
| 74 | + {{- if eq .Values.imageBuilderType "dind" }} |
80 | 75 | - name: storage-dind |
81 | 76 | hostPath: |
82 | 77 | path: {{ .Values.dind.hostLibDir }} |
|
86 | 81 | path: {{ .Values.dind.hostSocketDir }}/docker.sock |
87 | 82 | type: Socket |
88 | 83 | {{- end }} |
89 | | - {{- if eq $Values.imageBuilderType "pink" }} |
| 84 | + {{- if eq .Values.imageBuilderType "pink" }} |
90 | 85 | - name: storage-pink |
91 | 86 | hostPath: |
92 | 87 | path: {{ .Values.pink.hostStorageDir }} |
|
96 | 91 | path: {{ .Values.pink.hostSocketDir }}/podman.sock |
97 | 92 | type: Socket |
98 | 93 | {{- end }} |
99 | | - |
100 | 94 | {{- end }} |
0 commit comments