From b805ea56834f010fbf4c79666746e84acfe39fa4 Mon Sep 17 00:00:00 2001 From: roblabla Date: Thu, 15 Feb 2024 11:26:55 +0100 Subject: [PATCH] Allow disabling redis in registry There are bugs in the registry with regards to cache invalidation when deleting an image that can lead to some really problematic issues. See https://github.com/distribution/distribution/issues/4269. To work around that problem, add a new field to allow disabling redis in the registry. Signed-off-by: roblabla --- templates/_helpers.tpl | 2 +- templates/registry/registry-cm.yaml | 4 ++++ values.yaml | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index b3430a1f3..3e3bfb2fd 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -563,4 +563,4 @@ app: "{{ template "harbor.name" . }}" {{/* Allow KubeVersion to be overridden. */}} {{- define "harbor.ingress.kubeVersion" -}} {{- default .Capabilities.KubeVersion.Version .Values.expose.ingress.kubeVersionOverride -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/templates/registry/registry-cm.yaml b/templates/registry/registry-cm.yaml index 4f7056c38..bd92ad1b3 100644 --- a/templates/registry/registry-cm.yaml +++ b/templates/registry/registry-cm.yaml @@ -153,8 +153,10 @@ data: rootdirectory: {{ $storage.oss.rootdirectory }} {{- end }} {{- end }} + {{- if .Values.redis.enabledForRegistry }} cache: layerinfo: redis + {{- end }} maintenance: uploadpurging: {{- if .Values.registry.upload_purging.enabled }} @@ -169,6 +171,7 @@ data: enabled: true redirect: disable: {{ $storage.disableredirect }} + {{- if .Values.redis.enabledForRegistry }} redis: addr: {{ template "harbor.redis.addr" . }} {{- if eq "redis+sentinel" (include "harbor.redis.scheme" .) }} @@ -185,6 +188,7 @@ data: maxidle: 100 maxactive: 500 idletimeout: 60s + {{- end }} http: addr: :{{ template "harbor.registry.containerPort" . }} relativeurls: {{ .Values.registry.relativeurls }} diff --git a/values.yaml b/values.yaml index 3c4e87081..1a17402cc 100644 --- a/values.yaml +++ b/values.yaml @@ -896,6 +896,11 @@ redis: # if external Redis is used, set "type" to "external" # and fill the connection information in "external" section type: internal + # If redis should be used by the registry. + # The registry has some bugs related to cache invalidation when deleting + # images, see https://github.com/distribution/distribution/issues/4269. If you + # encounter this bug, setting this value to false may help. + enabledForRegistry: true internal: image: repository: goharbor/redis-photon