Skip to content

fix(helm): preserve zero PDB budgets and validate minAvailable/maxUnavailable - #106

Merged
peterj merged 3 commits into
mainfrom
fix/helm-pdb-validation
Nov 20, 2026
Merged

peterj merged 3 commits into
mainfrom
fix/helm-pdb-validation

Conversation

@dimetron

@dimetron dimetron commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #73 (includes its commit, rebased on main) and combines the best PDB patterns from kagent's own chart and istio.

Design

Concern Source Behaviour
Zero / empty handling kagent kagent-tools.pdb.isSet: null and "" are unset; 0 and percentages are kept
Both or neither set kagent kagent-tools.pdb.validate fails with an actionable message
Default budget kagent maxUnavailable: 1 when enabled (minAvailable: null)
Selector kagent reuses kagent-tools.selectorLabels (cannot drift from the Deployment)
Labels / annotations / unhealthyPodEvictionPolicy kagent optional, rendered via with
Replica guard istio only rendered when replicaCount > 1; a single-replica PDB protects nothing or blocks drains
Skipped-PDB feedback new config is still validated, and NOTES.txt warns when the PDB is skipped

Prior art (CNCF charts)

Chart Keeps 0 Both set Neither set Replica guard
kagent ✅ fail fail ❌
istio ❌ maxUnavailable wins not rendered ✅
argo-cd ✅ maxUnavailable wins minAvailable: 0 ❌
cert-manager ✅ renders both minAvailable: 1 ❌
ingress-nginx ❌ maxUnavailable wins not rendered ✅
kyverno ❌ fail minAvailable: 1 ✅

Testing

make helm-test — 36/36 passing; helm lint clean.

Relates to #73

anthonyhaussman and others added 2 commits November 11, 2026 23:42
Support custom deployment metadata annotations and
configurable PodDisruptionBudget for kagent-tools.

Assisted-by: Gemini 3.7 Flash
Signed-off-by: Anthony Hausman <anthonyhaussmann@gmail.com>
…vailable

Use hasKey so minAvailable/maxUnavailable of 0 are rendered, fail when
both or neither are set, and add unit tests for these cases.

Signed-off-by: Dmytro Rashko <dimetron@me.com>
- Add kagent-tools.pdb.isSet/validate helpers: null and "" are unset,
  0 and percentages are kept; both-set and neither-set fail with
  actionable messages (mirrors kagent's controller PDB).
- Default to maxUnavailable: 1 when enabled.
- Only render the PDB when replicaCount > 1 (istio pattern), still
  validating config, and warn in NOTES when it is skipped.
- Expand unit tests.

Signed-off-by: Dmytro Rashko <dimetron@me.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Deployment annotation and PodDisruptionBudget changes.

No open issues 🎉

What changed in this PR

Building on #73, this PR adds configurable Deployment annotations and PodDisruptionBudget support to the KAgent Tools Helm chart, preserving zero budgets and rejecting conflicting or missing budget settings.

Changes:

  • Adds optional PDB settings with a default maxUnavailable: 1 and selectors shared with the Deployment.
  • Validates enabled PDB configurations even when the replica guard skips creation, and warns users when skipped.
  • Adds Deployment annotations and unit tests for annotations, PDB rendering, zero budgets, and validation.
File Description
helm/​kagent-tools/​values.yaml Defines Deployment annotations and documented PDB defaults.
helm/​kagent-tools/​tests/​pdb_test.yaml Tests PDB rendering, zero budgets, optional metadata, and validation.
helm/​kagent-tools/​tests/​deployment_test.yaml Tests default and custom Deployment annotations.
helm/​kagent-tools/​templates/​pdb.yaml Renders the optional PDB using shared selectors.
helm/​kagent-tools/​templates/​NOTES.txt Warns when the replica guard skips an enabled PDB.
helm/​kagent-tools/​templates/​deployment.yaml Renders optional Deployment-level annotations.
helm/​kagent-tools/​templates/​_helpers.tpl Adds budget-presence, validation, and replica-guard helpers.

Review effort: Balanced

@danielle-mustillo

danielle-mustillo commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

LGTM. One optional UX thought below. Feel free to ignore it and merge as is.

Because values.yaml ships maxUnavailable: 1, a user who sets only minAvailable hits the "mutually exclusive" error and has to also set maxUnavailable: null. Setting only maxUnavailable works, so the extra step only applies to minAvailable.

The main kagent chart, helm/kagent, behaves the same way. It ships maxUnavailable: 1 and runs the same validation for controller.pdb and ui.pdb. Keeping this PR as is, consistent with kagent, is fine. If you'd rather let users set minAvailable alone, one option:

  • default both minAvailable and maxUnavailable to null in values.yaml
  • in the template, fall back to maxUnavailable: 1 when neither is set
  • keep the "both set" failure as is

I tried this locally with helm template and replicaCount: 3:

Case This PR With the change
Neither set ✅ maxUnavailable: 1 ✅ maxUnavailable: 1
Only minAvailable: 2 ❌ fails: user must set maxUnavailable: null ✅ minAvailable: 2
Only maxUnavailable: 2 ✅ maxUnavailable: 2 ✅ maxUnavailable: 2
Both set ❌ fails, clear message ❌ fails, clear message
minAvailable: 0 ✅ minAvailable: 0 ✅ minAvailable: 0

istiod, argo-cd and ingress-nginx also accept either value on its own.

Written by AI, reviewed by me.

Once again this is just a nit. Given most users have access to agents these days, this is a very small item.

@peterj
peterj merged commit b00ae36 into main Nov 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants