From f8e807d9ef44ab39c5427e10c4dbc2a9edb9a7d6 Mon Sep 17 00:00:00 2001 From: Julien Gardet Date: Thu, 2 Nov 2023 07:22:45 +0000 Subject: [PATCH 1/4] Update gitaly charts to manage labels for persistence volume --- .../gitlab/charts/gitaly/templates/_statefulset_spec.yaml | 7 +++++++ charts/gitlab/charts/gitaly/values.yaml | 1 + doc/charts/gitlab/gitaly/index.md | 1 + 3 files changed, 9 insertions(+) diff --git a/charts/gitlab/charts/gitaly/templates/_statefulset_spec.yaml b/charts/gitlab/charts/gitaly/templates/_statefulset_spec.yaml index 984b19a5e7..7e33b351a4 100644 --- a/charts/gitlab/charts/gitaly/templates/_statefulset_spec.yaml +++ b/charts/gitlab/charts/gitaly/templates/_statefulset_spec.yaml @@ -262,6 +262,7 @@ spec: {{- $persistence := .Values.persistence.enabled -}} {{- $accessMode := .Values.persistence.accessMode -}} + {{- $labels := .Values.persistence.labels -}} {{- $annotations := .Values.persistence.annotations -}} {{- $size := .Values.persistence.size -}} {{- $storageClass := .Values.persistence.storageClass -}} @@ -274,6 +275,9 @@ spec: {{- if .storage.persistence.accessMode -}} {{- $accessMode = .storage.persistence.accessMode -}} {{- end -}} + {{- if .storage.persistence.labels -}} + {{- $labels = .storage.persistence.labels -}} + {{- end -}} {{- if .storage.persistence.annotations -}} {{- $annotations = .storage.persistence.annotations -}} {{- end -}} @@ -303,6 +307,9 @@ spec: {{- if .storage }} storage: {{ .storage.name }} {{- end }} + {{- range $key, $value := $labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} annotations: {{- range $key, $value := $annotations }} {{ $key }}: {{ $value | quote }} diff --git a/charts/gitlab/charts/gitaly/values.yaml b/charts/gitlab/charts/gitaly/values.yaml index 50bc291a09..ecc782f2b9 100644 --- a/charts/gitlab/charts/gitaly/values.yaml +++ b/charts/gitlab/charts/gitaly/values.yaml @@ -117,6 +117,7 @@ persistence: ## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector matchExpressions: [] annotations: {} + labels: [] resources: # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/doc/charts/gitlab/gitaly/index.md b/doc/charts/gitlab/gitaly/index.md index 6d412a9c99..110d912db4 100644 --- a/doc/charts/gitlab/gitaly/index.md +++ b/doc/charts/gitlab/gitaly/index.md @@ -76,6 +76,7 @@ the `helm install` command using the `--set` flags. | `persistence.accessMode` | `ReadWriteOnce` | Gitaly persistence access mode | | `persistence.annotations` | | Gitaly persistence annotations | | `persistence.enabled` | `true` | Gitaly enable persistence flag | +| `persistance.labels` | | Gitlay persistence labels | | `persistence.matchExpressions` | | Label-expression matches to bind | | `persistence.matchLabels` | | Label-value matches to bind | | `persistence.size` | `50Gi` | Gitaly persistence volume size | -- GitLab From 115e71aa26c1337c1e9e7ff65eb4f0c2987075ad Mon Sep 17 00:00:00 2001 From: Russell Dickenson Date: Mon, 6 Nov 2023 08:12:53 +0000 Subject: [PATCH 2/4] fix typo --- doc/charts/gitlab/gitaly/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/charts/gitlab/gitaly/index.md b/doc/charts/gitlab/gitaly/index.md index 110d912db4..7192de7196 100644 --- a/doc/charts/gitlab/gitaly/index.md +++ b/doc/charts/gitlab/gitaly/index.md @@ -76,7 +76,7 @@ the `helm install` command using the `--set` flags. | `persistence.accessMode` | `ReadWriteOnce` | Gitaly persistence access mode | | `persistence.annotations` | | Gitaly persistence annotations | | `persistence.enabled` | `true` | Gitaly enable persistence flag | -| `persistance.labels` | | Gitlay persistence labels | +| `persistance.labels` | | Gitaly persistence labels | | `persistence.matchExpressions` | | Label-expression matches to bind | | `persistence.matchLabels` | | Label-value matches to bind | | `persistence.size` | `50Gi` | Gitaly persistence volume size | -- GitLab From 6fcc0adc9a2cbaf87ba48327bd1b38f14d9080ad Mon Sep 17 00:00:00 2001 From: Dmytro Makovey Date: Mon, 6 Nov 2023 14:29:27 +0000 Subject: [PATCH 3/4] fix default label from array to object --- charts/gitlab/charts/gitaly/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitlab/charts/gitaly/values.yaml b/charts/gitlab/charts/gitaly/values.yaml index ecc782f2b9..c441f40a55 100644 --- a/charts/gitlab/charts/gitaly/values.yaml +++ b/charts/gitlab/charts/gitaly/values.yaml @@ -117,7 +117,7 @@ persistence: ## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector matchExpressions: [] annotations: {} - labels: [] + labels: {} resources: # We usually recommend not to specify default resources and to leave this as a conscious -- GitLab From 6153741da0fc00ddb28f9573c6daff0eeb496d17 Mon Sep 17 00:00:00 2001 From: Antonin GEORGES Date: Wed, 20 Mar 2024 10:24:22 +0000 Subject: [PATCH 4/4] add value for labels pvc --- spec/configuration/gitaly_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/configuration/gitaly_spec.rb b/spec/configuration/gitaly_spec.rb index 03e9d1b8aa..27a20069f8 100644 --- a/spec/configuration/gitaly_spec.rb +++ b/spec/configuration/gitaly_spec.rb @@ -233,6 +233,9 @@ describe 'Gitaly configuration' do serviceLabels: service: true global: service + persistence: + labels: + foo: global )).deep_merge(default_values) end @@ -248,6 +251,7 @@ describe 'Gitaly configuration' do expect(t.dig('StatefulSet/test-gitaly', 'spec', 'template', 'metadata', 'labels')).to include('pod' => 'true') expect(t.dig('StatefulSet/test-gitaly', 'spec', 'template', 'metadata', 'labels')).to include('global_pod' => 'true') expect(t.dig('StatefulSet/test-gitaly', 'spec', 'volumeClaimTemplates', 0, 'metadata', 'labels')).not_to include('global' => 'gitaly') + expect(t.dig('StatefulSet/test-gitaly', 'spec', 'volumeClaimTemplates', 0, 'metadata', 'labels')).to include('foo' => 'global') expect(t.dig('PodDisruptionBudget/test-gitaly', 'metadata', 'labels')).to include('global' => 'gitaly') expect(t.dig('Service/test-gitaly', 'metadata', 'labels')).to include('global' => 'service') expect(t.dig('Service/test-gitaly', 'metadata', 'labels')).to include('gitaly' => 'gitaly') -- GitLab