1
- apiVersion : apps/v1
2
- kind : Deployment
1
+ {{- if .Values.garbageCollect.enabled }}
2
+ apiVersion : batch/v1
3
+ kind : CronJob
3
4
metadata :
4
- name : {{ template "docker-registry.fullname" . }}
5
+ name : {{ template "docker-registry.fullname" . }}-garbage-collector
5
6
namespace : {{ .Values.namespace | default .Release.Namespace }}
6
7
labels :
7
8
app : {{ template "docker-registry.name" . }}
8
9
chart : {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9
10
release : {{ .Release.Name }}
10
11
heritage : {{ .Release.Service }}
11
- {{- if .Values.deployment.annotations }}
12
- annotations :
13
- {{ toYaml .Values.deployment.annotations | indent 4 }}
14
- {{- end }}
15
12
spec :
16
- selector :
17
- matchLabels :
18
- app : {{ template "docker-registry.name" . }}
19
- release : {{ .Release.Name }}
20
- replicas : {{ .Values.replicaCount }}
21
- {{- if .Values.updateStrategy }}
22
- strategy : {{ toYaml .Values.updateStrategy | nindent 4 }}
23
- {{- end }}
24
- minReadySeconds : 5
25
- template :
13
+ schedule : {{ .Values.garbageCollect.schedule | quote }}
14
+ jobTemplate :
26
15
metadata :
27
16
labels :
28
17
app : {{ template "docker-registry.name" . }}
@@ -37,64 +26,44 @@ spec:
37
26
{{ toYaml .Values.podAnnotations | nindent 8 }}
38
27
{{- end }}
39
28
spec :
40
- {{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
41
- serviceAccountName : {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
42
- {{- end }}
43
- {{- if .Values.imagePullSecrets }}
44
- imagePullSecrets : {{ toYaml .Values.imagePullSecrets | nindent 8 }}
45
- {{- end }}
46
- {{- if .Values.priorityClassName }}
47
- priorityClassName : " {{ .Values.priorityClassName }}"
48
- {{- end }}
49
- {{- if .Values.securityContext.enabled }}
50
- securityContext : {{ omit .Values.securityContext "enabled" | toYaml | nindent 8 }}
51
- {{- end }}
52
- {{- with .Values.initContainers }}
53
- initContainers :
54
- {{- toYaml . | nindent 8 }}
55
- {{- end }}
56
- containers :
57
- - name : {{ .Chart.Name }}
58
- image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
59
- imagePullPolicy : {{ .Values.image.pullPolicy }}
60
- command :
61
- - /bin/registry
62
- - serve
63
- - /etc/docker/registry/config.yml
64
- ports :
65
- - containerPort : 5000
66
- {{- if .Values.metrics.enabled }}
67
- - containerPort : {{ (split ":" .Values.configData.http.debug.addr)._1 }}
68
- name : http-metrics
69
- protocol : TCP
70
- {{- end }}
71
- livenessProbe :
72
- httpGet :
73
- {{- if .Values.tlsSecretName }}
74
- scheme : HTTPS
75
- {{- end }}
76
- path : /
77
- port : 5000
78
- readinessProbe :
79
- httpGet :
80
- {{- if .Values.tlsSecretName }}
81
- scheme : HTTPS
29
+ template :
30
+ spec :
31
+ {{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
32
+ serviceAccountName : {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
33
+ {{- end }}
34
+ {{- if .Values.imagePullSecrets }}
35
+ imagePullSecrets : {{ toYaml .Values.imagePullSecrets | nindent 12 }}
36
+ {{- end }}
37
+ {{- if .Values.priorityClassName }}
38
+ priorityClassName : " {{ .Values.priorityClassName }}"
39
+ {{- end }}
40
+ {{- if .Values.securityContext.enabled }}
41
+ securityContext : {{ omit .Values.securityContext "enabled" | toYaml | nindent 12 }}
42
+ {{- end }}
43
+ containers :
44
+ - name : {{ .Chart.Name }}
45
+ image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
46
+ imagePullPolicy : {{ .Values.image.pullPolicy }}
47
+ command :
48
+ - /bin/registry
49
+ - garbage-collect
50
+ - --delete-untagged={{ .Values.garbageCollect.deleteUntagged }}
51
+ - /etc/docker/registry/config.yml
52
+ resources : {{ toYaml .Values.garbageCollect.resources | nindent 12 }}
53
+ env : {{ include "docker-registry.envs" . | nindent 16 }}
54
+ {{- if .Values.containerSecurityContext.enabled }}
55
+ securityContext : {{ omit .Values.containerSecurityContext "enabled" | toYaml | nindent 16 }}
82
56
{{- end }}
83
- path : /
84
- port : 5000
85
- resources : {{ toYaml .Values.resources | nindent 12 }}
86
- env : {{ include "docker-registry.envs" . | nindent 12 }}
87
- {{- if .Values.containerSecurityContext.enabled }}
88
- securityContext : {{ omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
57
+ volumeMounts : {{ include "docker-registry.volumeMounts" . | nindent 16 }}
58
+ restartPolicy : OnFailure
59
+ {{- if .Values.nodeSelector }}
60
+ nodeSelector : {{ toYaml .Values.nodeSelector | nindent 12 }}
61
+ {{- end }}
62
+ {{- if .Values.affinity }}
63
+ affinity : {{ toYaml .Values.affinity | nindent 12 }}
89
64
{{- end }}
90
- volumeMounts : {{ include "docker-registry.volumeMounts" . | nindent 12 }}
91
- {{- if .Values.nodeSelector }}
92
- nodeSelector : {{ toYaml .Values.nodeSelector | nindent 8 }}
93
- {{- end }}
94
- {{- if .Values.affinity }}
95
- affinity : {{ toYaml .Values.affinity | nindent 8 }}
96
- {{- end }}
97
- {{- if .Values.tolerations }}
98
- tolerations : {{ toYaml .Values.tolerations | nindent 8 }}
99
- {{- end }}
100
- volumes : {{ include "docker-registry.volumes" . | nindent 8 }}
65
+ {{- if .Values.tolerations }}
66
+ tolerations : {{ toYaml .Values.tolerations | nindent 12 }}
67
+ {{- end }}
68
+ volumes : {{ include "docker-registry.volumes" . | nindent 12 }}
69
+ {{- end }}
0 commit comments