Fix multiple topologySpreadConstraints - #1144
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the vso.topologySpreadConstraints Helm template helper to improve its structure and correctness. The template processes topology spread constraints and automatically adds default label selectors when not explicitly provided.
Key changes:
- Accumulates all topology spread constraints in a list before outputting YAML
- Adds a conditional check to only output YAML if constraints exist
- Improves code readability by using intermediate variables
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have also filed !1131 in hopes of resolving this. Hashicorp, please recognize that this is a legitimate issue affecting multiple users. |
Helm chart's deployment template is broken when using multiple
topologySpreadConstraints.Steps to reproduce:
Let's see what broken YAML was actually produced here:
You can see the new-line being removed and 2 constraints merged into one block:
Let's apply the fix and try again:
The fix works fine with multiple
topologySpreadConstraints, a single one or no at all.Please merge the proposed changes.