fix(chart): topology-gate single-replica PDBs so single-node installs stay drainable (#560) - #710
Open
shujaatTracebloc wants to merge 3 commits into
Open
fix(chart): topology-gate single-replica PDBs so single-node installs stay drainable (#560)#710shujaatTracebloc wants to merge 3 commits into
shujaatTracebloc wants to merge 3 commits into
Conversation
… drainable (client#560)
jobs-manager-pdb.yaml and mysql-pdb.yaml rendered minAvailable:1
unconditionally. For a 1-replica workload the eviction API then permits
zero voluntary disruptions, so kubectl drain/cordon blocks forever. On a
single-node install that wedges all node maintenance and the pod has
nowhere to reschedule anyway.
Make podDisruptionBudget.{mysql,jobsManager}.create tri-state:
null (default) = AUTO: render on multi-node CSI (hostPath.enabled=false),
skip on single-node/bare-metal (hostPath.enabled=true)
true = force render
false = never render
Preserves the protective PDB on multi-node CSI (deliberate operator drain
of a single-replica stateful DB) while keeping single-node installs
drainable. Bumps Chart.yaml 1.9.39 -> 1.9.40 (chart-version-guard) and
adds helm-unittest coverage for both topologies and the overrides.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shujaatTracebloc
requested review from
LukasWodka and
saadqbal
and removed request for
saadqbal
August 13, 2026 13:57
shujaatTracebloc
marked this pull request as ready for review
August 14, 2026 10:37
# Conflicts: # client/Chart.yaml
…h (client#560) Bugbot (Medium): the AUTO-mode PDB skip keyed only on hostPath.enabled, so a node-local single-node install (env.SINGLE_NODE=true, hostPath.enabled=false, local-path CSI k3d, AGENTS=0) still rendered minAvailable:1 — undrainable on a single node, blocking kubectl drain / k3s upgrade. Gate now mirrors jobs-manager-deployment's SINGLE_NODE resolution (explicit env.SINGLE_NODE wins, else hostPath.enabled), so both single-node topologies skip the PDB while multi-node CSI still renders it. Added node-local + SINGLE_NODE=false regression tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3e7c699. Configure here.
| {{- $env := default dict .Values.env -}} | ||
| {{- $hostPathMode := (default dict .Values.hostPath).enabled | default false -}} | ||
| {{- $isSingleNode := ternary (eq (toString (index $env "SINGLE_NODE")) "true") $hostPathMode (hasKey $env "SINGLE_NODE") -}} | ||
| {{- $create := ternary $pdb.create (not $isSingleNode) (kindIs "bool" $pdb.create) -}} |
There was a problem hiding this comment.
PDB gate misuses SINGLE_NODE flag
Medium Severity
AUTO mode treats env.SINGLE_NODE=true as single-node topology and skips the minAvailable:1 PDBs. That flag only gates GPU-to-CPU fallback and is documented for multi-node NFS/CSI clusters with hostPath.enabled=false. Those clusters lose eviction protection on auto-upgrade even though pods can reschedule.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3e7c699. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
client/templates/jobs-manager-pdb.yamlandclient/templates/mysql-pdb.yamlrenderedminAvailable: 1unconditionally (gated only onpodDisruptionBudget.*.create, defaulttrue). For a single-replica workload,minAvailable: 1means the eviction API permits zero voluntary disruptions (currentHealthy 1 − 1 = 0 < 1), sokubectl drain/cordon blocks forever. On a single-node install this wedges all node maintenance (manual k3s upgrade, node drain), and the pod has nowhere to reschedule anyway.Fix — topology-gated tri-state
createThe chart already distinguishes topologies via
hostPath.enabled(true= single-node/bare-metal installer;false= multi-node CSI: AKS/EKS/OpenShift) — the "storage/topology mode" the issue calls for, and the same signalSINGLE_NODEalready defaults from.podDisruptionBudget.{mysql,jobsManager}.createbecomes tri-state:null(default) = AUTO: render on multi-node CSI (hostPath.enabled=false), skip on single-node/bare-metal (hostPath.enabled=true)true= force render regardless of topologyfalse= never renderRationale for gating (vs
maxUnavailable: 1or a blanket off)On multi-node CSI the PDB is a feature: it blocks a surprise autoscaler scale-down / node upgrade from silently evicting the only mysql/jobs-manager pod, forcing a deliberate operator drain of the single-replica stateful workload. Switching to
maxUnavailable: 1there would make it a no-op, and would also require rewriting the existingminAvailable-asserting unittest. On single-node the same PDB has no upside (nowhere to reschedule) and only wedges drains — so it is skipped. Topology-gating preserves the multi-node protection, keeps single-node drainable, and adds no existing-test rewrites. Default topology is CSI (hostPath.enabled=false), so default behavior is unchanged.Changes
client/templates/jobs-manager-pdb.yaml,client/templates/mysql-pdb.yaml— topology-gated guard;minAvailable: 1retained where it renders.client/values.yaml—create: true→create: nullwith tri-state docs.client/values.schema.json—createtypeboolean→["boolean","null"], defaultnull.client/Chart.yaml—version/appVersion1.9.39→1.9.40(chart-version-guard, lockstep).client/tests/priority_class_pdb_test.yaml— added 7 cases (single-node skip, CSI render, force-on/off overrides); all existing tests kept.Verification
helm lint --strict— green on aks/bm/eks/oc profiles.helm template— renders on all 4; PDB docs: aks/eks/oc = 2, bm = 0.helm unittest— 7 new PDB tests pass; the local 5 failed / 5 errored are a pre-existing helm v4.2.0 schema-message artifact (identical on cleandevelop); CI pins helm-unittest 0.5.2.Closes #560
🤖 Generated with Claude Code
Note
Medium Risk
Changes cluster maintenance behavior for PDBs on single-node vs multi-node topologies; mis-detection could drop drain protection on CSI fleets or reintroduce stuck drains on single-node installs.
Overview
Fixes #560: unconditional
minAvailable: 1PDBs on single-replica mysql and jobs-manager madekubectl drainhang forever on one-node clusters where the pod cannot reschedule.podDisruptionBudget.{mysql,jobsManager}.createis now tri-state (null/true/false), defaultnull(AUTO). In AUTO mode, PDBs render only on multi-node CSI (hostPath.enabled=false, typical AKS/EKS/OpenShift) and are omitted on single-node installs (hostPath.enabled=trueor explicitenv.SINGLE_NODE="true", matching jobs-manager’s SINGLE_NODE resolution).true/falsestill force render or disable regardless of topology. Where they render,minAvailable: 1is unchanged.Defaults move from
create: truetocreate: nullinvalues.yaml; the JSON schema allowsboolean | null. Chart version bumps to 1.9.43. Helm unit tests cover AUTO skip/render,SINGLE_NODEedge cases, and explicit overrides.Reviewed by Cursor Bugbot for commit 3e7c699. Bugbot is set up for automated code reviews on this repo. Configure here.