From 65e0e81fa14141e1e02155bbe76ba4276fc54a75 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 18 Sep 2023 18:25:45 +0200 Subject: [PATCH 1/6] remove now unused templates --- .../templates/_helpers-search.tpl | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 charts/alfresco-common/templates/_helpers-search.tpl diff --git a/charts/alfresco-common/templates/_helpers-search.tpl b/charts/alfresco-common/templates/_helpers-search.tpl deleted file mode 100644 index 7f24d8b5..00000000 --- a/charts/alfresco-common/templates/_helpers-search.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{{/* -Get Alfresco Solr context -*/}} -{{- define "alfresco-search.baseurl" -}} -{{- if index $.Values "alfresco-search" "enabled" -}} - /solr -{{- else -}} - {{ index $.Values "alfresco-search" "external" "context" | default "/solr" -}} -{{- end -}} -{{- end -}} - -{{/* -Required Solr secret -*/}} -{{- define "tracking-shared-secret" -}} - {{- required "You need to provide a shared secret for Solr/repo authentication , see https://github.com/Alfresco/acs-deployment/tree/master/docs/helm" .Values.global.tracking.sharedsecret -}} -{{- end }} From b4326d5854ae9493278dd1b5eaa59d3959feafc2 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 18 Sep 2023 18:29:31 +0200 Subject: [PATCH 2/6] cleanup alfresco-common --- charts/alfresco-common/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/alfresco-common/README.md b/charts/alfresco-common/README.md index 1fb87569..2b213d48 100644 --- a/charts/alfresco-common/README.md +++ b/charts/alfresco-common/README.md @@ -1,6 +1,6 @@ # alfresco-common -![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) +![Version: 3.0.0-alpha.1](https://img.shields.io/badge/Version-3.0.0--alpha.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) A helper subchart to avoid duplication in alfresco charts and set common external dependencies From bdceac3967b2bfabaccdf4c62a951bac17340d0d Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Wed, 20 Sep 2023 10:24:17 +0200 Subject: [PATCH 3/6] read imagePullSecret from chart scope as well - alfresco-common --- .../templates/_helpers-image-pull-secrets.tpl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl b/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl index 457a5cc9..857ae9bc 100644 --- a/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl +++ b/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl @@ -5,9 +5,14 @@ Usage: include "alfresco-common.imagePullSecrets" $ */}} {{- define "alfresco-common.imagePullSecrets" }} -{{- if .Values.global.alfrescoRegistryPullSecrets }} imagePullSecrets: - - name: {{ .Values.global.alfrescoRegistryPullSecrets }} +{{- with .Values }} +{{- range .imagePullSecrets }} + - {{ toYaml . }} +{{- end }} +{{- if .global.alfrescoRegistryPullSecrets }} + - name: {{ .global.alfrescoRegistryPullSecrets }} +{{- end }} {{- end }} {{- end }} From 54ba8ce48a22a13504de7fe3b91bb2041dc147e6 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Wed, 20 Sep 2023 12:35:02 +0200 Subject: [PATCH 4/6] use fq template names - alfresco-common --- charts/alfresco-common/templates/_helpers-security.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/alfresco-common/templates/_helpers-security.tpl b/charts/alfresco-common/templates/_helpers-security.tpl index 129ed559..eee4b4f4 100644 --- a/charts/alfresco-common/templates/_helpers-security.tpl +++ b/charts/alfresco-common/templates/_helpers-security.tpl @@ -44,7 +44,7 @@ Usage: include "alfresco-common.component-pod-security-context" $ {{- if .podSecurityContext }} {{- .podSecurityContext | toYaml | nindent 4 }} {{- else }} -{{- include "default-pod-security-context" . }} +{{- include "alfresco-common.default-pod-security-context" . }} {{- end }} {{- end }} @@ -63,7 +63,7 @@ Usage: include "alfresco-common.component-security-context" $ {{- if .securityContext }} {{- .securityContext | toYaml | nindent 4 }} {{- else }} -{{- include "default-security-context" . }} +{{- include "alfresco-common.default-security-context" . }} {{- end }} {{- end }} From 83f3aa9a3f82be92c215fd1d7622c8d1322bd849 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Wed, 20 Sep 2023 14:54:31 +0200 Subject: [PATCH 5/6] add globing value getter template - alfresco-common --- .../templates/_helpers-utils.tpl | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/charts/alfresco-common/templates/_helpers-utils.tpl b/charts/alfresco-common/templates/_helpers-utils.tpl index 4d6523ac..4deb173b 100644 --- a/charts/alfresco-common/templates/_helpers-utils.tpl +++ b/charts/alfresco-common/templates/_helpers-utils.tpl @@ -88,3 +88,38 @@ Usage: include "alfresco-common.secret-checksum" (dict "ns" "" "configKey" "some {{/* Finaly checksums both concatenated hashes */}} checksum.config.alfresco.org/{{ $.configKey }}: {{- cat $lookedup_cm $lookedup_secret | trim | sha256sum | indent 1 }} {{- end -}} + +{{/* +Gets a value from its path, return empty if not found +Shamelessly inspired from bitnami "common.utils.getValueFromKey" + +Usage: include "alfresco-common.lazy.getValueFromKey" (dict "key" "path.to.key" "context" $) + +*/}} +{{- define "alfresco-common.lazy.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- break }} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" ( default "" $value) -}} +{{- end -}} + +{{/* +Evaluate a value within the chart's context given a path, otherwise fallback to the global context + +Usage: include "alfresco-common.may.glob.value" dict "rootCtx" $ "path" "path.to.key") + +*/}} +{{- define "alfresco-common.may.glob.value" -}} +{{- $chartValues := "" }} +{{- $globalValues := "" }} +{{- $chartValues = include "alfresco-common.utils.getValueFromKey" (dict "key" .path "context" .rootCtx) }} +{{- $globalValues := include "alfresco-common.utils.getValueFromKey" (dict "key" (printf "global.%s" .path) "context" .rootCtx) }} +{{- coalesce $chartValues $globalValues }} +{{- end -}} From 9226c2748aa87d6ad82b3f31e5d0fd0e1d06fb0c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Wed, 20 Sep 2023 14:56:56 +0200 Subject: [PATCH 6/6] bump chart alfresco-comon --- charts/alfresco-common/Chart.lock | 6 +++--- charts/alfresco-common/Chart.yaml | 5 ++--- charts/alfresco-common/README.md | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/charts/alfresco-common/Chart.lock b/charts/alfresco-common/Chart.lock index b859420f..923ac0dd 100644 --- a/charts/alfresco-common/Chart.lock +++ b/charts/alfresco-common/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common - repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ + repository: oci://registry-1.docker.io/bitnamicharts version: 1.17.1 -digest: sha256:f5dd11ccf8726befd217545b84a48b02c49d68f03a75e4e102b971ad2e4f0fec -generated: "2023-08-18T12:43:42.200262+02:00" +digest: sha256:287d0ac4eb057679560ea00b24450c7513276140cc7c16b6db7d57816e8138b3 +generated: "2023-09-20T14:56:20.984441+02:00" diff --git a/charts/alfresco-common/Chart.yaml b/charts/alfresco-common/Chart.yaml index 4333ff8b..89229ce5 100644 --- a/charts/alfresco-common/Chart.yaml +++ b/charts/alfresco-common/Chart.yaml @@ -5,10 +5,9 @@ description: | A helper subchart to avoid duplication in alfresco charts and set common external dependencies type: library -version: 2.1.0 +version: 3.0.0-alpha.1 dependencies: - name: common - repository: >- - https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ + repository: oci://registry-1.docker.io/bitnamicharts version: 1.x.x icon: https://avatars0.githubusercontent.com/u/391127?s=200&v=4 diff --git a/charts/alfresco-common/README.md b/charts/alfresco-common/README.md index 2b213d48..18720c08 100644 --- a/charts/alfresco-common/README.md +++ b/charts/alfresco-common/README.md @@ -11,5 +11,5 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | Repository | Name | Version | |------------|------|---------| -| https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ | common | 1.x.x | +| oci://registry-1.docker.io/bitnamicharts | common | 1.x.x |