diff --git a/Makefile b/Makefile index 332c302..41c26d5 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,10 @@ doc/diff: ## Check documentation 'charts/helm_lib/README.md' was rebuilt only .PHONY: ci/tests/install-plugin ci/tests/unit/install-plugin: ## Install unittest plugin locally - helm plugin list | grep -q unittest || helm plugin install --version $(UNITTEST_VERSION) https://github.com/helm-unittest/helm-unittest + @helm plugin list 2>/dev/null | grep -q "unittest.*$(UNITTEST_VERSION)" || { \ + helm plugin uninstall unittest 2>/dev/null || true; \ + helm plugin install --version $(UNITTEST_VERSION) https://github.com/helm-unittest/helm-unittest; \ + } .PHONY: ci/tests/unit ci/tests/unit: ## Run unittest locally diff --git a/charts/helm_lib/Chart.yaml b/charts/helm_lib/Chart.yaml index 2283e0f..63615b3 100644 --- a/charts/helm_lib/Chart.yaml +++ b/charts/helm_lib/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 type: library name: deckhouse_lib_helm -version: 1.72.3 +version: 1.72.4 description: "Helm utils template definitions for Deckhouse modules." diff --git a/charts/helm_lib/templates/_csi_controller.tpl b/charts/helm_lib/templates/_csi_controller.tpl index 0721e5f..487aa09 100644 --- a/charts/helm_lib/templates/_csi_controller.tpl +++ b/charts/helm_lib/templates/_csi_controller.tpl @@ -8,7 +8,12 @@ {{- $registryBase := $context.Values.global.modulesImages.registry.base }} {{- /* Try to get from storage foundation module if enabled */}} {{- if $context.Values.global.enabledModules | has "storage-foundation" }} + {{- $sfRegistryHost := dig "registry" "base" "" (default dict $context.Values.storageFoundation) }} + {{- if $sfRegistryHost }} + {{- $registryBase = join "/" (list $sfRegistryHost "modules" "storage-foundation" ) }} + {{- else }} {{- $registryBase = join "/" (list $registryBase "modules" "storage-foundation" ) }} + {{- end }} {{- $storageFoundationDigests := index $context.Values.global.modulesImages.digests "storageFoundation" | default dict }} {{- $currentMinor := int $kubernetesSemVer.Minor }} {{- $kubernetesMajor := int $kubernetesSemVer.Major }} diff --git a/tests/templates/helm_lib_csi_image_with_common_fallback.yaml b/tests/templates/helm_lib_csi_image_with_common_fallback.yaml index dc031e6..afc005d 100644 --- a/tests/templates/helm_lib_csi_image_with_common_fallback.yaml +++ b/tests/templates/helm_lib_csi_image_with_common_fallback.yaml @@ -19,3 +19,5 @@ commonNotFound: {{ include "helm_lib_csi_image_with_common_fallback" (list . "cs otherModulesEnabled: {{ include "helm_lib_csi_image_with_common_fallback" (list . "csiExternalProvisioner" (semver "1.25.0")) }} --- emptyStorageFoundationDigests: {{ include "helm_lib_csi_image_with_common_fallback" (list . "csiExternalProvisioner" (semver "1.25.0")) }} +--- +storageFoundationCustomRegistry: {{ include "helm_lib_csi_image_with_common_fallback" (list . "csiExternalProvisioner" (semver "1.25.0")) }} diff --git a/tests/tests/helm_lib_csi_image_with_common_fallback_test.yaml b/tests/tests/helm_lib_csi_image_with_common_fallback_test.yaml index c597f35..7e6c6b4 100644 --- a/tests/tests/helm_lib_csi_image_with_common_fallback_test.yaml +++ b/tests/tests/helm_lib_csi_image_with_common_fallback_test.yaml @@ -208,3 +208,25 @@ tests: path: "emptyStorageFoundationDigests" value: null + - it: should use storageFoundation registry base when explicitly set + documentIndex: 11 + set: + global: + enabledModules: + - storage-foundation + modulesImages: + registry: + base: "registry.deckhouse.io/deckhouse/ce" + digests: + storageFoundation: + csiExternalProvisionerForK8SGE125: "sha256:sf-provisioner-125" + common: + csiExternalProvisioner125: "sha256:common-provisioner-125" + storageFoundation: + registry: + base: "registry.example.com/deckhouse" + asserts: + - equal: + path: "storageFoundationCustomRegistry" + value: "registry.example.com/deckhouse/modules/storage-foundation@sha256:sf-provisioner-125" +