refactor(image-cleaner): remove local variable use
{{- if .Values.imageCleaner.enabled -}}
-{{- $Values := .Values -}}
-{{- $imageBuilderType := $Values.imageBuilderType -}}
-{{- $imageCleaner := $Values.imageCleaner -}}
apiVersion: apps/v1
kind: DaemonSet
metadata:
@@ -38,15 +35,15 @@ spec:
serviceAccountName: {{ .Release.Name }}-image-cleaner
{{- end }}
containers:
- - name: image-cleaner-{{ $imageBuilderType }}
- image: {{ $imageCleaner.image.name }}:{{ $imageCleaner.image.tag }}
- {{- with $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-{{ $imageBuilderType }}
- mountPath: /var/lib/{{ $imageBuilderType }}
- - name: socket-{{ $imageBuilderType }}
+ - 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
@@ -54,27 +51,27 @@ spec:
fieldRef:
fieldPath: spec.nodeName
- name: DOCKER_IMAGE_CLEANER_PATH_TO_CHECK
- value: /var/lib/{{ $imageBuilderType }}
+ value: /var/lib/{{ .Values.imageBuilderType }}
- name: DOCKER_IMAGE_CLEANER_DELAY_SECONDS
- value: {{ $imageCleaner.delay | quote }}
+ value: {{ .Values.imageCleaner.delay | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_TYPE
- value: {{ $imageCleaner.imageGCThresholdType | quote }}
+ value: {{ .Values.imageCleaner.imageGCThresholdType | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_HIGH
- value: {{ $imageCleaner.imageGCThresholdHigh | quote }}
+ value: {{ .Values.imageCleaner.imageGCThresholdHigh | quote }}
- name: DOCKER_IMAGE_CLEANER_THRESHOLD_LOW
- value: {{ $imageCleaner.imageGCThresholdLow | quote }}
+ value: {{ .Values.imageCleaner.imageGCThresholdLow | quote }}
terminationGracePeriodSeconds: 0
volumes:
- {{- if eq $imageBuilderType "host" }}
+ {{- if eq .Values.imageBuilderType "host" }}
- name: storage-host
hostPath:
- path: {{ $imageCleaner.host.dockerLibDir }}
+ path: {{ .Values.imageCleaner.host.dockerLibDir }}
- name: socket-host
hostPath:
- path: {{ $imageCleaner.host.dockerSocket }}
+ path: {{ .Values.imageCleaner.host.dockerSocket }}
type: Socket
{{- end }}
- {{- if eq $imageBuilderType "dind" }}
+ {{- if eq .Values.imageBuilderType "dind" }}
- name: storage-dind
hostPath:
path: {{ .Values.dind.hostLibDir }}
@@ -84,7 +81,7 @@ spec:
path: {{ .Values.dind.hostSocketDir }}/docker.sock
type: Socket
{{- end }}
- {{- if eq $imageBuilderType "pink" }}
+ {{- if eq .Values.imageBuilderType "pink" }}
- name: storage-pink
hostPath:
path: {{ .Values.pink.hostStorageDir }}
