From 0fdee55249a77b98244ebdd2caf5446d5445686b Mon Sep 17 00:00:00 2001 From: Graeme Gillies Date: Thu, 4 Mar 2021 12:30:27 +1000 Subject: [PATCH 1/5] Allow `kas` to optionally specify which redis cluster to use configuration from Fixes https://gitlab.com/gitlab-org/charts/gitlab/-/issues/2609 Currently `kas` is hardcoded to use the `sharedState` redis cluster for configuration. This change allow us to instead specify the cluster to use (and pull configuration from) using the value `gitlab.kas.redis.clusterConfig` setting. --- .../unreleased/2609-make-kas-redis-cluster-configurable.yml | 5 +++++ charts/gitlab/charts/kas/templates/_helpers.tpl | 4 ++-- charts/gitlab/charts/kas/values.yaml | 1 + doc/charts/gitlab/kas/index.md | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/2609-make-kas-redis-cluster-configurable.yml diff --git a/changelogs/unreleased/2609-make-kas-redis-cluster-configurable.yml b/changelogs/unreleased/2609-make-kas-redis-cluster-configurable.yml new file mode 100644 index 0000000000..17f5e3d82c --- /dev/null +++ b/changelogs/unreleased/2609-make-kas-redis-cluster-configurable.yml @@ -0,0 +1,5 @@ +--- +title: Allow kas to utilise different redis clusters outside of `sharedState` +merge_request: 1876 +author: +type: added diff --git a/charts/gitlab/charts/kas/templates/_helpers.tpl b/charts/gitlab/charts/kas/templates/_helpers.tpl index 754da5d4c3..19f70f1cd7 100644 --- a/charts/gitlab/charts/kas/templates/_helpers.tpl +++ b/charts/gitlab/charts/kas/templates/_helpers.tpl @@ -18,8 +18,8 @@ Build Redis config for KAS */}} {{- define "kas.redis" -}} {{- if .Values.redis.enabled -}} -{{- if .Values.global.redis.sharedState -}} -{{- $_ := set $ "redisConfigName" "sharedState" -}} +{{- if get .Values.global.redis .Values.redis.clusterConfig -}} +{{- $_ := set $ "redisConfigName" .Values.redis.clusterConfig -}} {{- end -}} {{- include "gitlab.redis.selectedMergedConfig" . -}} {{- if .redisMergedConfig.password.enabled -}} diff --git a/charts/gitlab/charts/kas/values.yaml b/charts/gitlab/charts/kas/values.yaml index 90600fc105..9ce82131c7 100644 --- a/charts/gitlab/charts/kas/values.yaml +++ b/charts/gitlab/charts/kas/values.yaml @@ -68,6 +68,7 @@ securityContext: fsGroup: 65532 redis: enabled: true + clusterConfig: sharedState networkpolicy: enabled: false diff --git a/doc/charts/gitlab/kas/index.md b/doc/charts/gitlab/kas/index.md index f7b83ef8af..eb46110520 100644 --- a/doc/charts/gitlab/kas/index.md +++ b/doc/charts/gitlab/kas/index.md @@ -59,6 +59,7 @@ the `helm install` command using the `--set` flags. | `serviceLabels` | `{}` | Supplemental service labels | | `common.labels` | | Supplemental labels that are applied to all objects created by this chart. | | `redis.enabled` | `true` | Allows opting-out of using Redis for KAS features. Warnings: Redis will become a hard dependency soon, so this key is already deprecated. | +| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS | | `resources.requests.cpu` | `75m` | GitLab Exporter minimum CPU | | `resources.requests.memory` | `100M` | GitLab Exporter minimum memory | | `service.externalPort` | `8150` | External port (for agentk connections) | -- GitLab From 29ea92dfe4a98d0e741a10e071f2d924fc052b3f Mon Sep 17 00:00:00 2001 From: Graeme Gillies Date: Thu, 4 Mar 2021 22:57:23 +0000 Subject: [PATCH 2/5] Apply 1 suggestion(s) to 1 file(s) --- charts/gitlab/charts/kas/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitlab/charts/kas/templates/_helpers.tpl b/charts/gitlab/charts/kas/templates/_helpers.tpl index 19f70f1cd7..acb9c900f6 100644 --- a/charts/gitlab/charts/kas/templates/_helpers.tpl +++ b/charts/gitlab/charts/kas/templates/_helpers.tpl @@ -18,7 +18,7 @@ Build Redis config for KAS */}} {{- define "kas.redis" -}} {{- if .Values.redis.enabled -}} -{{- if get .Values.global.redis .Values.redis.clusterConfig -}} +{{- if hasKey .Values.global.redis .Values.redis.clusterConfig -}} {{- $_ := set $ "redisConfigName" .Values.redis.clusterConfig -}} {{- end -}} {{- include "gitlab.redis.selectedMergedConfig" . -}} -- GitLab From 4fb384ca9cf0a970f9b9436fd7336b4193140530 Mon Sep 17 00:00:00 2001 From: Graeme Gillies Date: Thu, 18 Mar 2021 13:44:00 +1000 Subject: [PATCH 3/5] Update kas `redis.clusterConfig` to better define what happens in case of being set to a cluster that doesn't exist in the configuration. --- doc/charts/gitlab/kas/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/charts/gitlab/kas/index.md b/doc/charts/gitlab/kas/index.md index eb46110520..f4da3f07d9 100644 --- a/doc/charts/gitlab/kas/index.md +++ b/doc/charts/gitlab/kas/index.md @@ -59,7 +59,7 @@ the `helm install` command using the `--set` flags. | `serviceLabels` | `{}` | Supplemental service labels | | `common.labels` | | Supplemental labels that are applied to all objects created by this chart. | | `redis.enabled` | `true` | Allows opting-out of using Redis for KAS features. Warnings: Redis will become a hard dependency soon, so this key is already deprecated. | -| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS | +| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS. If unset it defaults Redis cluster `sharedState` | | `resources.requests.cpu` | `75m` | GitLab Exporter minimum CPU | | `resources.requests.memory` | `100M` | GitLab Exporter minimum memory | | `service.externalPort` | `8150` | External port (for agentk connections) | -- GitLab From 05ad3da280e2292a3f48acafa80c1e42ce2dd5c5 Mon Sep 17 00:00:00 2001 From: Graeme Gillies Date: Tue, 23 Mar 2021 13:43:02 +1000 Subject: [PATCH 4/5] Update documentation for kas setting `redis.clusterConfig` to be very explicit in how it works. Thanks to @alexand for the assistance! --- doc/charts/gitlab/kas/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/charts/gitlab/kas/index.md b/doc/charts/gitlab/kas/index.md index f4da3f07d9..facfecfdff 100644 --- a/doc/charts/gitlab/kas/index.md +++ b/doc/charts/gitlab/kas/index.md @@ -59,7 +59,7 @@ the `helm install` command using the `--set` flags. | `serviceLabels` | `{}` | Supplemental service labels | | `common.labels` | | Supplemental labels that are applied to all objects created by this chart. | | `redis.enabled` | `true` | Allows opting-out of using Redis for KAS features. Warnings: Redis will become a hard dependency soon, so this key is already deprecated. | -| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS. If unset it defaults Redis cluster `sharedState` | +| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS. If `global.redis.sharedState` or any other `clusterConfig` you're using is not undefined, then it will fallback to the primary `global.redis` configuration. See [Multiple Redis Support](https://docs.gitlab.com/charts/charts/globals#multiple-redis-support) if you want to have KAS using a separate Redis instance. | | `resources.requests.cpu` | `75m` | GitLab Exporter minimum CPU | | `resources.requests.memory` | `100M` | GitLab Exporter minimum memory | | `service.externalPort` | `8150` | External port (for agentk connections) | -- GitLab From 392d82c292f0d3a9576ffe3d866f4f4dde8d1357 Mon Sep 17 00:00:00 2001 From: Graeme Gillies Date: Tue, 23 Mar 2021 15:05:16 +1000 Subject: [PATCH 5/5] Update doc link to be relative as per `vale` linting error. --- doc/charts/gitlab/kas/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/charts/gitlab/kas/index.md b/doc/charts/gitlab/kas/index.md index facfecfdff..8119520195 100644 --- a/doc/charts/gitlab/kas/index.md +++ b/doc/charts/gitlab/kas/index.md @@ -59,7 +59,7 @@ the `helm install` command using the `--set` flags. | `serviceLabels` | `{}` | Supplemental service labels | | `common.labels` | | Supplemental labels that are applied to all objects created by this chart. | | `redis.enabled` | `true` | Allows opting-out of using Redis for KAS features. Warnings: Redis will become a hard dependency soon, so this key is already deprecated. | -| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS. If `global.redis.sharedState` or any other `clusterConfig` you're using is not undefined, then it will fallback to the primary `global.redis` configuration. See [Multiple Redis Support](https://docs.gitlab.com/charts/charts/globals#multiple-redis-support) if you want to have KAS using a separate Redis instance. | +| `redis.clusterConfig` | `sharedState` | The Redis cluster configuration to pull from `global.redis` to use for KAS. If `global.redis.sharedState` or any other `clusterConfig` you're using is not undefined, then it will fallback to the primary `global.redis` configuration. See [Multiple Redis Support](../../globals.md#multiple-redis-support) if you want to have KAS using a separate Redis instance. | | `resources.requests.cpu` | `75m` | GitLab Exporter minimum CPU | | `resources.requests.memory` | `100M` | GitLab Exporter minimum memory | | `service.externalPort` | `8150` | External port (for agentk connections) | -- GitLab