Skip to content

Commit

Permalink
Allow disabling redis in registry
Browse files Browse the repository at this point in the history
There are bugs in the registry with regards to cache invalidation when
deleting an image that can lead to some really problematic issues. See
distribution/distribution#4269.

To work around that problem, add a new field to allow disabling redis in
the registry.

Signed-off-by: roblabla <unfiltered@roblab.la>
  • Loading branch information
roblabla committed Feb 15, 2024
1 parent 54979d8 commit 4ab1cb4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/_helpers.tpl
Expand Up @@ -227,6 +227,10 @@ app: "{{ template "harbor.name" . }}"
{{- end }}
{{- end -}}

{{- define "harbor.redis.enabledForRegistry" -}}
{{- .Values.redis.enabledForRegistry }}
{{- end -}}

{{- define "harbor.redis.dbForRegistry" -}}
{{- with .Values.redis }}
{{- ternary .internal.registryDatabaseIndex .external.registryDatabaseIndex (eq .type "internal") }}
Expand Down Expand Up @@ -563,4 +567,4 @@ app: "{{ template "harbor.name" . }}"
{{/* Allow KubeVersion to be overridden. */}}
{{- define "harbor.ingress.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.expose.ingress.kubeVersionOverride -}}
{{- end -}}
{{- end -}}
4 changes: 4 additions & 0 deletions templates/registry/registry-cm.yaml
Expand Up @@ -153,8 +153,10 @@ data:
rootdirectory: {{ $storage.oss.rootdirectory }}
{{- end }}
{{- end }}
{{- if $harbor.redis.enabledForRegistry }}
cache:
layerinfo: redis
{{- end }}
maintenance:
uploadpurging:
{{- if .Values.registry.upload_purging.enabled }}
Expand All @@ -169,6 +171,7 @@ data:
enabled: true
redirect:
disable: {{ $storage.disableredirect }}
{{- if $harbor.redis.enabledForRegistry }}
redis:
addr: {{ template "harbor.redis.addr" . }}
{{- if eq "redis+sentinel" (include "harbor.redis.scheme" .) }}
Expand All @@ -185,6 +188,7 @@ data:
maxidle: 100
maxactive: 500
idletimeout: 60s
{{- end }}
http:
addr: :{{ template "harbor.registry.containerPort" . }}
relativeurls: {{ .Values.registry.relativeurls }}
Expand Down
5 changes: 5 additions & 0 deletions values.yaml
Expand Up @@ -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
Expand Down

0 comments on commit 4ab1cb4

Please sign in to comment.