-
Notifications
You must be signed in to change notification settings - Fork 58
feat: added shutdownTime to extensions CRs #124
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?
feat: added shutdownTime to extensions CRs #124
Conversation
✅ Deploy Preview for agent-sandbox canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vicentefb 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 |
|
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 Once the patch is verified, the new status will be reflected by the 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. |
055781e to
d8d27ee
Compare
|
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 |
hzxuzhonghu
left a comment
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.
/lgtm
nit nit rebasing
71123b0 to
01f8f1d
Compare
|
New changes are detected. LGTM label has been removed. |
|
/ok-to-test |
| // template should be deleted. | ||
| // +kubebuilder:validation:Format="date-time" | ||
| // +optional | ||
| ShutdownTime *metav1.Time `json:"shutdownTime,omitempty"` |
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 believe shutdownTime is better placed in the SandboxClaim rather than the template. This would give users more direct control over the lifecycle of each sandbox. Let me know if you have other use cases in mind.
| "time" // Added for shutdownTime | ||
|
|
||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp" // Added for ignoring fields |
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 don't think you need comments for imports
| "sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
|
|
||
| "sigs.k8s.io/agent-sandbox/api/v1alpha1" | ||
| sandboxv1alpha1 "sigs.k8s.io/agent-sandbox/api/v1alpha1" |
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.
This seems repetitive, just keep the sandboxv1alpha1 one
| }, | ||
| Spec: extensionsv1alpha1.SandboxTemplateSpec{ | ||
| PodTemplate: sandboxv1alpha1.PodTemplate{ | ||
| PodTemplate: v1alpha1.PodTemplate{ |
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.
This change doesn't seem needed
Fixes #108
This PR introduces
shutdownTimefeature to the sandbox extensions, allowing users to define an expiration time for their sandboxes. This feature is implemented with an override pattern:shutdownTimecan be set in the SandboxTemplate.shutdownTimein their SandboxClaim to override the template's default.This logic is implemented in the
sandboxclaim-controller, which copies the correct (overridden or default) shutdownTime to the Sandbox resource upon creation. The coresandbox-controlleris then responsible for watching this field and deleting the sandbox pod when the time is reached.