Skip to content

Conversation

@vicentefb
Copy link
Contributor

@vicentefb vicentefb commented Oct 28, 2025

Fixes #108

This PR introduces shutdownTime feature to the sandbox extensions, allowing users to define an expiration time for their sandboxes.

  1. A user can optionally provide a shutdownTime in their SandboxClaim.

This logic is implemented in the sandboxclaim-controller, which copies the correct shutdownTime to the Sandbox resource upon creation. The core sandbox-controller is then responsible for watching this field and deleting the sandbox pod when the time is reached.

@netlify
Copy link

netlify bot commented Oct 28, 2025

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 9ce884e
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/692e0b7a1cf43d000898e133

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vicentefb
Once this PR has been reviewed and has the lgtm label, please assign janetkuo for approval. For more information see the 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 28, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @vicentefb. Thanks for your PR.

I'm waiting for a github.com 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2025
@vicentefb vicentefb force-pushed the AddShutdownTimeToSandboxTemplate branch 2 times, most recently from 055781e to d8d27ee Compare October 28, 2025 02:52
@syangx39
Copy link

  1. Do we have logic to prevent users from creating a Sandbox with shutdownTime in the past?
  2. Also no action needed but please be aware we might have an up-to 2s deletion lag.

@vicentefb
Copy link
Contributor Author

Do we have logic to prevent users from creating a Sandbox with shutdownTime in the past?

Thanks! Yes, there's this if statement in the sandbox controller that checks if the current time is after the shutdownTime https://github.com/kubernetes-sigs/agent-sandbox/blob/main/controllers/sandbox_controller.go#L448-L451

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 31, 2025
Copy link
Member

@hzxuzhonghu hzxuzhonghu 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 Nov 6, 2025
@vicentefb vicentefb force-pushed the AddShutdownTimeToSandboxTemplate branch from 71123b0 to 01f8f1d Compare November 6, 2025 16:33
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2025
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 6, 2025
@janetkuo
Copy link
Member

janetkuo commented Nov 7, 2025

/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 Nov 7, 2025
@vicentefb vicentefb force-pushed the AddShutdownTimeToSandboxTemplate branch from 01f8f1d to b31418f Compare December 1, 2025 21:38
@vicentefb vicentefb force-pushed the AddShutdownTimeToSandboxTemplate branch from dbdc1d4 to 9ce884e Compare December 1, 2025 21:41
@vicentefb vicentefb requested a review from janetkuo December 1, 2025 21:41
@vicentefb
Copy link
Contributor Author

/test presubmit-agent-sandbox-e2e-test

Copy link
Member

@janetkuo janetkuo left a comment

Choose a reason for hiding this comment

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

Please also see #201

claimTime := claim.Spec.ShutdownTime
sandboxTime := sandbox.Spec.ShutdownTime

if claimTime == nil && sandboxTime != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why we are reconciling the claim time against the live sandbox here. What's the intention here? Claim doesn't support updating sandbox currently.

Copy link
Contributor Author

@vicentefb vicentefb Dec 6, 2025

Choose a reason for hiding this comment

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

So i saw that the sandbox_controller.go allows and correctly handles updates to the shutdownTime field so in this case i was also allowing updates to the field from the SandboxClaim. Since the SandboxClaim is the user-facing interface, i thought users shouldn't need to find and edit the underlying Sandbox resource directly to change the field. I may be wrong by thinking about it like this but lmk if this makes sense or if i should revert this change.

Name: claim.Name,
},
}
sandbox.Spec.ShutdownTime = claim.Spec.ShutdownTime
Copy link
Member

Choose a reason for hiding this comment

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

This behavior is different from what's documented in the API spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh true, i forgot to update the API spec comments.

@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2025
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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that 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.

Feature: Add shutdownTime field to sandbox CRs in extensions

5 participants