Skip to content

feat(chart): Adds topologySpreadConstraints for multi-zone HA - #437

Open
Ayush4958 wants to merge 2 commits into
kubernetes-sigs:mainfrom
Ayush4958:feat/topology-spread-constraints
Open

feat(chart): Adds topologySpreadConstraints for multi-zone HA#437
Ayush4958 wants to merge 2 commits into
kubernetes-sigs:mainfrom
Ayush4958:feat/topology-spread-constraints

Conversation

@Ayush4958

Copy link
Copy Markdown
Contributor

Description

I had added native support for topologySpreadConstraints in the Helm chart to support highly available, multi zone deployments of the controller.

While users can technically inject soft podAntiAffinity rules into the existing affinity block, topologySpreadConstraints is the modern standard for guaranteeing balanced zone distribution without leaving replicas stuck in Pending.

Note on isolation: I placed this configuration alongside the existing affinity and tolerations blocks in values.yaml and deployment.yaml. This ensures it is completely structurally isolated and will not create merge conflicts with #411

Related Issue

Fixes #413

Type of Change

  • New feature (non breaking)

Testing

  • Added helm-unittest coverage in deployment_test.yaml asserting correct rendering of maxSkew and topologyKey when values are provided.
  • make test passes locally.

@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit ee886f1
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/6a8841100451af000887be09

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 20, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @Ayush4958. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 20, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

I haven't seen many helm charts. I think we need to do some research on the need for this. It sounds like a good idea..but I wonder whether all of this are in general preset in the chart or operators would configure it for flexibility?

could you add a reference example, say a CNI controller, on what scheduling controls are expected from the chart?

Thanks for your time!

@Ayush4958

Copy link
Copy Markdown
Contributor Author

hi @ajaysundark

These are never preset in chart because topology labels varies by environment (like AWS uses topology.kubernetes.io/zone, while bare metal might use a custom rack label) the standard way is to expose an empty array [] in values.yaml, so operators can inject their own specific constraints.

some references :-

It simply brings NRC to parity with the scheduling controls operators already expect from standard controllers

@ajaysundark

Copy link
Copy Markdown
Contributor

Thanks @Ayush4958.

IIUC, the suggestion is to add this empty list, eg: https://github.com/cert-manager/cert-manager/blob/e7c1783d26ed1a3cf988170ccd96419045de5150/deploy/charts/cert-manager/values.yaml#L613-L624, so it's injectable via helm. Is that right?

@Ayush4958

Copy link
Copy Markdown
Contributor Author

Yes, by exposing the [] in values.yaml operators can inject their own constraints.

# whenUnsatisfiable: DoNotSchedule
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: node-readiness-controller

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just calling this out, currently the chart allows name-overrides, maybe a x-ref to the variable name as comment?

@Ayush4958 Ayush4958 Aug 21, 2026

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.

yes, It will be nice
I will add the comment for adjustment , something like this :-

Note: Adjust this if you use nameOverride/fullnameOverride

@ajaysundark

Copy link
Copy Markdown
Contributor

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 21, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

it'd be good to mention this in our helm documentation when ready.

@Ayush4958

Copy link
Copy Markdown
Contributor Author

it'd be good to mention this in our helm documentation when ready.

I'll make sure to add a section about this
should I add the helm doc change in this or a small PR will be good ?

@kubernetes-prow kubernetes-prow Bot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 21, 2026
@kubernetes-prow

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ayush4958
Once this PR has been reviewed and has the lgtm label, please ask for approval from ajaysundark. 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

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add topologySpreadConstraints template to Helm chart

2 participants