From 7ebbbd18a0b4e8ec383feccc4cb69f9d07a86b24 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Sat, 21 Nov 2026 23:36:32 +0100 Subject: [PATCH] fix(linstor): drop the CPU limit of the blockstor components With a 500m CPU limit the blockstor controller and every satellite sat at the limit through a burst of volume creates, and idle satellites were throttled in most CPU periods, so each reconcile pass and each create stretched to tens of seconds. The LINSTOR components blockstor replaces run without a CPU limit; the satellite now takes the LINSTOR satellite's requests and memory limit, and the controller and apiserver keep their memory limits. The resources become values so a cluster can size them without patching the chart. Assisted-by: LLM Signed-off-by: Andrei Kvapil --- .../templates/blockstor-apiserver.yaml | 6 +- .../templates/blockstor-controller.yaml | 6 +- .../templates/blockstor-satellite.yaml | 6 +- .../tests/blockstor_workloads_test.yaml | 80 +++++++++++++++++++ packages/system/linstor/values.yaml | 18 +++++ 5 files changed, 107 insertions(+), 9 deletions(-) diff --git a/packages/system/linstor/templates/blockstor-apiserver.yaml b/packages/system/linstor/templates/blockstor-apiserver.yaml index db908d8ea..51c9b960c 100644 --- a/packages/system/linstor/templates/blockstor-apiserver.yaml +++ b/packages/system/linstor/templates/blockstor-apiserver.yaml @@ -166,9 +166,9 @@ spec: allowPrivilegeEscalation: false capabilities: {drop: [ALL]} seccompProfile: {type: RuntimeDefault} - resources: - requests: {cpu: 50m, memory: 128Mi} - limits: {cpu: 500m, memory: 512Mi} + {{- with .Values.blockstorApiserver.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} volumes: - name: api-tls secret: diff --git a/packages/system/linstor/templates/blockstor-controller.yaml b/packages/system/linstor/templates/blockstor-controller.yaml index 2f8871d26..e4a9b1383 100644 --- a/packages/system/linstor/templates/blockstor-controller.yaml +++ b/packages/system/linstor/templates/blockstor-controller.yaml @@ -169,7 +169,7 @@ spec: allowPrivilegeEscalation: false capabilities: {drop: [ALL]} seccompProfile: {type: RuntimeDefault} - resources: - requests: {cpu: 50m, memory: 64Mi} - limits: {cpu: 500m, memory: 256Mi} + {{- with .Values.blockstorController.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} diff --git a/packages/system/linstor/templates/blockstor-satellite.yaml b/packages/system/linstor/templates/blockstor-satellite.yaml index d92b61362..7715f9a3c 100644 --- a/packages/system/linstor/templates/blockstor-satellite.yaml +++ b/packages/system/linstor/templates/blockstor-satellite.yaml @@ -295,9 +295,9 @@ spec: subPath: global_common.conf readOnly: true - {name: stream-tls, mountPath: /etc/blockstor/stream-tls, readOnly: true} - resources: - requests: {cpu: 50m, memory: 64Mi} - limits: {cpu: 500m, memory: 512Mi} + {{- with .Values.blockstorSatellite.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} volumes: - {name: dev, hostPath: {path: /dev, type: Directory}} - {name: modules, hostPath: {path: /lib/modules}} diff --git a/packages/system/linstor/tests/blockstor_workloads_test.yaml b/packages/system/linstor/tests/blockstor_workloads_test.yaml index 50b11cd4d..64e7db822 100644 --- a/packages/system/linstor/tests/blockstor_workloads_test.yaml +++ b/packages/system/linstor/tests/blockstor_workloads_test.yaml @@ -497,3 +497,83 @@ tests: - equal: path: spec.template.spec.terminationGracePeriodSeconds value: 21 + + # A CPU limit throttles the reconcile passes; the LINSTOR components this + # backend replaces run without one. + - it: sets the controller no CPU limit + template: templates/blockstor-controller.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 100m, memory: 64Mi} + limits: {memory: 256Mi} + + - it: sets the apiserver no CPU limit + template: templates/blockstor-apiserver.yaml + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 50m, memory: 128Mi} + limits: {memory: 512Mi} + + - it: sizes the satellite as the LINSTOR satellite, without a CPU limit + template: templates/blockstor-satellite.yaml + documentSelector: + path: kind + value: DaemonSet + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 100m, memory: 128Mi} + limits: {memory: 2Gi} + + - it: merges a satellite resources override over the defaults + template: templates/blockstor-satellite.yaml + documentSelector: + path: kind + value: DaemonSet + set: + blockstorSatellite.resources.limits.cpu: "2" + blockstorSatellite.resources.requests.cpu: 250m + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 250m, memory: 128Mi} + limits: {cpu: "2", memory: 2Gi} + + - it: merges a controller resources override over the defaults + template: templates/blockstor-controller.yaml + documentSelector: + path: kind + value: Deployment + set: + blockstorController.resources.limits.memory: 1Gi + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 100m, memory: 64Mi} + limits: {memory: 1Gi} + + - it: drops a default the apiserver override sets to null + template: templates/blockstor-apiserver.yaml + documentSelector: + path: kind + value: Deployment + set: + blockstorApiserver.resources.limits: null + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: {cpu: 50m, memory: 128Mi} diff --git a/packages/system/linstor/values.yaml b/packages/system/linstor/values.yaml index e85eac749..55b2a9fa0 100644 --- a/packages/system/linstor/values.yaml +++ b/packages/system/linstor/values.yaml @@ -24,18 +24,36 @@ piraeusServer: # Blockstor images are component-versioned: they are released from the # blockstor repository and carry ITS version, so a cozystack release # must not retag them to the cozystack version. +# +# None of the three sets a CPU limit, as the LINSTOR controller and +# satellite do not. CFS throttling under a limit stretches every +# reconcile pass: with 500m the controller and the satellites sat at the +# limit through a burst of volume creates, idle satellites were throttled +# in most CPU periods, and each create took tens of seconds. Memory stays +# limited. A key set here is merged over the default; set it to null to +# drop a default. blockstorController: image: repository: ghcr.io/cozystack/blockstor-controller tag: 0.3.0@sha256:ca5fc964265a1fd9e1153077f0565a9f07532c593bea1182d3b97a38430822ea + resources: + requests: {cpu: 100m, memory: 64Mi} + limits: {memory: 256Mi} blockstorApiserver: image: repository: ghcr.io/cozystack/blockstor-apiserver tag: 0.3.0@sha256:20cf599f8d0ae85a44b237b9d8ad2ca631a1feff3fd387194ef84636b538dd0b + resources: + requests: {cpu: 50m, memory: 128Mi} + limits: {memory: 512Mi} blockstorSatellite: image: repository: ghcr.io/cozystack/blockstor-satellite tag: 0.3.0@sha256:abff381da5425fdf7a6abc0d52006727cf7fe13c438acc79aaea192fc8681cb4 + # The LINSTOR satellite's requests and memory limit. + resources: + requests: {cpu: 100m, memory: 128Mi} + limits: {memory: 2Gi} # How a change to the satellite pod template reaches the nodes. The # satellite turns Ready once its caches have synced, seconds after # start; its first pass over the node's DRBD resources ends later and