fix(capi-providers-core): pull the upgrade hook image through cozy-lib

The hook image was rendered verbatim, so an installation that mirrors
images through the cluster images registry still pulled it from Docker
Hub. Routing it through cozy-lib.image applies the configured registry
like the other system charts do, and leaves the reference unchanged when
none is set.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-16 13:29:50 +03:00
1 parent 40e219c0b6
commit a709ca1bdb
3 files changed
+11 -1

No files matched your search

+9
View File
@@ -47,6 +47,15 @@ setup() {
jq --slurp --exit-status 'length == 2 and all(.[]; .metadata.labels == {"provider.cluster.x-k8s.io/version": .metadata.name})' jq --slurp --exit-status 'length == 2 and all(.[]; .metadata.labels == {"provider.cluster.x-k8s.io/version": .metadata.name})'
} }
@test "the hook image follows the cluster images registry" {
local image mirrored
image="$(yq --no-doc 'select(.kind == "Job") | .spec.template.spec.containers[0].image' "$RENDERED")"
[ "$image" = "$(yq '.upgrade.image' "$CORE/values.yaml")" ]
mirrored="$(helm template capi-providers-core "$CORE" --namespace test-capi --kube-version 1.33.0 --set-string '_cluster.images-registry=registry.example.test' |
yq --no-doc 'select(.kind == "Job") | .spec.template.spec.containers[0].image')"
[ "$mirrored" = "registry.example.test/$image" ]
}
@test "the hook has no cluster-wide or secret permissions" { @test "the hook has no cluster-wide or secret permissions" {
local roles local roles
roles="$(yq --output-format=json --no-doc 'select(.kind == "Role") | .rules' "$RENDERED")" roles="$(yq --output-format=json --no-doc 'select(.kind == "Role") | .rules' "$RENDERED")"
+1
View File
@@ -0,0 +1 @@
../../../library/cozy-lib
@@ -106,7 +106,7 @@ spec:
type: RuntimeDefault type: RuntimeDefault
containers: containers:
- name: upgrade - name: upgrade
image: {{ .Values.upgrade.image | quote }} image: {{ include "cozy-lib.image" (list .Values.upgrade.image $) | quote }}
command: [bash, /scripts/upgrade-providers.sh] command: [bash, /scripts/upgrade-providers.sh]
env: env:
- name: HOME - name: HOME