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 <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil committed 2026-11-29 13:45:12 +01:00
1 parent 194201d643
commit 49725a376d
2 files changed
+49

No files matched your search

@@ -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 }}
@@ -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