Skip to content

charts: add ability to specify topologySpreadConstraints#4313

Closed
irasnyd wants to merge 1 commit intokubernetes-sigs:mainfrom
irasnyd:add-topology-spread-constraints
Closed

charts: add ability to specify topologySpreadConstraints#4313
irasnyd wants to merge 1 commit intokubernetes-sigs:mainfrom
irasnyd:add-topology-spread-constraints

Conversation

@irasnyd
Copy link
Contributor

@irasnyd irasnyd commented Dec 29, 2025

Summary

This PR adds the ability to specify a topologySpreadConstraints for 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.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 29, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: irasnyd / name: Ira W. Snyder (ed63f80)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: irasnyd
Once this PR has been reviewed and has the lgtm label, please assign joaquimrocha for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @irasnyd!

It looks like this is your first PR to kubernetes-sigs/headlamp 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/headlamp has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 29, 2025
@illume illume requested a review from Copilot December 31, 2025 11:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 topologySpreadConstraints field 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.

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks!

Can you please add something to the charts/README.md?

@illume illume added this to the v0.40.0 milestone Feb 1, 2026
@ashu8912
Copy link
Member

ashu8912 commented Feb 5, 2026

Hii @irasnyd thanks for the PR, i have continued the docs addition here in #4559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants