charts: add ability to specify topologySpreadConstraints#4313
charts: add ability to specify topologySpreadConstraints#4313irasnyd wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: irasnyd The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @irasnyd! |
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring topologySpreadConstraints in the Headlamp Helm chart deployment, enabling users to control how pods are distributed across topology domains (zones, nodes, etc.) for improved high availability.
Key Changes:
- Added
topologySpreadConstraintsfield to values.yaml with a comprehensive example showing zone and node spread configuration - Implemented template logic in deployment.yaml to render the constraints with automatic labelSelector injection when not explicitly provided
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| charts/headlamp/values.yaml | Added topologySpreadConstraints configuration field with commented example demonstrating multi-zone and multi-node pod spreading |
| charts/headlamp/templates/deployment.yaml | Implemented template logic to render topologySpreadConstraints with automatic labelSelector injection for constraints that don't specify one |
The implementation is well-designed and follows established patterns in the chart. The template correctly handles YAML formatting using a combination of toYaml, nindent, and trim to produce valid output, and includes intelligent labelSelector auto-injection for improved usability. The example configuration demonstrates best practices for pod topology spreading with both soft (zone) and hard (node) constraints.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
illume
left a comment
There was a problem hiding this comment.
Thanks!
Can you please add something to the charts/README.md?
Summary
This PR adds the ability to specify a
topologySpreadConstraintsfor the headlamp deployment.An example was included which prefers to schedule multiple Pods in different Availability Zones, and requires that multiple Pods are on different Nodes. When uncommented, the example has no effect on the default configuration with
replicaCount: 1.