From 66a5130b8807886945c72759047623e10889ed30 Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Wed, 4 Oct 2023 09:10:57 +0200 Subject: [PATCH 1/2] fix(httpd) remove all mocks from packaged chart Signed-off-by: Damien Duportal --- charts/httpd/.helmignore | 1 + charts/httpd/Chart.yaml | 6 +++++- charts/httpd/templates/_helpers.tpl | 12 ++++++------ charts/httpd/templates/mocks/_helpers.tpl | 3 --- charts/httpd/tests/parent_values_test.yaml | 1 + 5 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 charts/httpd/templates/mocks/_helpers.tpl diff --git a/charts/httpd/.helmignore b/charts/httpd/.helmignore index 50af03172..f85b0ee22 100644 --- a/charts/httpd/.helmignore +++ b/charts/httpd/.helmignore @@ -20,3 +20,4 @@ .idea/ *.tmproj .vscode/ +tests/ diff --git a/charts/httpd/Chart.yaml b/charts/httpd/Chart.yaml index 465a4641c..f6c0055a4 100644 --- a/charts/httpd/Chart.yaml +++ b/charts/httpd/Chart.yaml @@ -1,4 +1,8 @@ apiVersion: v1 description: httpd helm chart for Kubernetes name: httpd -version: 0.2.0 +version: 0.2.1 +appVersion: v2.4 +maintainers: +- email: jenkins-infra-team@googlegroups.com + name: jenkins-infra-team diff --git a/charts/httpd/templates/_helpers.tpl b/charts/httpd/templates/_helpers.tpl index bae9e3421..d50a5de6d 100644 --- a/charts/httpd/templates/_helpers.tpl +++ b/charts/httpd/templates/_helpers.tpl @@ -49,14 +49,14 @@ Data directory volume definition. Might be defined from parent chart templates o based on the presence of the global value provided by the parent chart. */}} {{- define "httpd.html-volume" -}} -{{- if (dig "global" "storage" "enabled" false .Values.AsMap) -}} +{{- if and (dig "global" "storage" "enabled" false .Values.AsMap) .Values.global.storage.claimNameTpl -}} persistentVolumeClaim: - claimName: {{ include "mirrorbits-parent.pvc-name" . }} -{{- else }} - {{- if or .Values.repository.persistentVolumeClaim.enabled .Values.repository.reuseExistingPersistentVolumeClaim }} + claimName: {{ printf "%s" (tpl .Values.global.storage.claimNameTpl $) | trim | trunc 63 }} +{{- else -}} + {{- if or .Values.repository.persistentVolumeClaim.enabled .Values.repository.reuseExistingPersistentVolumeClaim -}} persistentVolumeClaim: - claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "httpd.fullname" .)) }} - {{- else }} + claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "httpd.fullname" .)) -}} + {{- else -}} emptyDir: {} {{- end -}} {{- end -}} diff --git a/charts/httpd/templates/mocks/_helpers.tpl b/charts/httpd/templates/mocks/_helpers.tpl deleted file mode 100644 index a1a914914..000000000 --- a/charts/httpd/templates/mocks/_helpers.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- define "mirrorbits-parent.pvc-name" -}} -parent-chart-shared-data -{{- end -}} diff --git a/charts/httpd/tests/parent_values_test.yaml b/charts/httpd/tests/parent_values_test.yaml index 1cc6c2e48..82d1d5fab 100644 --- a/charts/httpd/tests/parent_values_test.yaml +++ b/charts/httpd/tests/parent_values_test.yaml @@ -10,6 +10,7 @@ set: global: storage: enabled: true + claimNameTpl: '{{ default "parent-chart-shared-data" }}' ingress: enabled: true # Try to specify a ingress which must be ignored (parent prevails) From be2bf9345ee4235632c2d7101dec9e50556aeaec Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Wed, 4 Oct 2023 09:15:17 +0200 Subject: [PATCH 2/2] fix(mirrorbits-lite) remove all mocks from packaged chart Signed-off-by: Damien Duportal --- charts/mirrorbits-lite/.helmignore | 2 +- charts/mirrorbits-lite/Chart.yaml | 2 +- charts/mirrorbits-lite/templates/_helpers.tpl | 10 +++++----- charts/mirrorbits-lite/templates/mocks/_helpers.tpl | 3 --- charts/mirrorbits-lite/tests/parent_values_test.yaml | 1 + 5 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 charts/mirrorbits-lite/templates/mocks/_helpers.tpl diff --git a/charts/mirrorbits-lite/.helmignore b/charts/mirrorbits-lite/.helmignore index c8d198264..f85b0ee22 100644 --- a/charts/mirrorbits-lite/.helmignore +++ b/charts/mirrorbits-lite/.helmignore @@ -20,4 +20,4 @@ .idea/ *.tmproj .vscode/ -tests/* +tests/ diff --git a/charts/mirrorbits-lite/Chart.yaml b/charts/mirrorbits-lite/Chart.yaml index 016112aee..4e3579aae 100644 --- a/charts/mirrorbits-lite/Chart.yaml +++ b/charts/mirrorbits-lite/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Mirrobits lite helm chart for Kubernetes name: mirrorbits-lite -version: 0.3.0 +version: 0.3.1 appVersion: "v0.5.1" maintainers: - email: jenkins-infra-team@googlegroups.com diff --git a/charts/mirrorbits-lite/templates/_helpers.tpl b/charts/mirrorbits-lite/templates/_helpers.tpl index 2f52e4dfe..9028c8c83 100644 --- a/charts/mirrorbits-lite/templates/_helpers.tpl +++ b/charts/mirrorbits-lite/templates/_helpers.tpl @@ -49,14 +49,14 @@ Data directory volume definition. Might be defined from parent chart templates o based on the presence of the global value provided by the parent chart. */}} {{- define "mirrorbits-lite.data-volume" -}} -{{- if (dig "global" "storage" "enabled" false .Values.AsMap) -}} +{{- if and (dig "global" "storage" "enabled" false .Values.AsMap) .Values.global.storage.claimNameTpl -}} persistentVolumeClaim: - claimName: {{ include "mirrorbits-parent.pvc-name" . }} -{{- else }} - {{- if .Values.repository.persistentVolumeClaim.enabled }} + claimName: {{ printf "%s" (tpl .Values.global.storage.claimNameTpl $) | trim | trunc 63 }} +{{- else -}} + {{- if .Values.repository.persistentVolumeClaim.enabled -}} persistentVolumeClaim: claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "mirrorbits-lite.fullname" .)) }} - {{- else }} + {{- else -}} emptyDir: {} {{- end -}} {{- end -}} diff --git a/charts/mirrorbits-lite/templates/mocks/_helpers.tpl b/charts/mirrorbits-lite/templates/mocks/_helpers.tpl deleted file mode 100644 index a1a914914..000000000 --- a/charts/mirrorbits-lite/templates/mocks/_helpers.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- define "mirrorbits-parent.pvc-name" -}} -parent-chart-shared-data -{{- end -}} diff --git a/charts/mirrorbits-lite/tests/parent_values_test.yaml b/charts/mirrorbits-lite/tests/parent_values_test.yaml index 6e4f64f50..713f79f8c 100644 --- a/charts/mirrorbits-lite/tests/parent_values_test.yaml +++ b/charts/mirrorbits-lite/tests/parent_values_test.yaml @@ -10,6 +10,7 @@ set: global: storage: enabled: true + claimNameTpl: '{{ default "parent-chart-shared-data" }}' ingress: enabled: true # Try to specify a ingress which must be ignored (parent prevails)