From 112aa1ca16adb20934fde4385a5a601ef8033c61 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Thu, 12 Nov 2026 10:25:42 -0500 Subject: [PATCH] fix(linstor): give the blockstor controller and apiserver 21s to stop Their REST servers hold a shutdown window derived from the detached rollback budget, and blockstor v0.2.0 sets the pods' grace to 21s so a SIGTERM does not kill a compensation mid-cascade. Assisted-by: LLM Signed-off-by: Andrei Kvapil --- .../templates/blockstor-apiserver.yaml | 5 +++++ .../templates/blockstor-controller.yaml | 5 +++++ .../tests/blockstor_workloads_test.yaml | 22 +++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/packages/system/linstor/templates/blockstor-apiserver.yaml b/packages/system/linstor/templates/blockstor-apiserver.yaml index ae873432f..db908d8ea 100644 --- a/packages/system/linstor/templates/blockstor-apiserver.yaml +++ b/packages/system/linstor/templates/blockstor-apiserver.yaml @@ -112,6 +112,11 @@ spec: app.kubernetes.io/component: blockstor-apiserver spec: serviceAccountName: blockstor-apiserver + {{- /* + The REST server's graceful-shutdown window is derived from its + detached rollback budget; this has to outlive it, or a SIGTERM kills + a compensation mid-cascade. */}} + terminationGracePeriodSeconds: 21 topologySpreadConstraints: - maxSkew: 1 topologyKey: kubernetes.io/hostname diff --git a/packages/system/linstor/templates/blockstor-controller.yaml b/packages/system/linstor/templates/blockstor-controller.yaml index 6c77ee912..2f8871d26 100644 --- a/packages/system/linstor/templates/blockstor-controller.yaml +++ b/packages/system/linstor/templates/blockstor-controller.yaml @@ -131,6 +131,11 @@ spec: app.kubernetes.io/component: blockstor-controller spec: serviceAccountName: blockstor-controller + {{- /* + The REST server's graceful-shutdown window is derived from its + detached rollback budget; this has to outlive it, or a SIGTERM kills + a compensation mid-cascade. */}} + terminationGracePeriodSeconds: 21 containers: - name: manager image: {{ .Values.blockstorController.image.repository }}:{{ .Values.blockstorController.image.tag }} diff --git a/packages/system/linstor/tests/blockstor_workloads_test.yaml b/packages/system/linstor/tests/blockstor_workloads_test.yaml index 5395afeec..c4dafa2ba 100644 --- a/packages/system/linstor/tests/blockstor_workloads_test.yaml +++ b/packages/system/linstor/tests/blockstor_workloads_test.yaml @@ -340,3 +340,25 @@ tests: - matchRegex: path: spec.template.metadata.annotations["checksum/drbd-conf"] pattern: '^[0-9a-f]{64}$' + + # A SIGTERM must not cut a detached rollback short: the pod outlives the + # REST server's shutdown window. + - it: gives the controller time to finish a rollback on shutdown + template: templates/blockstor-controller.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.terminationGracePeriodSeconds + value: 21 + + - it: gives the apiserver time to finish a rollback on shutdown + template: templates/blockstor-apiserver.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.terminationGracePeriodSeconds + value: 21