mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
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:
3 files changed
+11
-1
No files matched your search
@@ -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")"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user