fix(linstor): run LINSTOR init containers on the platform server image

piraeus-operator fills in its own default LINSTOR server image for every
container this package leaves unset, and two of those are init
containers: run-migration in the controller pod and
setup-lvm-configuration in the satellite pods. Only the main containers
were pinned to the platform build.

run-migration upgrades the LINSTOR database in place. When the operator
default is newer than the platform build, it migrates the schema ahead
of the controller, the controller then fails to read the migrated
database and crash-loops, and the migration cannot be rolled back. This
stayed hidden while the operator default was older than the version
built here; an operator update that moves the default past it exposes
it during the window between the operator and linstor releases
reconciling.

Pin both init containers to the same image as the main containers, so
the database moves only together with the controller.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-13 11:05:35 +03:00
1 parent f061739ce2
commit 6297ebd708
3 files changed
+49

No files matched your search

@@ -36,6 +36,12 @@ spec:
enabled: true
podTemplate:
spec:
{{- /* run-migration upgrades the database in place: left on the
operator's default image it migrates ahead of the controller,
irreversibly. */}}
initContainers:
- name: run-migration
image: {{ .Values.piraeusServer.image.repository }}:{{ .Values.piraeusServer.image.tag }}
containers:
- name: linstor-controller
image: {{ .Values.piraeusServer.image.repository }}:{{ .Values.piraeusServer.image.tag }}
@@ -11,6 +11,9 @@ spec:
spec:
# host-network is recommended by Piraeus while it is not default in the upstream
hostNetwork: true
initContainers:
- name: setup-lvm-configuration
image: {{ .Values.piraeusServer.image.repository }}:{{ .Values.piraeusServer.image.tag }}
containers:
- name: linstor-satellite
image: {{ .Values.piraeusServer.image.repository }}:{{ .Values.piraeusServer.image.tag }}
@@ -0,0 +1,40 @@
suite: every LINSTOR server container runs the platform image
# piraeus-operator ships its own default for the LINSTOR server image and
# applies it to every container this package leaves unset. The init
# containers matter most: run-migration upgrades the LINSTOR database in
# place, so an operator default newer than the platform build migrates the
# schema ahead of the controller, which then refuses to start, and the
# migration cannot be undone. Pinning them to the same image as the main
# containers makes the database move only together with the controller.
templates:
- templates/cluster.yaml
- templates/satellites-cozy.yaml
set:
piraeusServer:
image:
repository: registry.example/piraeus-server
tag: v0.0.0-test
tests:
- it: the controller migration runs the platform image
template: templates/cluster.yaml
asserts:
- equal:
path: spec.controller.podTemplate.spec.initContainers[?(@.name=="run-migration")].image
value: registry.example/piraeus-server:v0.0.0-test
- equal:
path: spec.controller.podTemplate.spec.containers[?(@.name=="linstor-controller")].image
value: registry.example/piraeus-server:v0.0.0-test
- it: the satellite LVM setup runs the platform image
template: templates/satellites-cozy.yaml
asserts:
- equal:
path: spec.podTemplate.spec.initContainers[?(@.name=="setup-lvm-configuration")].image
value: registry.example/piraeus-server:v0.0.0-test
- equal:
path: spec.podTemplate.spec.containers[?(@.name=="linstor-satellite")].image
value: registry.example/piraeus-server:v0.0.0-test