Skip to content

feat(chart): add PodDisruptionBudget and topologySpreadConstraints support#5638

Open
bafulton wants to merge 1 commit intoakuity:mainfrom
bafulton:ben/ai/add-pdb-and-topology-spread-constraints
Open

feat(chart): add PodDisruptionBudget and topologySpreadConstraints support#5638
bafulton wants to merge 1 commit intoakuity:mainfrom
bafulton:ben/ai/add-pdb-and-topology-spread-constraints

Conversation

@bafulton
Copy link
Copy Markdown
Contributor

Summary

Adds support for PodDisruptionBudgets and topology spread constraints to enable robust high-availability deployments.

Closes #5396

Changes

  • Add PDB templates for api, webhooksServer, and externalWebhooksServer
  • Add topologySpreadConstraints to deployment templates
  • Add configuration options in values.yaml with sensible defaults
  • Update README with new parameter documentation

Usage Example

api:
  replicas: 2
  podDisruptionBudget:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: topology.kubernetes.io/zone
      whenUnsatisfiable: ScheduleAnyway
      labelSelector:
        matchLabels:
          app.kubernetes.io/component: api

Test Plan

  • helm lint passes
  • Templates render correctly with PDBs enabled
  • Templates render correctly with topologySpreadConstraints configured

@bafulton bafulton requested a review from a team as a code owner January 27, 2026 18:09
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 27, 2026

Deploy Preview for docs-kargo-io canceled.

Name Link
🔨 Latest commit 2f7aef1
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/69bc64044fbd900008f3460c

@krancour
Copy link
Copy Markdown
Member

Note that #5396 was not yet evaluated by any maintainers and remains in a proposal state, as indicated by its labels.

We can take a look at this, but it's going to receive the scrutiny now that it should have received before anyone spent time implementing it.

@hiddeco would you mind having a look at this, but only if you have the bandwidth?

@krancour krancour requested a review from hiddeco January 31, 2026 17:08
@krancour krancour added kind/enhancement An entirely new feature area/chart Affects the Helm chart kind/proposal Indicates maintainers have not yet committed to a feature request needs/priority Priority has not yet been determined; a good signal that maintainers aren't fully committed labels Feb 14, 2026
@krancour krancour self-requested a review February 14, 2026 21:05
@krancour krancour self-assigned this Feb 14, 2026
@krancour krancour added priority/normal This is the priority for most work and removed kind/proposal Indicates maintainers have not yet committed to a feature request needs/priority Priority has not yet been determined; a good signal that maintainers aren't fully committed labels Mar 4, 2026
@krancour krancour added this to the v1.10.0 milestone Mar 4, 2026
Comment on lines +72 to +73
## @param global.topologySpreadConstraints Default topology spread constraints for all Kargo pods.
topologySpreadConstraints: []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

First of all, this PR is very well done. I love it.

This is the one thing I feel pretty hesitant about. Topology spread constraints would need to specify pod selectors and those would, for sure, vary from one component to the next, which I worry might make it impractical to ever have a global default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@krancour, fair callout. I've removed the global default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Feel free to take the branch over if there are other changes you want to make. I just wanted to get the ball rolling!

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.42%. Comparing base (7adeebe) to head (2f7aef1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5638   +/-   ##
=======================================
  Coverage   56.42%   56.42%           
=======================================
  Files         458      458           
  Lines       38370    38370           
=======================================
  Hits        21650    21650           
  Misses      15442    15442           
  Partials     1278     1278           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bafulton bafulton force-pushed the ben/ai/add-pdb-and-topology-spread-constraints branch from c6216b2 to d14e6e1 Compare March 19, 2026 20:44
…pport

Add support for PodDisruptionBudgets and topology spread constraints
to enable robust high-availability deployments.

Changes:
- Add PDB templates for api, webhooksServer, and externalWebhooksServer
- Add topologySpreadConstraints to deployment templates (per-component only,
  no global default since constraints require component-specific selectors)
- Add configuration options in values.yaml with sensible defaults
- Update README with new parameter documentation

For HA deployments, users can now:
- Enable PDBs to ensure availability during voluntary disruptions
- Configure topology spread constraints to distribute pods across zones

Example usage:
```yaml
api:
  replicas: 2
  podDisruptionBudget:
    enabled: true
    minAvailable: 1
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: topology.kubernetes.io/zone
      whenUnsatisfiable: ScheduleAnyway
      labelSelector:
        matchLabels:
          app.kubernetes.io/component: api
```

Closes akuity#5396

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Ben Fulton <ben.fulton@semgrep.com>
@bafulton bafulton force-pushed the ben/ai/add-pdb-and-topology-spread-constraints branch from d14e6e1 to 2f7aef1 Compare March 19, 2026 21:00
@bafulton bafulton requested a review from krancour March 19, 2026 21:06
Comment on lines +22 to +27
{{- with .Values.externalWebhooksServer.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with .Values.externalWebhooksServer.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since minAvailable defaults to 1, a user who sets maxUnavailable: 1 without also clearing minAvailable e.g. minAvailable: "" will get both fields rendered; which is invalid.

I think we can solve for this by checking if maxUnavailable is set and render it if it is. If not, fallback to maxUnavailable.

Applies in other locations as well.

@krancour krancour modified the milestones: v1.10.0, v1.11.0 Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/chart Affects the Helm chart kind/enhancement An entirely new feature priority/normal This is the priority for most work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PodDisruptionBudget and TopologySpreadContraints for better HA configuration

4 participants