From 19715c47906638a72329679305172a8fd2ed7196 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Wed, 6 Aug 2025 16:00:52 +0200 Subject: [PATCH 01/19] feat: introduce redis cache cluster params --- charts/registry/templates/_redis.tpl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index d13dbfec38..957d76aab6 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,17 +81,19 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} + {{- else if .Values.redis.cache.cluster }} + addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} + {{- else if .Values.redis.cache.host }} + addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} - {{- if .redisMergedConfig.sentinelAuth.enabled }} - sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} - {{- end }} - {{- else if .Values.redis.cache.host }} - addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} + {{- if .Values.redis.cache.username }} + username: {{ .Values.redis.cache.username }} + {{- end }} {{- if .Values.redis.cache.password.enabled }} password: "REDIS_CACHE_PASSWORD" {{- end }} -- GitLab From d37d96563c90779deb92db1f45a8ae63340f9c6b Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Wed, 6 Aug 2025 17:43:28 +0200 Subject: [PATCH 02/19] fix --- charts/registry/templates/_redis.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 957d76aab6..28bf2614a3 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,6 +81,9 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} + {{- if .Values.redis.cache.sentinelAuth.enabled }} + sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + {{- end }} {{- else if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} @@ -88,6 +91,9 @@ redis: {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} + {{- if .redisMergedConfig.sentinelAuth.enabled }} + sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + {{- end }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} -- GitLab From 9cf84b2e5b6890e2b7f0e4a04f827715c52074e7 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Thu, 7 Aug 2025 13:30:29 +0200 Subject: [PATCH 03/19] Revert "fix" This reverts commit d37d96563c90779deb92db1f45a8ae63340f9c6b --- charts/registry/templates/_redis.tpl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 28bf2614a3..957d76aab6 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,9 +81,6 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} - {{- if .Values.redis.cache.sentinelAuth.enabled }} - sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} - {{- end }} {{- else if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} @@ -91,9 +88,6 @@ redis: {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} - {{- if .redisMergedConfig.sentinelAuth.enabled }} - sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} - {{- end }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} -- GitLab From 2804202918e26fc556c9ca0b319eb58ef6c0bb22 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 13:27:25 +0200 Subject: [PATCH 04/19] fixes --- charts/registry/templates/_redis.tpl | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 957d76aab6..5b83d85a52 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -30,15 +30,6 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict {{- define "gitlab.registry.redisSentinelSecret.mount" -}} {{- include "gitlab.redis.selectedMergedConfig" . -}} -{{- if .Values.redis.cache.sentinelpassword }} -{{- if .Values.redis.cache.sentinelpassword.enabled }} -- secret: - name: {{ .Values.redis.cache.sentinelpassword.secret | quote }} - items: - - key: {{ .Values.redis.cache.sentinelpassword.key | quote }} - path: redis-sentinel/redis-sentinel-password -{{- end }} -{{- else }} {{- if .redisMergedConfig.sentinelAuth.enabled }} - secret: name: {{ template "gitlab.redis.sentinelAuth.secret" . }} @@ -47,7 +38,6 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict path: redis-sentinel/redis-sentinel-password {{- end }} {{- end -}} -{{- end -}} {{- define "gitlab.registry.redisRateLimitingSecret.mount" -}} {{- if .Values.redis.rateLimiting.password.enabled }} @@ -78,16 +68,10 @@ redis: {{- if .Values.redis.cache.enabled }} cache: enabled: {{ .Values.redis.cache.enabled | eq true }} - {{- if .Values.redis.cache.sentinels }} - addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} - mainname: {{ .Values.redis.cache.host }} - {{- else if .Values.redis.cache.cluster }} + {{- if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} - {{- else if .redisMergedConfig.sentinels }} - addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} - mainname: {{ template "gitlab.redis.host" . }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} @@ -235,4 +219,4 @@ redis: {{- end -}} {{- end -}} {{- end }} -{{- end -}} +{{- end -}} \ No newline at end of file -- GitLab From c0e7252b681e29aed1b2330fb2ce89a2897c912c Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 13:41:24 +0200 Subject: [PATCH 05/19] adding sentinel support alongside cluster support --- charts/registry/templates/_redis.tpl | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 5b83d85a52..84304c9a91 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -30,6 +30,15 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict {{- define "gitlab.registry.redisSentinelSecret.mount" -}} {{- include "gitlab.redis.selectedMergedConfig" . -}} +{{- if .Values.redis.cache.sentinelpassword }} +{{- if .Values.redis.cache.sentinelpassword.enabled }} +- secret: + name: {{ .Values.redis.cache.sentinelpassword.secret | quote }} + items: + - key: {{ .Values.redis.cache.sentinelpassword.key | quote }} + path: redis-sentinel/redis-sentinel-password +{{- end }} +{{- else }} {{- if .redisMergedConfig.sentinelAuth.enabled }} - secret: name: {{ template "gitlab.redis.sentinelAuth.secret" . }} @@ -38,6 +47,7 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict path: redis-sentinel/redis-sentinel-password {{- end }} {{- end -}} +{{- end -}} {{- define "gitlab.registry.redisRateLimitingSecret.mount" -}} {{- if .Values.redis.rateLimiting.password.enabled }} @@ -68,10 +78,24 @@ redis: {{- if .Values.redis.cache.enabled }} cache: enabled: {{ .Values.redis.cache.enabled | eq true }} - {{- if .Values.redis.cache.cluster }} + {{- if .Values.redis.cache.sentinels }} + addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} + mainname: {{ .Values.redis.cache.host }} + {{- if .Values.redis.cache.sentinelpassword }} + {{- if .Values.redis.cache.sentinelpassword.enabled }} + sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + {{- end }} + {{- end }} + {{- else if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} + {{- else if .redisMergedConfig.sentinels }} + addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} + mainname: {{ template "gitlab.redis.host" . }} + {{- if .redisMergedConfig.sentinelAuth.enabled }} + sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + {{- end }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} -- GitLab From d09d43b642055e8d9dde186a51f333c315ab8462 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 13:46:06 +0200 Subject: [PATCH 06/19] fix file.Read format --- charts/registry/templates/_redis.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 84304c9a91..48198e27e4 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -83,7 +83,7 @@ redis: mainname: {{ .Values.redis.cache.host }} {{- if .Values.redis.cache.sentinelpassword }} {{- if .Values.redis.cache.sentinelpassword.enabled }} - sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- end }} {{- else if .Values.redis.cache.cluster }} @@ -94,7 +94,7 @@ redis: addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} {{- if .redisMergedConfig.sentinelAuth.enabled }} - sentinelpassword: {{ file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON }} + sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} -- GitLab From 5e2b416d838c6a8a4368978db5fe5cb2d9c12027 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 14:37:43 +0200 Subject: [PATCH 07/19] hit and trial: re-arranging the lines --- charts/registry/templates/_redis.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 48198e27e4..52f012042f 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,6 +81,10 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} + {{- else if .redisMergedConfig.sentinels }} + addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} + mainname: {{ template "gitlab.redis.host" . }} + {{- if .redisMergedConfig.sentinelAuth.enabled }} {{- if .Values.redis.cache.sentinelpassword }} {{- if .Values.redis.cache.sentinelpassword.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} @@ -90,10 +94,6 @@ redis: addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} - {{- else if .redisMergedConfig.sentinels }} - addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} - mainname: {{ template "gitlab.redis.host" . }} - {{- if .redisMergedConfig.sentinelAuth.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- else }} -- GitLab From 280f39822d2df8bf8b2f3502252a174bf831d32e Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 14:49:09 +0200 Subject: [PATCH 08/19] Revert "hit and trial: re-arranging the lines" This reverts commit 5e2b416d838c6a8a4368978db5fe5cb2d9c12027 --- charts/registry/templates/_redis.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 52f012042f..48198e27e4 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,10 +81,6 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} - {{- else if .redisMergedConfig.sentinels }} - addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} - mainname: {{ template "gitlab.redis.host" . }} - {{- if .redisMergedConfig.sentinelAuth.enabled }} {{- if .Values.redis.cache.sentinelpassword }} {{- if .Values.redis.cache.sentinelpassword.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} @@ -94,6 +90,10 @@ redis: addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .Values.redis.cache.host }} addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} + {{- else if .redisMergedConfig.sentinels }} + addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} + mainname: {{ template "gitlab.redis.host" . }} + {{- if .redisMergedConfig.sentinelAuth.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- else }} -- GitLab From 160e8d0a4c5f0e7bc85e64b2dfba0cf681eb9639 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 11 Aug 2025 15:28:50 +0200 Subject: [PATCH 09/19] adding line at EOF --- charts/registry/templates/_redis.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 48198e27e4..4ee004584b 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -243,4 +243,4 @@ redis: {{- end -}} {{- end -}} {{- end }} -{{- end -}} \ No newline at end of file +{{- end -}} -- GitLab From f7872aaedd27c10ea7ead24e9dda3f4d58af1d61 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Tue, 12 Aug 2025 16:28:52 +0200 Subject: [PATCH 10/19] prioritising redis cluster over global redis host --- charts/registry/templates/_redis.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 4ee004584b..80c1b05282 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -88,14 +88,14 @@ redis: {{- end }} {{- else if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} - {{- else if .Values.redis.cache.host }} - addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} {{- if .redisMergedConfig.sentinelAuth.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} + {{- else if .Values.redis.cache.host }} + addr: {{ printf "%s:%d" .Values.redis.cache.host (int .Values.redis.cache.port | default 6379) | quote }} {{- else }} addr: {{ printf "%s:%s" ( include "gitlab.redis.host" . ) ( include "gitlab.redis.port" . ) | quote }} {{- end }} -- GitLab From 749475f6c9f535a69bd1c54c0c99169ea689a11c Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Tue, 12 Aug 2025 23:11:55 +0200 Subject: [PATCH 11/19] make cache use redis-cluster-registry --- charts/registry/templates/_redis.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 80c1b05282..04ffea478a 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -19,7 +19,7 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict {{- end -}} {{- define "gitlab.registry.redisCacheSecret.mount" -}} -{{- if .Values.redis.cache.password.enabled }} +{{- if .Values.registry.redis.cache.password.enabled }} - secret: name: {{ default (include "redis.secretName" . ) ( .Values.redis.cache.password.secret | quote) }} items: @@ -86,8 +86,8 @@ redis: sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- end }} - {{- else if .Values.redis.cache.cluster }} - addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} + {{- else if .Values.registry.redis.cache.cluster }} + addr: {{ include "registry.redis.host.addresses" .Values.registry.redis.cache | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} @@ -102,7 +102,7 @@ redis: {{- if .Values.redis.cache.username }} username: {{ .Values.redis.cache.username }} {{- end }} - {{- if .Values.redis.cache.password.enabled }} + {{- if .Values.registry.redis.cache.password.enabled }} password: "REDIS_CACHE_PASSWORD" {{- end }} {{- if hasKey .Values.redis.cache "db" }} -- GitLab From 71abf73dfe4fbb6fcdcf66d5d47680d87c31c68b Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Tue, 12 Aug 2025 23:18:02 +0200 Subject: [PATCH 12/19] Revert "make cache use redis-cluster-registry" This reverts commit 749475f6c9f535a69bd1c54c0c99169ea689a11c --- charts/registry/templates/_redis.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 04ffea478a..80c1b05282 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -19,7 +19,7 @@ Expectation: input contents has .sentinels or .cluster, which is a List of Dict {{- end -}} {{- define "gitlab.registry.redisCacheSecret.mount" -}} -{{- if .Values.registry.redis.cache.password.enabled }} +{{- if .Values.redis.cache.password.enabled }} - secret: name: {{ default (include "redis.secretName" . ) ( .Values.redis.cache.password.secret | quote) }} items: @@ -86,8 +86,8 @@ redis: sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- end }} - {{- else if .Values.registry.redis.cache.cluster }} - addr: {{ include "registry.redis.host.addresses" .Values.registry.redis.cache | quote }} + {{- else if .Values.redis.cache.cluster }} + addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} @@ -102,7 +102,7 @@ redis: {{- if .Values.redis.cache.username }} username: {{ .Values.redis.cache.username }} {{- end }} - {{- if .Values.registry.redis.cache.password.enabled }} + {{- if .Values.redis.cache.password.enabled }} password: "REDIS_CACHE_PASSWORD" {{- end }} {{- if hasKey .Values.redis.cache "db" }} -- GitLab From e1bf7d4c15f8a369a5bd9e6c717e13d7c5ad9947 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Tue, 12 Aug 2025 23:19:55 +0200 Subject: [PATCH 13/19] hit and trial --- charts/registry/templates/_redis.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 80c1b05282..4b484d37b4 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -86,8 +86,8 @@ redis: sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- end }} - {{- else if .Values.redis.cache.cluster }} - addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} + {{- else if .Values.registry.redis.cache.cluster }} + addr: {{ include "registry.redis.host.addresses" .Values.registry.redis.cache | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} -- GitLab From 19f1a8fa67d4e4884e8beb925ba8363a682addfb Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Wed, 13 Aug 2025 09:30:21 +0200 Subject: [PATCH 14/19] Revert "hit and trial" This reverts commit e1bf7d4c15f8a369a5bd9e6c717e13d7c5ad9947 --- charts/registry/templates/_redis.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 4b484d37b4..80c1b05282 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -86,8 +86,8 @@ redis: sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} {{- end }} {{- end }} - {{- else if .Values.registry.redis.cache.cluster }} - addr: {{ include "registry.redis.host.addresses" .Values.registry.redis.cache | quote }} + {{- else if .Values.redis.cache.cluster }} + addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .redisMergedConfig.sentinels }} addr: {{ include "registry.redis.host.addresses" .redisMergedConfig | quote }} mainname: {{ template "gitlab.redis.host" . }} -- GitLab From 898872d061d1fd1193e28fc0a2f937aeec4a85f8 Mon Sep 17 00:00:00 2001 From: pgauba Date: Wed, 13 Aug 2025 17:16:32 +0200 Subject: [PATCH 15/19] added test for registry redis cache --- spec/configuration/registry_spec.rb | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/configuration/registry_spec.rb b/spec/configuration/registry_spec.rb index 0b59c2f2ef..e08a6b66c4 100644 --- a/spec/configuration/registry_spec.rb +++ b/spec/configuration/registry_spec.rb @@ -1441,6 +1441,36 @@ describe 'registry configuration' do end end + context 'when customer provides a registry redis cache cluster configuration' do + let(:values) do + YAML.safe_load(%( + registry: + database: + enabled: true + redis: + cache: + enabled: true + cluster: + - host: redis1.cache-cluster.example.com + port: 16379 + - host: redis2.cache-cluster.example.com + )).deep_merge(default_values) + end + + it 'populates the registry redis cache settings with the list of host:port' do + t = HelmTemplate.new(values) + expect(t.exit_code).to eq(0), "Unexpected error code #{t.exit_code} -- #{t.stderr}" + expect(t.dig('ConfigMap/test-registry', 'data', 'config.yml.tpl')).to include( + <<~CONFIG + redis: + cache: + enabled: true + addr: "redis1.cache-cluster.example.com:16379,redis2.cache-cluster.example.com:6379" + CONFIG + ) + end + end + context 'when customer provides a redis rate-limiting cluster configuration in presense of global sentinels' do let(:values) do YAML.safe_load(%( -- GitLab From 0fcd73cb9705f0249fbedcc9e6096f35d7427690 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 18 Aug 2025 11:43:38 +0200 Subject: [PATCH 16/19] adding redis cache test case wrt global sentinels --- spec/configuration/registry_spec.rb | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/spec/configuration/registry_spec.rb b/spec/configuration/registry_spec.rb index e08a6b66c4..d02c6647d3 100644 --- a/spec/configuration/registry_spec.rb +++ b/spec/configuration/registry_spec.rb @@ -1507,6 +1507,42 @@ describe 'registry configuration' do end end + context 'when customer provides a registry redis cache cluster configuration in presense of global sentinels' do + let(:values) do + YAML.safe_load(%( + global: + redis: + host: redis.example.com + sentinels: + - host: global1.example.com + port: 26379 + - host: global2.example.com + port: 26379 + registry: + redis: + cache: + enabled: true + cluster: + - host: redis1.cache-cluster.example.com + port: 16379 + - host: redis2.cache-cluster.example.com + )).deep_merge(default_values) + end + + it 'populates the registry redis cache cluster settings with the local cluster host:port instead of global.redis.sentinels' do + t = HelmTemplate.new(values) + expect(t.exit_code).to eq(0), "Unexpected error code #{t.exit_code} -- #{t.stderr}" + expect(t.dig('ConfigMap/test-registry', 'data', 'config.yml.tpl')).to include( + <<~CONFIG + redis: + cache: + enabled: true + addr: "redis1.cache-cluster.example.com:16379,redis2.cache-cluster.example.com:6379" + CONFIG + ) + end + end + context 'when customer provides a custom redis rate-limiter and cache configuration' do let(:values) do YAML.safe_load(%( -- GitLab From c00a4fc727dd9238e56cbde5758549bf9cfffd75 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Mon, 18 Aug 2025 12:02:18 +0200 Subject: [PATCH 17/19] setting database enabled to true --- spec/configuration/registry_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/configuration/registry_spec.rb b/spec/configuration/registry_spec.rb index d02c6647d3..f27f44ade7 100644 --- a/spec/configuration/registry_spec.rb +++ b/spec/configuration/registry_spec.rb @@ -1519,6 +1519,8 @@ describe 'registry configuration' do - host: global2.example.com port: 26379 registry: + database: + enabled: true redis: cache: enabled: true -- GitLab From d1fabbdbcb33adfe15552a6ed5e9b36b13782876 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Wed, 20 Aug 2025 22:26:26 +0200 Subject: [PATCH 18/19] fixing whitespace indentation --- charts/registry/templates/_redis.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/registry/templates/_redis.tpl b/charts/registry/templates/_redis.tpl index 80c1b05282..6fe1224a62 100644 --- a/charts/registry/templates/_redis.tpl +++ b/charts/registry/templates/_redis.tpl @@ -81,11 +81,11 @@ redis: {{- if .Values.redis.cache.sentinels }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} mainname: {{ .Values.redis.cache.host }} - {{- if .Values.redis.cache.sentinelpassword }} - {{- if .Values.redis.cache.sentinelpassword.enabled }} + {{- if .Values.redis.cache.sentinelpassword }} + {{- if .Values.redis.cache.sentinelpassword.enabled }} sentinelpassword: {% file.Read "/config/redis-sentinel/redis-sentinel-password" | strings.TrimSpace | data.ToJSON %} + {{- end }} {{- end }} - {{- end }} {{- else if .Values.redis.cache.cluster }} addr: {{ include "registry.redis.host.addresses" .Values.redis.cache | quote }} {{- else if .redisMergedConfig.sentinels }} -- GitLab From e083a96713a5df13dd74b3ff99d8c71806ece065 Mon Sep 17 00:00:00 2001 From: Pravar Gauba Date: Thu, 21 Aug 2025 16:15:34 +0200 Subject: [PATCH 19/19] Add cluster support for Registry Redis cache As we aim to point the registry service to use the redis-cluster-registry cluster instead of the redis-registry-cache sentinel, we need to upgrade the redis helm chart. Currently, GitLab doesn't support redis.cache.cluster under Registry and only supports redis.cache.sentinels. This MR adds redis.cache.cluster support. Changelog: added --- doc/charts/registry/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/charts/registry/_index.md b/doc/charts/registry/_index.md index d14cbef3f0..0d0dd4fcd6 100644 --- a/doc/charts/registry/_index.md +++ b/doc/charts/registry/_index.md @@ -288,8 +288,10 @@ If you chose to deploy this chart as a standalone, remove the `registry` at the | `redis.cache.enabled` | `false` | When set to `true`, the Redis cache is enabled. This feature is dependent on the [metadata database](#database) being enabled. Repository metadata will be cached on the configured Redis instance. | | `redis.cache.host` | `` | The hostname of the Redis instance. If empty, the value will be filled as `global.redis.host:global.redis.port`. | | `redis.cache.port` | `6379` | The port of the Redis instance. | +| `redis.cache.cluster` | `[]` | List of addresses with host and port. | | `redis.cache.sentinels` | `[]` | List sentinels with host and port. | | `redis.cache.mainname` | | The main server name. Only applicable for Sentinel. | +| `redis.cache.username` | | The username used to connect to the Redis instance. | | `redis.cache.password.enabled` | `false` | Indicates whether the Redis cache used by the Registry is password protected. | | `redis.cache.password.secret` | `gitlab-redis-secret` | Name of the secret containing the Redis password. This will be automatically created if not provided, when the `shared-secrets` feature is enabled. | | `redis.cache.password.key` | `redis-password` | Secret key in which the Redis password is stored. | @@ -1209,7 +1211,7 @@ redis: #### Cluster -The `redis.rateLimiting.cluster` property is a list of hosts and ports +The `redis.cache.cluster` property is a list of hosts and ports to connect to a Redis cluster. For example: ```yaml -- GitLab