Skip to content

Commit 8ff6dca

Browse files
themoriartimyasnikovdaniil
authored andcommitted
fix(kubernetes, proxmox-csi): pin the Proxmox CSI driver images by digest
The CSI controller in the management cluster was referenced by the bare tag ghcr.io/sergelogvinov/proxmox-csi-controller:v0.20.0, and the node plugin in the tenant by the vendored chart's default, its appVersion as a bare tag. That registry is the one whose proxmox-cloud-controller- manager:v0.15.0 was re-pushed to a build that panics, so a tag there is not a statement of what runs. Both now carry the v0.20.0 digest: the controller through images/proxmox-csi-controller.tag, like the cloud-controller-manager, and the node plugin through repository and tag in the proxmox-csi values, which also makes it visible to hack/lib/image-refs.sh and therefore to the release multi-arch gate. Both digests are indexes for linux/amd64 and linux/arm64. Pinning takes the version out of the vendored chart's hands: a chart bump would bring a new appVersion while both pins kept naming the old release, and the controller and the node plugin would drift apart from the templates and from each other without anything noticing. hack/proxmox-csi-driver-pin_test.bats fails unless the chart's appVersion and both pins name the same release. The sig-storage sidecars stay on tags, as they do for the KubeVirt CSI driver: registry.k8s.io publishes them through image promotion, which does not overwrite a tag. Assisted-by: LLM Signed-off-by: Marian Koreniuk <[email protected]> (cherry picked from commit 780b068) Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
1 parent faa9d3c commit 8ff6dca

4 files changed

Lines changed: 57 additions & 1 deletion

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bats
2+
# Upstream releases the Proxmox CSI controller and node plugin together, and
3+
# its chart renders both from one appVersion. Here they run in two places and
4+
# are pinned in two packages: the controller in the management cluster
5+
# (packages/apps/kubernetes, an images/.tag file) and the node plugin in the
6+
# tenant (packages/system/proxmox-csi, a values override on the vendored
7+
# chart). Both are pinned by digest because tags in that registry have been
8+
# re-pushed, and the pin is what takes the version out of the chart's hands:
9+
# `make update` with a new CHART_VERSION brings new templates and a new
10+
# appVersion while both pins keep naming the old build, and nothing else
11+
# notices.
12+
#
13+
# This asserts the chart's appVersion and both pins name the same release.
14+
15+
load test_helper
16+
17+
REPO_ROOT="$(cd "$(dirname "${BATS_TEST_FILENAME:-$0}")/.." && pwd)"
18+
19+
@test "the Proxmox CSI controller and node plugin pin the vendored chart's release" {
20+
chart="$REPO_ROOT/packages/system/proxmox-csi/charts/proxmox-csi-plugin/Chart.yaml"
21+
values="$REPO_ROOT/packages/system/proxmox-csi/values.yaml"
22+
tagfile="$REPO_ROOT/packages/apps/kubernetes/images/proxmox-csi-controller.tag"
23+
24+
app_version=$(yq -r '.appVersion' "$chart")
25+
node_tag=$(yq -r '."proxmox-csi-plugin".node.plugin.image.tag' "$values")
26+
controller_ref=$(tr -d '[:space:]' < "$tagfile")
27+
28+
[ -n "$app_version" ] && [ "$app_version" != null ] || {
29+
echo "no appVersion in $chart" >&2
30+
return 1
31+
}
32+
33+
[ "${node_tag%%@*}" = "$app_version" ] || {
34+
echo "node plugin tag '$node_tag' is not the chart appVersion $app_version" >&2
35+
echo "set proxmox-csi-plugin.node.plugin.image.tag in packages/system/proxmox-csi/values.yaml" >&2
36+
return 1
37+
}
38+
39+
[ "${controller_ref%%@*}" = "ghcr.io/sergelogvinov/proxmox-csi-controller:$app_version" ] || {
40+
echo "controller ref '$controller_ref' is not proxmox-csi-controller:$app_version" >&2
41+
echo "update packages/apps/kubernetes/images/proxmox-csi-controller.tag" >&2
42+
return 1
43+
}
44+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ghcr.io/sergelogvinov/proxmox-csi-controller:v0.20.0@sha256:95ef74cce03e89a1706d9b32888a84bf44e0db439c4fe2a4334ce123728d4c3b

‎packages/apps/kubernetes/templates/csi-proxmox/controller.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ spec:
112112
readOnlyRootFilesystem: true
113113
containers:
114114
- name: csi-driver
115-
image: ghcr.io/sergelogvinov/proxmox-csi-controller:v0.20.0
115+
image: "{{ $.Files.Get "images/proxmox-csi-controller.tag" | trim }}"
116116
args:
117117
- "-v=4"
118118
- "--csi-address=unix:///csi/csi.sock"

‎packages/system/proxmox-csi/values.yaml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,14 @@ proxmox-csi-plugin:
3333
node:
3434
tolerations:
3535
- operator: Exists
36+
plugin:
37+
# The chart's default is its appVersion as a bare tag, and tags in this
38+
# registry have been re-pushed. The digest is the pin; the version must
39+
# stay the chart's appVersion and the one in the kubernetes chart's
40+
# images/proxmox-csi-controller.tag, since node and controller are two
41+
# halves of one driver release (hack/proxmox-csi-driver-pin_test.bats).
42+
# The repository repeats the chart default so that hack/lib/image-refs.sh,
43+
# which does not read under charts/, sees a complete reference here.
44+
image:
45+
repository: ghcr.io/sergelogvinov/proxmox-csi-node
46+
tag: v0.20.0@sha256:e0151137a1c5fa4faea9b4622436b203f1dc246ea37a3a77d09d3855c70aabd1

0 commit comments

Comments
 (0)