Skip to content

Commit 80a6eb7

Browse files
committed
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 and both pins carry a digest. 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]>
1 parent 72bb4f3 commit 80a6eb7

5 files changed

Lines changed: 64 additions & 1 deletion

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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, and
14+
# that both pins carry a digest.
15+
16+
load test_helper
17+
18+
REPO_ROOT="$(cd "$(dirname "${BATS_TEST_FILENAME:-$0}")/.." && pwd)"
19+
20+
DIGEST_RE='@sha256:[0-9a-f]{64}$'
21+
22+
@test "the Proxmox CSI controller and node plugin pin the vendored chart's release by digest" {
23+
chart="$REPO_ROOT/packages/system/proxmox-csi/charts/proxmox-csi-plugin/Chart.yaml"
24+
values="$REPO_ROOT/packages/system/proxmox-csi/values.yaml"
25+
tagfile="$REPO_ROOT/packages/apps/kubernetes/images/proxmox-csi-controller.tag"
26+
27+
app_version=$(yq -r '.appVersion' "$chart")
28+
node_tag=$(yq -r '."proxmox-csi-plugin".node.plugin.image.tag' "$values")
29+
controller_ref=$(tr -d '[:space:]' < "$tagfile")
30+
31+
[ -n "$app_version" ] && [ "$app_version" != null ] || {
32+
echo "no appVersion in $chart" >&2
33+
return 1
34+
}
35+
36+
printf '%s\n' "$node_tag" | grep -Eq "^${app_version//./\\.}${DIGEST_RE}" || {
37+
echo "node plugin tag '$node_tag' is not the chart appVersion $app_version with a digest" >&2
38+
echo "set proxmox-csi-plugin.node.plugin.image.tag in packages/system/proxmox-csi/values.yaml" >&2
39+
return 1
40+
}
41+
42+
printf '%s\n' "$controller_ref" | grep -Eq "^ghcr\.io/sergelogvinov/proxmox-csi-controller:${app_version//./\\.}${DIGEST_RE}" || {
43+
echo "controller ref '$controller_ref' is not proxmox-csi-controller:$app_version with a digest" >&2
44+
echo "update packages/apps/kubernetes/images/proxmox-csi-controller.tag" >&2
45+
return 1
46+
}
47+
}
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/apps/kubernetes/tests/substrate_proxmox_addons_test.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ tests:
120120
- equal:
121121
path: spec.template.spec.containers[?(@.name=="csi-resizer")].args[3]
122122
value: "--kubeconfig=/etc/kubernetes/kubeconfig/super-admin.svc"
123+
# Same registry as the CCM, whose v0.15.0 tag was re-pushed under it.
124+
- matchRegex:
125+
path: spec.template.spec.containers[?(@.name=="csi-driver")].image
126+
pattern: '^ghcr\.io/sergelogvinov/proxmox-csi-controller:v[0-9]+\.[0-9]+\.[0-9]+@sha256:[0-9a-f]{64}$'
123127

124128
- it: runs the cloud-controller-manager here too
125129
template: templates/ccm-proxmox/controller.yaml

‎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)