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

feat: Add support for minValues in requirement for scheduling, consolidation layer and corresponding API changes. #963

Merged
merged 28 commits into from
Feb 21, 2024

Conversation

nikmohan123
Copy link
Contributor

@nikmohan123 nikmohan123 commented Jan 25, 2024

Description
Add support for minValues in requirement for scheduling and consolidation layer. This allows users to enforce higher flexibility constraints on Karpenter so that Karpenter adheres to spot best practices. By enforcing minValues on Karpenter NodePools with node.kubernetes.io/instance-type or karpenter.k8s.aws/instance-family , customers can ensure that launches will have a better chance of providing a highly available instance type by giving PCO more options.

How was this change tested?
make presubmit
Will add functional tests once the API structure has been finalized as the minValues is extracted from the requirement of the API.

Also manually tested by injecting the minValues into requirement and tested the scheduling and consolidation path.

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 25, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @nikmohan123. 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.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 25, 2024
@coveralls
Copy link

coveralls commented Jan 25, 2024

Pull Request Test Coverage Report for Build 7995389241

Details

  • -11 of 252 (95.63%) changed or added relevant lines in 17 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 81.047%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/disruption/consolidation.go 29 30 96.67%
pkg/test/nodepool.go 1 4 25.0%
pkg/apis/v1beta1/zz_generated.deepcopy.go 9 16 56.25%
Files with Coverage Reduction New Missed Lines %
pkg/test/expectations/expectations.go 2 95.96%
Totals Coverage Status
Change from base Build 7977335620: 0.4%
Covered Lines: 8202
Relevant Lines: 10120

💛 - Coveralls

pkg/controllers/provisioning/scheduling/nodeclaim.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/scheduling/nodeclaim.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/scheduling/nodeclaim.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/scheduling/nodeclaim.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/helpers.go Outdated Show resolved Hide resolved
@jonathan-innis
Copy link
Member

Consider using the scheduling_benchmark_test.go to see what the performance impact is on this change. Would be worth expanding that suite to add some checks for what happens when you pass requirements with minValues in

Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

Nice work 🎉

pkg/scheduling/requirement.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/scheduling/nodeclaim.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/helpers.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/helpers.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/multinodeconsolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation.go Outdated Show resolved Hide resolved
Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

Really, really nice work. These changes are absolutely non-trivial

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 15, 2024
@jonathan-innis
Copy link
Member

/hold Wait for other PRs that are being staged to be approved

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 15, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
… the NodePool requirement. (#1)

* Initial commit for introducing the API changes and modified tests to incorporate the API changes.

* Wire the minValues from NodePool spec requirement into scheduling requirement.

* Add functional tests and add validations.

* Add more documentation.

* Take in latest changes from main.

* Bump the version of CRD.

* Add more documentation.

* Add additional logic to fail close.

* Add minValues to the error string of requirement.

* Restrict the minValues to 50.

* Add tests for consolidation related to minValues in requirement.

* Addressed few comments.

* Added topology test.

* Addressed rest of the comments.

* Addressed more comments.

* Addressed few more comments.

* Fix error message order.
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 21, 2024
@jonathan-innis
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 21, 2024
@nikmohan123 nikmohan123 changed the title feat: Add support for minValues in requirement for scheduling and consolidation layer. feat: Add support for minValues in requirement for scheduling, consolidation layer and corresponding API changes. Feb 21, 2024
Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Really really awesome work here! 🎉

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
@jonathan-innis
Copy link
Member

/remove-hold

Nice work! Ship it!

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
@nikmohan123
Copy link
Contributor Author

Created an issue to fix the corner case of the topology spread not behaving as expected with minValues : #1034.

Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jonathan-innis, nikmohan123

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

The pull request process is described here

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 k8s-ci-robot merged commit 0fea7ce into kubernetes-sigs:main Feb 21, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants