diff --git a/charts/account-operator/charts/account-operator-crds-0.1.5.tgz b/charts/account-operator/charts/account-operator-crds-0.1.5.tgz index 5bc836f77..31246dd97 100644 Binary files a/charts/account-operator/charts/account-operator-crds-0.1.5.tgz and b/charts/account-operator/charts/account-operator-crds-0.1.5.tgz differ diff --git a/charts/account-operator/charts/common-0.1.5.tgz b/charts/account-operator/charts/common-0.1.5.tgz index adfb5dc05..82793969a 100644 Binary files a/charts/account-operator/charts/common-0.1.5.tgz and b/charts/account-operator/charts/common-0.1.5.tgz differ diff --git a/charts/common/templates/_getKeyLookup.tpl b/charts/common/templates/_getKeyLookup.tpl index 76c6e670e..c9efddacb 100644 --- a/charts/common/templates/_getKeyLookup.tpl +++ b/charts/common/templates/_getKeyLookup.tpl @@ -1,34 +1,20 @@ {{/* Function: common.getKeyValue Description: - Retrieves a value from the Helm chart's values.yaml file based on a prioritized key lookup. - The function searches for a value in the following order: - 1. An override key (`keyPathOverride`). - 2. A global key (`global.keyPath`). - 3. A default key (`defaults.keyPath`). - If none of these keys exist, it returns an empty string. + Retrieves a value from values.yaml by checking keys in this order: + 1. Override key, 2. Global key, 3. Default key. Returns an empty string if none exist. Parameters: - - .key: The path to the key being retrieved. - - .Values: The values object passed to the Helm template. - - Dependencies: - - Uses helper functions "common.hasNestedKey" and "common.getNestedValue" to check - the existence of nested keys and retrieve their values. - - Usage: - This function is intended to prioritize overrides and global configurations - in a Helm chart's values.yaml file while providing default fallback values. - + - .key: Key path to lookup. + - .Values: Values object. */}} - {{- define "common.getKeyValue" -}} {{- $keyPath := .key -}} {{- $values := .Values -}} {{- $overrideKey := printf "%sOverride" $keyPath -}} {{- $globalKey := printf "global.%s" $keyPath -}} - {{- $defaultKey := printf "defaults.%s" $keyPath -}} + {{- $defaultKey := printf "common.defaults.%s" $keyPath -}} {{- $value := "" -}} {{- if eq (include "common.hasNestedKey" (dict "Values" $values "key" $overrideKey)) "true" }} diff --git a/charts/common/templates/_imagePullSecret.tpl b/charts/common/templates/_imagePullSecret.tpl index 2fc24575b..777a55c07 100644 --- a/charts/common/templates/_imagePullSecret.tpl +++ b/charts/common/templates/_imagePullSecret.tpl @@ -1,6 +1,4 @@ {{- define "common.imagePullSecret" }} -{{- if or .Values.imagePullSecret ((.Values).global).imagePullSecret }} imagePullSecrets: - - name: {{ default .Values.imagePullSecret (.Values.global).imagePullSecret }} -{{- end }} + - name: {{ include "common.certManagerEnabled" (dict "Values" .Values "key" "imagePullSecret") }} {{- end -}} \ No newline at end of file diff --git a/charts/common/test-chart/charts/common-0.1.5.tgz b/charts/common/test-chart/charts/common-0.1.5.tgz index 4fde5fdda..fc510bb30 100644 Binary files a/charts/common/test-chart/charts/common-0.1.5.tgz and b/charts/common/test-chart/charts/common-0.1.5.tgz differ diff --git a/charts/common/test-chart/tests/hasNestedKey_test.yaml b/charts/common/test-chart/tests/hasNestedKey_test.yaml index dea275a02..c72521a1d 100644 --- a/charts/common/test-chart/tests/hasNestedKey_test.yaml +++ b/charts/common/test-chart/tests/hasNestedKey_test.yaml @@ -11,11 +11,11 @@ tests: - it: nested key found in defaults template: testHasNestedKey.yaml set: - inputKey: "defaults.certManager.enabled" + inputKey: "certManager.enabled" asserts: - equal: path: spec.check - value: true + value: false - it: key Override configured template: testHasNestedKey.yaml set: diff --git a/charts/common/test-chart/values.yaml b/charts/common/test-chart/values.yaml index c8de6edc7..e69de29bb 100644 --- a/charts/common/test-chart/values.yaml +++ b/charts/common/test-chart/values.yaml @@ -1,3 +0,0 @@ -defaults: - certManager: - enabled: false \ No newline at end of file diff --git a/charts/common/values.yaml b/charts/common/values.yaml index e69de29bb..fbd99a763 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -0,0 +1,4 @@ +defaults: + certManager: + enabled: false + imagePullSecret: "github" \ No newline at end of file diff --git a/charts/extension-manager-operator/charts/common-0.1.5.tgz b/charts/extension-manager-operator/charts/common-0.1.5.tgz index 3df4bde58..3501f7bbd 100644 Binary files a/charts/extension-manager-operator/charts/common-0.1.5.tgz and b/charts/extension-manager-operator/charts/common-0.1.5.tgz differ diff --git a/charts/extension-manager-operator/charts/extension-manager-operator-crds-0.1.3.tgz b/charts/extension-manager-operator/charts/extension-manager-operator-crds-0.1.3.tgz index f3a40e9fc..688cd06a4 100644 Binary files a/charts/extension-manager-operator/charts/extension-manager-operator-crds-0.1.3.tgz and b/charts/extension-manager-operator/charts/extension-manager-operator-crds-0.1.3.tgz differ diff --git a/charts/extension-manager-operator/tests/__snapshot__/deployment_test.yaml.snap b/charts/extension-manager-operator/tests/__snapshot__/deployment_test.yaml.snap index b57a1ec8b..158879b53 100644 --- a/charts/extension-manager-operator/tests/__snapshot__/deployment_test.yaml.snap +++ b/charts/extension-manager-operator/tests/__snapshot__/deployment_test.yaml.snap @@ -132,6 +132,8 @@ operator match the snapshot: terminationGracePeriodSeconds: 10 4: | apiVersion: v1 + imagePullSecrets: + - name: github kind: ServiceAccount metadata: name: extension-manager-operator diff --git a/charts/extension-manager-operator/tests/deployment_test.yaml b/charts/extension-manager-operator/tests/deployment_test.yaml index acaa6d748..142d1625c 100644 --- a/charts/extension-manager-operator/tests/deployment_test.yaml +++ b/charts/extension-manager-operator/tests/deployment_test.yaml @@ -79,10 +79,10 @@ tests: - equal: path: spec.template.spec.containers[0].imagePullPolicy value: IfNotPresent - - it: configure imagePullSecret + - it: override imagePullSecret template: service-account.yaml set: - imagePullSecret: my-secret + imagePullSecretOverride: my-secret asserts: - equal: path: imagePullSecrets diff --git a/charts/portal/charts/common-0.1.5.tgz b/charts/portal/charts/common-0.1.5.tgz index 2ff700514..0aac5fc4a 100644 Binary files a/charts/portal/charts/common-0.1.5.tgz and b/charts/portal/charts/common-0.1.5.tgz differ