Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix topologySpread nil label selector bug #1095

Merged
merged 3 commits into from
Jan 6, 2022

Conversation

bwagner5
Copy link
Contributor

@bwagner5 bwagner5 commented Jan 6, 2022

1. Issue, if available:
#1021

2. Description of changes:
Fixes #1021 where if the labelSelector was not provided for a topologySpread, then Karpenter would crash. This fix makes a nil labelSelector select everything per labelSelector docs

3. How was this change tested?
Wrote a unit-test to reproduce the issue, after the fix was implemented, the unit test now passes.

4. Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: link to issue
  • No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@netlify
Copy link

netlify bot commented Jan 6, 2022

✔️ Deploy Preview for karpenter-docs-prod canceled.

🔨 Explore the source changes: 37fe0a8

🔍 Inspect the deploy log: https://app.netlify.com/sites/karpenter-docs-prod/deploys/61d77d31f727b8000804238a

@bwagner5 bwagner5 force-pushed the fix-nil-topology-label-selector branch from 1b7a5d0 to d99bf75 Compare January 6, 2022 23:08
@bwagner5 bwagner5 requested a review from ellistarn January 6, 2022 23:14
MaxSkew: 1,
}}
ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner,
test.UnschedulablePod(test.PodOptions{ObjectMeta: metav1.ObjectMeta{Labels: labels}}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we specify pods with different labels just to be safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or no labels!

Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

nice fix!

@bwagner5 bwagner5 requested a review from ellistarn January 6, 2022 23:38
@ellistarn ellistarn merged commit 5d17ebd into aws:main Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

topologySpreadConstriants with empty labelSelector makes karpenter crash
2 participants