From 46474b14acf3fd74025235a146aa0c9affb0f77f Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Thu, 11 Feb 2021 22:54:08 +1300 Subject: [PATCH 1/5] Add option to disable redis in KAS config file --- .../gitlab/charts/kas/templates/_helpers.tpl | 4 +++- .../charts/kas/templates/deployment.yaml | 2 ++ charts/gitlab/charts/kas/values.yaml | 8 ++------ spec/configuration/kas_spec.rb | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/charts/gitlab/charts/kas/templates/_helpers.tpl b/charts/gitlab/charts/kas/templates/_helpers.tpl index 48aeff9573..a2bbe52cf6 100644 --- a/charts/gitlab/charts/kas/templates/_helpers.tpl +++ b/charts/gitlab/charts/kas/templates/_helpers.tpl @@ -17,6 +17,7 @@ if there is a shared tls secret for all ingresses. Build Redis config for KAS */}} {{- define "kas.redis" -}} +{{- if .Values.redis.enabled -}} {{- if .Values.global.redis.sharedState -}} {{- $_ := set $ "redisConfigName" "sharedState" -}} {{- end -}} @@ -33,4 +34,5 @@ sentinel: {{ end }} master_name: {{ template "gitlab.redis.host" . }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} +{{- end -}} diff --git a/charts/gitlab/charts/kas/templates/deployment.yaml b/charts/gitlab/charts/kas/templates/deployment.yaml index b165b84cd4..e0b268c648 100644 --- a/charts/gitlab/charts/kas/templates/deployment.yaml +++ b/charts/gitlab/charts/kas/templates/deployment.yaml @@ -88,5 +88,7 @@ spec: items: - key: {{ template "gitlab.kas.key" . }} path: .gitlab_kas_secret + {{- if .Values.redis.enabled -}} {{- include "gitlab.redis.secrets" . | nindent 12 }} + {{- end }} {{- end }} diff --git a/charts/gitlab/charts/kas/values.yaml b/charts/gitlab/charts/kas/values.yaml index 9ad54ea805..1ad7da7643 100644 --- a/charts/gitlab/charts/kas/values.yaml +++ b/charts/gitlab/charts/kas/values.yaml @@ -61,9 +61,5 @@ securityContext: runAsGroup: 65532 fsGroup: 65532 redis: -# sentinel: -# addresses: - # - localhost:6661 # required -# server: -# address: "localhost:6379" - password: {} \ No newline at end of file + enabled: true + password: {} diff --git a/spec/configuration/kas_spec.rb b/spec/configuration/kas_spec.rb index d10e293e39..e4d8ca7aa9 100644 --- a/spec/configuration/kas_spec.rb +++ b/spec/configuration/kas_spec.rb @@ -214,6 +214,24 @@ describe 'kas configuration' do } end + context 'when redis is disabled' do + let(:kas_values) do + default_kas_values.deep_merge!( + { + 'gitlab' => { + 'kas' => { + 'redis' => { 'enabled' => false } + } + } + } + ) + end + + it 'does not have redis config' do + expect(config_yaml_data['redis']).to eq(nil) + end + end + context 'when redisConfigName is empty' do context 'when no sentinel is setup' do it 'takes the global redis config' do -- GitLab From 604f2c99dc7e24d19f801dd39b232f869eaed861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cunha?= Date: Thu, 11 Feb 2021 12:48:23 +0100 Subject: [PATCH 2/5] Adds changelog file --- changelogs/unreleased/kas_redis_enable_option.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/kas_redis_enable_option.yml diff --git a/changelogs/unreleased/kas_redis_enable_option.yml b/changelogs/unreleased/kas_redis_enable_option.yml new file mode 100644 index 0000000000..39642746b7 --- /dev/null +++ b/changelogs/unreleased/kas_redis_enable_option.yml @@ -0,0 +1,5 @@ +--- +title: Adds ability to disable Redis specially for KAS +merge_request: 1838 +author: +type: added -- GitLab From 15585075ad94e435763a0ebbbc7f97963e8218b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Alexandre=20Cunha?= Date: Thu, 11 Feb 2021 15:37:42 +0000 Subject: [PATCH 3/5] Improves changelog title --- changelogs/unreleased/kas_redis_enable_option.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/unreleased/kas_redis_enable_option.yml b/changelogs/unreleased/kas_redis_enable_option.yml index 39642746b7..b302f146db 100644 --- a/changelogs/unreleased/kas_redis_enable_option.yml +++ b/changelogs/unreleased/kas_redis_enable_option.yml @@ -1,5 +1,5 @@ --- -title: Adds ability to disable Redis specially for KAS +title: KAS: Add ability to disable Redis merge_request: 1838 author: type: added -- GitLab From 29b8590612167e10a414a4b9e952274767e4f247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Alexandre=20Cunha?= Date: Thu, 11 Feb 2021 15:47:11 +0000 Subject: [PATCH 4/5] Remove redis password comment suggestion from KAS values --- charts/gitlab/charts/kas/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/gitlab/charts/kas/values.yaml b/charts/gitlab/charts/kas/values.yaml index 1ad7da7643..a7bd69cc90 100644 --- a/charts/gitlab/charts/kas/values.yaml +++ b/charts/gitlab/charts/kas/values.yaml @@ -62,4 +62,3 @@ securityContext: fsGroup: 65532 redis: enabled: true - password: {} -- GitLab From 6956a196762437ee402c447f7905be03486b3a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Alexandre=20Cunha?= Date: Thu, 11 Feb 2021 16:32:01 +0000 Subject: [PATCH 5/5] Update docs and fix changelog --- changelogs/unreleased/kas_redis_enable_option.yml | 2 +- doc/charts/gitlab/kas/index.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelogs/unreleased/kas_redis_enable_option.yml b/changelogs/unreleased/kas_redis_enable_option.yml index b302f146db..e0724a9492 100644 --- a/changelogs/unreleased/kas_redis_enable_option.yml +++ b/changelogs/unreleased/kas_redis_enable_option.yml @@ -1,5 +1,5 @@ --- -title: KAS: Add ability to disable Redis +title: "KAS: Add ability to disable Redis" merge_request: 1838 author: type: added diff --git a/doc/charts/gitlab/kas/index.md b/doc/charts/gitlab/kas/index.md index 618e973df8..122cf3c2c8 100644 --- a/doc/charts/gitlab/kas/index.md +++ b/doc/charts/gitlab/kas/index.md @@ -57,6 +57,7 @@ the `helm install` command using the `--set` flags. | `podLabels` | `{}` | Supplemental Pod labels. Not used for selectors. | | `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 depenency soon, so this key is already deprecated. | | `resources.requests.cpu` | `75m` | GitLab Exporter minimum CPU | | `resources.requests.memory` | `100M` | GitLab Exporter minimum memory | | `service.externalPort` | `8150` | External port | -- GitLab