mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-23 21:25:44 +09:00
fix(linstor): give linstor-controller a memory limit above its baked-in -Xmx8G
linstor-server bakes `-Xms256M -Xmx8G -XX:+CrashOnOutOfMemoryError` into the generated bin/Controller (build.gradle, jvmControllerOpts), nothing in this chart or in piraeus-entry.sh overrides it, and a JVM handed an explicit -Xmx never reads memory.max. The container was deliberately left with a 700Mi request and no limit at all, which was the safe choice while nothing else supplied one. It stops being safe alongside the system-namespace LimitRange: a container declaring no memory limit is given the configured default, 4Gi, so the process's own heap ceiling would sit at twice its cgroup ceiling and a large enough DRBD resource count would have the kernel kill the storage control plane where the JVM would otherwise have crashed itself loudly at 8G. Stating the limit here is also what keeps the container out of the LimitRange's reach, since a container with its own limit is never defaulted one. 10Gi is the 8G heap plus room for metaspace, code cache, thread stacks and direct buffers. CPU stays unlimited. The helm-unittest assertion that pinned "no limits" is replaced by one pinning the memory limit and the absence of a CPU limit, so neither lowering it below the heap ceiling nor dropping it again passes silently. Assisted-By: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
1 parent
87f79c17c3
commit
ae431808ea
3 files changed
+41
-11
No files matched your search
@@ -40,7 +40,8 @@ spec:
|
||||
- name: linstor-controller
|
||||
image: {{ .Values.piraeusServer.image.repository }}:{{ .Values.piraeusServer.image.tag }}
|
||||
# Guarantee CPU/memory so the JVM keeps answering its /health probe
|
||||
# under node contention. Requests only — see values.yaml controller.*.
|
||||
# under node contention, with a memory ceiling above the -Xmx the image
|
||||
# was built with and no CPU ceiling — see values.yaml controller.*.
|
||||
resources:
|
||||
{{- toYaml .Values.controller.resources | nindent 12 }}
|
||||
# Partial override: piraeus-operator merges podTemplate as a strategic
|
||||
|
||||
@@ -5,8 +5,15 @@ suite: LinstorCluster controller resources and liveness hardening
|
||||
# into the generated linstor-controller Deployment as a strategic merge patch
|
||||
# (containers merged by name, struct fields merged field-by-field), so:
|
||||
# - resources.requests guarantee the JVM gets scheduled CPU/memory so it can
|
||||
# answer GET /health under node CPU contention (no limits: avoid throttling
|
||||
# / OOM-killing the JVM);
|
||||
# answer GET /health under node CPU contention, and CPU stays unlimited to
|
||||
# avoid throttling it;
|
||||
# - resources.limits.memory is stated on purpose and has to stay above the
|
||||
# -Xmx8G baked into the image (build.gradle, jvmControllerOpts), which the
|
||||
# JVM honours without ever reading its cgroup. It is pinned here because two
|
||||
# separate things would silently break it: lowering it below 8G hands the
|
||||
# kernel a process that will grow past it, and removing it hands the
|
||||
# container to the system-namespace LimitRange cozystack-operator maintains,
|
||||
# whose 4Gi default is half that heap ceiling;
|
||||
# - the livenessProbe override carries ONLY the timing fields (timeoutSeconds,
|
||||
# failureThreshold) relaxed from the operator defaults (1s / 3) so a JVM GC
|
||||
# pause or CPU contention does not trip a liveness kill. The httpGet target
|
||||
@@ -17,7 +24,7 @@ templates:
|
||||
- templates/cluster.yaml
|
||||
|
||||
tests:
|
||||
- it: "linstor-controller container carries CPU and memory requests (no limits)"
|
||||
- it: "linstor-controller container carries CPU and memory requests, and a memory limit above the baked-in -Xmx8G"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: LinstorCluster
|
||||
@@ -30,8 +37,13 @@ tests:
|
||||
- equal:
|
||||
path: spec.controller.podTemplate.spec.containers[0].resources.requests.memory
|
||||
value: 700Mi
|
||||
- equal:
|
||||
path: spec.controller.podTemplate.spec.containers[0].resources.limits.memory
|
||||
value: 10Gi
|
||||
# CPU stays unlimited: the memory ceiling is what the JVM forces, throttling
|
||||
# the controller's event loop is not.
|
||||
- notExists:
|
||||
path: spec.controller.podTemplate.spec.containers[0].resources.limits
|
||||
path: spec.controller.podTemplate.spec.containers[0].resources.limits.cpu
|
||||
|
||||
- it: "linstor-controller liveness probe relaxes timing but leaves httpGet to the operator"
|
||||
asserts:
|
||||
|
||||
@@ -101,16 +101,33 @@ linstorCSI:
|
||||
repository: ghcr.io/cozystack/cozystack/linstor-csi
|
||||
tag: v1.6.0@sha256:ae854423de62e94fb89b59d92c20da8939196e643e83b2d60d9f6915d5b0e55c
|
||||
controller:
|
||||
# Resource requests for the linstor-controller JVM. Requests (not limits) are
|
||||
# set on purpose: a CPU request guarantees CPU shares so the JVM can answer its
|
||||
# GET /health liveness probe under node CPU contention, while omitting limits
|
||||
# avoids throttling the JVM (CPU limit) or OOM-killing it (memory limit). The
|
||||
# memory value is a conservative starting estimate for the JVM heap + overhead;
|
||||
# tune it to observed RSS.
|
||||
# Resources for the linstor-controller JVM. The CPU request guarantees CPU
|
||||
# shares so the JVM can answer its GET /health liveness probe under node CPU
|
||||
# contention, and CPU is still deliberately left unlimited so a GC pause or a
|
||||
# burst of DRBD events is not throttled. The memory request is a conservative
|
||||
# starting estimate for the JVM heap + overhead; tune it to observed RSS.
|
||||
#
|
||||
# The memory limit is stated rather than omitted, and it has to stay above the
|
||||
# heap ceiling the image was built with. linstor-server bakes
|
||||
# `-Xms256M -Xmx8G -XX:+CrashOnOutOfMemoryError` into the generated
|
||||
# bin/Controller (build.gradle, jvmControllerOpts), nothing in this chart or in
|
||||
# piraeus-entry.sh overrides it, and a JVM given an explicit -Xmx never consults
|
||||
# its cgroup. So the process will grow to 8G of heap whatever memory.max says,
|
||||
# and a ceiling below that turns "the JVM crashes itself on OOM, having said so"
|
||||
# into "the kernel kills the storage control plane mid-operation". 10Gi is 8G of
|
||||
# heap plus room for metaspace, code cache, thread stacks and direct buffers.
|
||||
#
|
||||
# Leaving it unset is no longer the safer option it once was: cozystack-operator
|
||||
# maintains a LimitRange in every system namespace defaulting container memory
|
||||
# (cozystackOperator.systemNamespaceMemoryLimit, 4Gi by default), and a container
|
||||
# that declares no limit of its own is given that one — half this JVM's own heap
|
||||
# ceiling. Declaring the limit here is what keeps that default away from it.
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 700Mi
|
||||
limits:
|
||||
memory: 10Gi
|
||||
# Liveness-probe timing for the linstor-controller container. Only these timing
|
||||
# fields are overridden; the httpGet target (GET /health on the api port) is
|
||||
# supplied by piraeus-operator and intentionally left untouched. Relaxed from
|
||||
|
||||
Reference in new issue
Block a user