feat(chart): add webhook PDB and anti-affinity for replicas > 1 #32
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #32"
general
weight: 0.35
archlitchi
What type of PR is this?
Enhancement (chart only, no Go code change).
What this PR does / why we need it:
The admission webhook shipped as a single replica with no PodDisruptionBudget, so it is briefly absent during a node drain or a chart upgrade, and with the default
failurePolicy: Ignorea pod requesting GPU sharing in that window is admitted without libvgpu injection, i.e. without vGPU memory isolation. KAI's admission webhook has had a PDB since v0.16.0 and hardcodesfailurePolicy: Fail, and HAMi's scheduler got one in HAMi PR #2773.chart/kai-resource-isolator/templates/webhook-pdb.yaml: apolicy/v1PodDisruptionBudget gated ongt (int .Values.webhook.replicaCount) 1, reusing the Deployment'sapp.kubernetes.io/component: kai-webhookplusselectorLabelsselector.minAvailablecomes from values,maxUnavailabletakes precedence when the key is present (hasKey), the same shape ascharts/hami/templates/scheduler/pdb.yaml.webhook.podDisruptionBudget: {minAvailable: 1}in values,maxUnavailableleft commented sominAvailableapplies unless an operator opts in.preferredDuringSchedulingIgnoredDuringExecutionpod anti-affinity (weight 100,topologyKey: kubernetes.io/hostname, component labelkai-webhook) on the webhook Deployment, gated on the samereplicaCount > 1condition, matching HAMi PR #1934.webhook.replicaCountexplaining that production should run at least 2 replicas withwebhook.podDisruptionBudget, and why both render only whenreplicaCount > 1.Nothing else changes: no new selector or timeout knobs, no leader election, no probe changes, no
NOTES.txtorREADME.mdchanges, no renames of the Deployment, Service or MutatingWebhookConfiguration.Which issue(s) this PR fixes:
Fixes #28
Special notes for your reviewer:
The
failurePolicydefault staysIgnorewith no values comment: Ignore is fail-open, admitting GPU-share pods without libvgpu injection while the webhook is unreachable, and recommendingFailfor production, which KAI hardcodes on its pod mutating and validating webhooks (pkg/operator/operands/admission/resources.go@v0.18.0), is a separate change with its own discussion.Gating on
replicaCount > 1is required, not stylistic: with a single replica a PodDisruptionBudget would block all voluntary node drains, which is why the HAMi scheduler PDB is gated onreplicas > 1too (HAMi adds aleaderElectcondition, with no equivalent here). The anti-affinity ispreferred, neverrequired: HAMi's first attempt withrequireddeadlocked rolling updates on single-node clusters (HAMi issue #1933, fixed by HAMi PR #1934) and would breakhelm upgradehere.Object names are unchanged on purpose: the MutatingWebhookConfiguration
kai-resource-isolator-mutatingand the Deployment and Service (kai-resource-isolator-webhookfor the release name KAI uses) are referenced by KAI'shack/hami/deploy_isolator.shand the KAI e2e. The new PDB reuses thekai-resource-isolator.webhook.fullnamehelper, so it takes the Deployment's name without colliding, being a different kind. This branch also merges cleanly with thegpuShareResourcesremoval branch in either order (verified in a throwaway clone; an earlier revision's 4-linefailurePolicycomment invalues.yamlwas the only conflict).Precedents: KAI PR #1490 (admission PDB, released in KAI v0.16.0, values
admission.podDisruptionBudget, created only whenreplicas > 1), HAMi PR #2773, HAMi PR #1934.Verified on a single-node kind v0.32 cluster on macOS arm64 (Kubernetes v1.36.1, helm v4.2.3,
KUBECONFIG=/tmp/kri-pr04.kubeconfig, no GPU hardware, GPU-less kind reproduction):helm lintandgo test ./...pass all 5 packages; the defaulthelm templateemits 0PodDisruptionBudgetand 0podAntiAffinityand itsdiffagainst the same render frommainis empty, so the default install is byte-identical;--set webhook.replicaCount=2renders the PDB withminAvailable: 1plus the anti-affinity, andwebhook.podDisruptionBudget.maxUnavailable=1rendersmaxUnavailable: 1as the only difference; and on kindhelm install isolator --set image.tag=v1.1.0 --set webhook.replicaCount=2 --waitcompleted the certgen hook jobs, the Deployment shows2/2, the PDB showsMIN AVAILABLE 1 / ALLOWED DISRUPTIONS 1, and the live pod spec carries the anti-affinity.kubectl drain kri-pr04-control-plane --ignore-daemonsets --delete-emptydir-data --timeout=45son the single node made the cordoned Deployment create a second, unschedulable replica, so the PDB reportedcurrentHealthy 1 / desiredHealthy 1 / disruptionsAllowed 0and refused every eviction of the running replica withCannot evict pod as it would violate the pod's disruption budgetuntil the timeout; no webhook pod was evicted (only two coredns pods) and afteruncordonthe Deployment returned to2/2, so nothing wedged. Both replicas land on the one node, so cross-node spread of the anti-affinity could not be exercised. The kind cluster and temporary kubeconfig were deleted afterwards and~/.kube/configwas never touched.Does this PR introduce a user-facing change?:
Yes, but only when
webhook.replicaCount > 1: a PodDisruptionBudget and a preferred pod anti-affinity are then created for the webhook. At the defaultreplicaCount: 1the rendered output is byte-identical tomain, so single-replica installs and upgrades are unaffected. No default value changed.AI Disclosure:
AI assistance was used to review repository context and help draft this change and its description. All changes were manually reviewed, verified locally, and submitted by the author.