-
Couldn't load subscription status.
- Fork 29
Add TTL support for sandbox #21
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: barney-s 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT of a label-based approach ? Instead of having spec.ttl.ttlFrom we could have a generic label like sandbox.io/no-ttl-apply: true which can be toggled by another controller ? The label sandbox.io/no-ttl-apply would actually represent the system's state.
I'm just wondering how easily someone could bypass the TTL policy (as long as they have create permissions) now that the control of the "startTimer" is at the spec level.
I did consider annotation instead of spec field. My thought process was:
Alternatively i also considered having a expiryTime/ttlExpiryAt/Cleanup absolute time. If we have that we dont need anything else.
Even if we have an annotation, they could still bypass the ttl. This is a larger concern around rbac beyond the scope of this feature. |
|
I see, the key difference is that we can use a Validating Webhook to block non-admin users from setting a label (like sandbox.io/no-ttl-apply). We can't cleanly block users from setting a specific value in the spec. This means the security flaw is in scope and is solvable with the label pattern. On Features: Put user-safe options in spec: We can add Keep the admin-only override in a label: The WarmPool uses This separates user intent (spec) from system state (label) and system triggers (annotation). WDYT ? Also, is there any default value that we are thinking of for |
Can policies not be applied for spec values ?
liking |
6a1bd2d to
a720b26
Compare
a720b26 to
c7c2b2f
Compare
* Add TTL info in status
* .status.firstReadyTime - When the first time sandbox became ready
* .status.shutdownAt - When is the sandbox scheduled for deletion
* Add TTL config to Sandbox
* .spec.tt.seconds - How many seconds does the sandbox live
* .spec.ttl.startPolicy - When do we start the counting the ttl
* onCreate - TTL starts from sandbox creation
* onReady - TTL starts from sandbox ready
* onEnable - When this is set and .status.shutdownAt is nil
* never - TTL is disabled
* User can modify the .ttl.seconds and .ttl.startPolicy
* If the .status.shutdownAt is computed to a past-time, the sandbox is
immediately deleted
c7c2b2f to
ecc2bd0
Compare
|
Updated the code to match the current state of proposal #18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @flpanbin proposed a feature for "shutdown time" (#23 (comment)). Which field suits our target users better? Or do we need both?
I would think both. warmpool requires relative TTL |
I think we need both, the TTL means the lifetime of the sandbox. After TTL expires, the sandbox will be deleted. And the "shutdown time" is used to control the pause(introduced by #36) time of the sandbox. |
|
PR needs rebase. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need both, the TTL means the lifetime of the sandbox. After TTL expires, the sandbox will be deleted. And the "shutdown time" is used to control the pause(introduced by #36) time of the sandbox.
I had a live discussion with @justinsb, @vicentefb, @tomergee about TTL and shutdownTime/endsAt today. We think that starting with shutdownTime/endsAt is better given that it's less complex. With TTL we need to think about the UX regarding when the clock starts and track the original timestamp (needed for updating TTL). We can change it to TTL or add TTL later if needed. @barney-s FYI
For pausing, let's continue the discussion in #36. @flpanbin IMO pausing and shutdown are different. Sandbox will be deleted without preserving state after shutdown time, and if it's paused, its state will be persevered.
|
Rethinking about the TTL from values, I actually got a bit concern about the |
|
#51 created with just shutdownat |
:( but nevertheless ... #51 created with just shutdownat |
|
@barney-s: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
Add TTL info in status
Add TTL config to Sandbox
User can modify the .ttl.seconds and .ttl.startPolicy
If the .status.shutdownAt is computed to a past-time, the sandbox is
immediately deleted
closes Feature Request: TTL support for sandbox #18