From e73d9e85c4cf73a2a4bf92f9258426cdbe7d94dc Mon Sep 17 00:00:00 2001 From: Mercbot7 <42525173+Mercbot7@users.noreply.github.com> Date: Mon, 14 Apr 2025 09:20:19 -0400 Subject: [PATCH] Update gargagecollect cronjob This adds podLabels and podAnnotations to the cronjob job pod and defaults them to the root podLabels and podAnnotations. --- templates/cronjob.yaml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/templates/cronjob.yaml b/templates/cronjob.yaml index 780cf87..a671cf5 100644 --- a/templates/cronjob.yaml +++ b/templates/cronjob.yaml @@ -17,16 +17,40 @@ spec: app: {{ template "docker-registry.name" . }} release: {{ .Release.Name }} {{- with .Values.podLabels }} - {{ toYaml . | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} {{- if .Values.podAnnotations }} - {{ toYaml .Values.podAnnotations | nindent 8 }} + {{- toYaml .Values.podAnnotations | nindent 8 }} {{- end }} spec: template: + metadata: + labels: + release: {{ .Release.Name }} + {{- if .Values.garbageCollect.podLabels }} + {{- with .Values.garbageCollect.podLabels }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- else if .Values.podLabels }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- end }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- if .Values.garbageCollect.podAnnotations }} + {{- with .Values.garbageCollect.podAnnotations }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- else if .Values.podAnnotations }} + {{- with .Values.podAnnotations}} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- end }} spec: {{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }} serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }} @@ -49,7 +73,7 @@ spec: - garbage-collect - --delete-untagged={{ .Values.garbageCollect.deleteUntagged }} - /etc/docker/registry/config.yml - resources: {{ toYaml .Values.garbageCollect.resources | nindent 12 }} + resources: {{ toYaml .Values.garbageCollect.resources | nindent 16 }} env: {{ include "docker-registry.envs" . | nindent 16 }} {{- if .Values.containerSecurityContext.enabled }} securityContext: {{ omit .Values.containerSecurityContext "enabled" | toYaml | nindent 16 }}