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 1fb87569..18720c08 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 @@ -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 | 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 }} 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 }} 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 }} 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 -}}