From 49725a376d9fc36d9c85002e7caa0d7d1bd00f5f Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Mon, 16 Nov 2026 12:34:24 -0500 Subject: [PATCH] fix(linstor): refuse blockstor images from different releases The controller, apiserver and satellite speak one wire protocol and share the CRDs fetched for the controller's tag. Pinning one of them to another release rendered and passed every test, and broke only on a cluster, so the chart now fails the render instead. Assisted-by: LLM Signed-off-by: Andrei Kvapil --- .../linstor/templates/backend-guard.yaml | 15 ++++++++ .../system/linstor/tests/backend_test.yaml | 34 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/packages/system/linstor/templates/backend-guard.yaml b/packages/system/linstor/templates/backend-guard.yaml index 0089c96ae..75f1dc98e 100644 --- a/packages/system/linstor/templates/backend-guard.yaml +++ b/packages/system/linstor/templates/backend-guard.yaml @@ -7,3 +7,18 @@ any other way, a hand-set component value for one, is checked here too. {{- if not (has .Values.backend (list "linstor" "blockstor")) }} {{- fail (printf "linstor: backend must be \"linstor\" or \"blockstor\", got %q" (toString .Values.backend)) }} {{- end }} +{{- /* +blockstor's three images are one release: the controller, apiserver and +satellite share a wire protocol and the CRDs under definitions/, which +`make update-blockstor-crds` fetches for the controller's tag. Pinning one +of them to another release still renders, and only fails on a cluster. +*/ -}} +{{- if eq .Values.backend "blockstor" }} +{{- $versions := dict }} +{{- range $component := list "blockstorController" "blockstorApiserver" "blockstorSatellite" }} +{{- $_ := set $versions $component (index $.Values $component "image" "tag" | toString | splitList "@" | first) }} +{{- end }} +{{- if ne 1 (values $versions | uniq | len) }} +{{- fail (printf "linstor: the blockstor images must share one release, got controller %q, apiserver %q, satellite %q" $versions.blockstorController $versions.blockstorApiserver $versions.blockstorSatellite) }} +{{- end }} +{{- end }} diff --git a/packages/system/linstor/tests/backend_test.yaml b/packages/system/linstor/tests/backend_test.yaml index b535edd81..0377aa544 100644 --- a/packages/system/linstor/tests/backend_test.yaml +++ b/packages/system/linstor/tests/backend_test.yaml @@ -149,6 +149,40 @@ tests: - hasDocuments: count: 0 + - it: fails the render when one blockstor image is pinned to another release + templates: + - templates/backend-guard.yaml + set: + backend: blockstor + blockstorController.image.tag: 0.2.1@sha256:0000000000000000000000000000000000000000000000000000000000000000 + blockstorApiserver.image.tag: 9.9.9@sha256:0000000000000000000000000000000000000000000000000000000000000000 + blockstorSatellite.image.tag: 9.9.9@sha256:0000000000000000000000000000000000000000000000000000000000000000 + asserts: + - failedTemplate: + errorMessage: 'linstor: the blockstor images must share one release, got controller "0.2.1", apiserver "9.9.9", satellite "9.9.9"' + + # Each component image has its own digest; only the release tag is shared. + - it: accepts blockstor images of one release with distinct digests + templates: + - templates/backend-guard.yaml + set: + backend: blockstor + blockstorController.image.tag: 0.3.0@sha256:1111111111111111111111111111111111111111111111111111111111111111 + asserts: + - hasDocuments: + count: 0 + + # The LINSTOR backend renders none of these images. + - it: does not check the blockstor image release under the LINSTOR backend + templates: + - templates/backend-guard.yaml + set: + backend: linstor + blockstorController.image.tag: 0.2.1 + asserts: + - hasDocuments: + count: 0 + # drbd-reactor in the piraeus satellite pod reads DRBD state from the kernel, # which is the same under either control plane, so its metrics and the alerts # built on them stay. The controller scrape targets the Java controller, which