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: disruption controls by reason #991

Conversation

Bryce-Soghigian
Copy link
Member

@Bryce-Soghigian Bryce-Soghigian commented Feb 6, 2024

Fixes #924

Description
This PR implements the design for disruption-controls-by-reason by introducing a new field Reasons into the v1beta1 Nodepool API. This change allows users to define lists of reasons alongside their node disruption budgets.

These reasons that can be defined are "underutilized", "drifted", "emptied" and "expired" which all correlate with different disruption methods.

How was this change tested?

  • Kwok Provider Scale up and scale down, validated that budgets were restricted
  • Parity with existing Budgets feature via no modified budgets tests, and code still behaves properly
  • Tests for DisruptionBudgetMapping structure
  • make presubmit

TODO

  • PR To Docs
  • Test on AKS Provider

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

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 6, 2024
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 6, 2024
@Bryce-Soghigian Bryce-Soghigian force-pushed the bsoghigian/disruption-by-method-poc branch from f7dea78 to 18c8dee Compare February 6, 2024 10:31
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2024
Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

Left some preliminary comments, but I anticipate this changing after a bit more comments on the RFC so I'll hold off for a bit

kwok/charts/values.yaml Outdated Show resolved Hide resolved
pkg/apis/crds/karpenter.sh_nodepools.yaml Outdated Show resolved Hide resolved
pkg/apis/v1beta1/nodepool.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 11, 2024
@coveralls
Copy link

coveralls commented Feb 11, 2024

Pull Request Test Coverage Report for Build 9520161962

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 103 of 112 (91.96%) changed or added relevant lines in 12 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.09%) to 81.197%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1beta1/nodepool.go 14 15 93.33%
pkg/controllers/disruption/multinodeconsolidation.go 5 6 83.33%
pkg/controllers/disruption/singlenodeconsolidation.go 4 5 80.0%
pkg/controllers/disruption/helpers.go 48 50 96.0%
pkg/apis/v1beta1/zz_generated.deepcopy.go 1 5 20.0%
Files with Coverage Reduction New Missed Lines %
pkg/test/expectations/expectations.go 2 93.69%
pkg/controllers/disruption/expiration.go 2 89.66%
pkg/apis/v1beta1/nodepool.go 3 95.24%
Totals Coverage Status
Change from base Build 9487761453: -0.09%
Covered Lines: 8313
Relevant Lines: 10238

💛 - Coveralls

@Bryce-Soghigian Bryce-Soghigian force-pushed the bsoghigian/disruption-by-method-poc branch 2 times, most recently from 6e5bd23 to 04d9f95 Compare February 12, 2024 20:04
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 13, 2024
Copy link

@charliedmcb charliedmcb left a comment

Choose a reason for hiding this comment

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

Overall, like the progress here.

My main concern is somewhat confusing difference between the default shared disruption budgets, and the non-shared budgets when multiple reasons are expressed for the same budget (same budget applies to all).

Both of those forms make logical sense on their own, and I would like to be able to create a budget to get mirrored by multiple reasons. However, I don't think the existing "Default" shared budget idea meshes well with that. Wondering if that could be rephased as something like MaxNodePoolDisruption, and always taken into account as an overall shared max disruption regardless of what the individual reasons disruptions were. I think this area need a bit more design to finalize.

pkg/apis/v1beta1/nodepool.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
pkg/apis/v1beta1/nodepool.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/disruptionbudgetmapping.go Outdated Show resolved Hide resolved
@Bryce-Soghigian Bryce-Soghigian changed the title [WIP] feat: disruption controls by reason feat: disruption controls by reason Feb 18, 2024
@Bryce-Soghigian
Copy link
Member Author

However, I don't think the existing "Default" shared budget idea meshes well with that. Wondering if that could be rephased as something like MaxNodePoolDisruption, and always taken into account as an overall shared max disruption regardless of what the individual reasons disruptions were. I think this area need a bit more design to finalize.

Default now is just when its unspecified and meshes with the idea fine imo. I updated the design doc to explain this relationship a bit better. LMK if you have any strong opinions

@Bryce-Soghigian Bryce-Soghigian force-pushed the bsoghigian/disruption-by-method-poc branch 2 times, most recently from 5458e56 to 6b06089 Compare February 20, 2024 08:41
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 20, 2024
@Bryce-Soghigian Bryce-Soghigian marked this pull request as ready for review February 20, 2024 09:08
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 20, 2024
@Bryce-Soghigian Bryce-Soghigian force-pushed the bsoghigian/disruption-by-method-poc branch from 8e8ac29 to da22d40 Compare June 12, 2024 18:50
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 12, 2024
Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

Just one comment. The other nits should be fine. I'll approve after the last comment :)

pkg/apis/v1beta1/nodepool.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/consolidation_test.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/events/events.go Show resolved Hide resolved
pkg/controllers/disruption/expiration.go Outdated Show resolved Hide resolved
pkg/controllers/disruption/multinodeconsolidation.go Outdated Show resolved Hide resolved
Bryce-Soghigian and others added 4 commits June 13, 2024 18:04
Co-authored-by: Nick Tran <10810510+njtran@users.noreply.github.com>
Co-authored-by: Nick Tran <10810510+njtran@users.noreply.github.com>
Copy link
Contributor

@njtran njtran 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 Jun 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Bryce-Soghigian, njtran

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2024
@k8s-ci-robot k8s-ci-robot merged commit aa088a6 into kubernetes-sigs:main Jun 17, 2024
13 checks passed
@ellistarn
Copy link
Contributor

🥂

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Disruptions should have separate Budgets
9 participants