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: Adding StartDateTime, EndDateTime, and Timezones to NodePool Budgets #1447

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ant-smith
Copy link

@ant-smith ant-smith commented Jul 18, 2024

Fixes #1446

Description

This feature adds the capability for users to define a StartDateTime and EndDateTime for their nodepools, allowing single duration scheduling of allowed disruptions.

The functionality of the API stays the same if no StartDateTime and EndDateTime are defined.

The budget also now takes into account timezones for the defined cronSchedule and dateTime's. Without defining a timezone the functionality remains unchanged and will default to "UTC". Timezones follow the standard IANA "America/New_York" format.

Both StartDateTime and EndDateTime are defined in the RFC3339 standard formats minus the "(+|-)0700" timezone at the end of the format as timezones are supported as a separate parameter.

This feature overall will assist operations teams in the following ways:

  • Overall more human readable, allowing an operator to easily reason if a budget is active or inactive at a glance
  • Support for many differing, but short lived time periods of disruption budgets over a longer timespan. E.g. there may be 15-18, 3-6 hour windows, over the course of 6 weeks that limit the clusters disruption in different ways. Writing cron's for this would be more difficult that start-end datetimes.
  • Support for empty start datetime, allows operators to say "From today until X, I want this to be active"
  • Support for empty end datetime, allows for operators to say "From today moving forward, I want this to be active"
  • Support for different timezones allow operators in separate timezones to manage separate sets of budgets, without converting to UTC first.
  • Dates are communicated in PST, needing to convert them adds friction and leaves a chance for errors as well as harder to quickly verify.

How was this change tested?

Extensive tests were written within the test suite to test the existing functionality with timezones added, along with testing the functionality of the new DateTime feature.

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 Jul 18, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @ant-smith!

It looks like this is your first PR to kubernetes-sigs/karpenter 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/karpenter has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @ant-smith. 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-sigs/prow 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 Jul 18, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ant-smith, tvonhacht-apple
Once this PR has been reviewed and has the lgtm label, please assign gjtempleton for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@ant-smith ant-smith force-pushed the rdar-131959392-feat-start-end-datetime-budgets branch 2 times, most recently from a3f8c91 to 5b629d7 Compare July 18, 2024 22:03
@coveralls
Copy link

coveralls commented Jul 18, 2024

Pull Request Test Coverage Report for Build 11001638159

Details

  • 33 of 56 (58.93%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 80.565%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1/nodepool.go 30 41 73.17%
pkg/apis/v1/zz_generated.deepcopy.go 3 15 20.0%
Files with Coverage Reduction New Missed Lines %
pkg/test/expectations/expectations.go 2 94.73%
pkg/controllers/disruption/consolidation.go 4 87.25%
Totals Coverage Status
Change from base Build 10975568388: -0.2%
Covered Lines: 8444
Relevant Lines: 10481

💛 - Coveralls

@ant-smith ant-smith force-pushed the rdar-131959392-feat-start-end-datetime-budgets branch from 5b629d7 to e5073ca Compare July 22, 2024 16:01
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 22, 2024
@njtran
Copy link
Contributor

njtran commented Jul 22, 2024

Hey @ant-smith, I notice there are a couple of use-case you're trying to solve, is it possible to pare them down to smaller distinct ideas? At a high level (stealing from your description), I see these as the core asks:

  1. human readable schedule formats
  2. a one-off "active until" schedule
  3. a one-off "active since" schedule
  4. supporting timezones for a budget

Is it possible to tackle these one by one? The best way would be to have an RFC and cut issues to get a gist of how important each issue is to other users.

Specifically speaking, would the following solutions help?

  • For 1: Post this information into the status. e.g. each budget could have a "nextHit" entry in the status
  • For 3: an infinite duration - the current schedule semantic reasons about starts to the schedule, rather than number 2 which reasons about the ends.

For 4: Seems like a simple ease-of-use add that I think we should probably add in. Just need to verify how this works in practice.

Copy link

github-actions bot commented Aug 6, 2024

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 6, 2024
@github-actions github-actions bot closed this Aug 21, 2024
@njtran njtran reopened this Sep 20, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 20, 2024
@njtran njtran removed lifecycle/closed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 20, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 20, 2024
@ant-smith ant-smith force-pushed the rdar-131959392-feat-start-end-datetime-budgets branch from e5073ca to a0ec307 Compare September 23, 2024 20:10
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 23, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2024
Copy link

github-actions bot commented Oct 8, 2024

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 8, 2024
@github-actions github-actions bot closed this Oct 22, 2024
@njtran njtran reopened this Oct 22, 2024
@github-actions github-actions bot removed lifecycle/closed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 23, 2024
Copy link

github-actions bot commented Nov 6, 2024

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: StartDateTime and EndDateTime, Timezones for NodePool Disruption Budgets
5 participants