Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm): standalone garbage collection cronjob #431

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.registry.garbageCollection.enabled }}
{{- if and .Values.registry.garbageCollection.schedule (or .Values.registry.persistence.enabled (eq (include "kube-image-keeper.registry-stateless-mode" .) "true")) }}
{{- if semverCompare ">=1.21-0" (default .Capabilities.KubeVersion.Version .Values.kubeVersion) -}}
apiVersion: batch/v1
Expand Down Expand Up @@ -61,3 +62,4 @@ spec:
kubectl rollout status sts {{ include "kube-image-keeper.fullname" . }}-registry
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.registry.garbageCollection.enabled }}
{{- if .Values.registry.garbageCollection.schedule }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -13,3 +14,4 @@ subjects:
name: {{ include "kube-image-keeper.fullname" . }}-registry-restart
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions helm/kube-image-keeper/templates/garbage-collection-role.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.registry.garbageCollection.enabled }}
{{- if .Values.registry.garbageCollection.schedule }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -15,3 +16,4 @@ rules:
resources: ["pods/exec"]
verbs: ["create"]
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{{- if .Values.registry.garbageCollection.enabled }}
{{- if .Values.registry.garbageCollection.schedule }}
kind: ServiceAccount
apiVersion: v1
metadata:
name: {{ include "kube-image-keeper.fullname" . }}-registry-restart
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions helm/kube-image-keeper/templates/registry-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
volumeMounts:
- mountPath: /var/lib/registry
name: data
{{- if .Values.registry.garbageCollection.enabled }}
- name: garbage-collector
image: "{{ .Values.registry.image.repository }}:{{ .Values.registry.image.tag }}"
imagePullPolicy: {{ .Values.registry.image.pullPolicy }}
Expand All @@ -63,6 +64,7 @@ spec:
volumeMounts:
- mountPath: /var/lib/registry
name: data
{{- end }}
{{- end }}
containers:
- name: registry
Expand Down
1 change: 1 addition & 0 deletions helm/kube-image-keeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ registry:
azure: {}
azureExistingSecret: ""
garbageCollection:
enabled: true
# -- Garbage collector cron schedule. Use standard crontab format.
schedule: "0 0 * * 0"
# -- If true, delete untagged manifests. Default to false since there is a known bug in **docker distribution** garbage collect job.
Expand Down