Cleanup PSS SDK client and enable filtering snapshots by creationTimestamp#732
Conversation
✅ Deploy Preview for agent-sandbox canceled.
|
|
/assign @SHRUTI6991 |
There was a problem hiding this comment.
Pull request overview
Updates the Python PodSnapshot SDK extension to support filtering snapshots by creationTimestamp, simplifies snapshot deletion semantics, and aligns the documented workflow with the Suspend/Resume lifecycle.
Changes:
- Added
created_after/created_beforefiltering toSnapshotEngine.list()(and used it for scopeddelete_all()). - Refactored snapshot deletion to remove label-based strategies in favor of “delete all (optionally within a time range)”.
- Updated docs and tests to reflect Suspend/Resume restore semantics and the new filtering API.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
site/content/docs/sandbox/snapshots/_index.md |
Updates the docs example to use suspend/resume and clarifies restore constraints. |
clients/python/agentic-sandbox-client/test_podsnapshot_extension.py |
Adjusts the integration test to use the new list/delete APIs and exercises timestamp filtering. |
clients/python/agentic-sandbox-client/k8s_agent_sandbox/gke_extensions/snapshots/test/unit/test_sandbox_with_snapshot_support.py |
Updates unit tests for the renamed restore-check helper and adds timestamp-filter list coverage. |
clients/python/agentic-sandbox-client/k8s_agent_sandbox/gke_extensions/snapshots/snapshot_engine.py |
Implements timestamp filtering and refactors delete_all() to accept optional time bounds. |
clients/python/agentic-sandbox-client/k8s_agent_sandbox/gke_extensions/snapshots/sandbox_with_snapshot_support.py |
Makes restore-check helper private and updates resume logic to use it. |
clients/python/agentic-sandbox-client/k8s_agent_sandbox/gke_extensions/snapshots/README.md |
Updates extension docs for the new list/delete behavior and Suspend/Resume constraints. |
| > Note: this example uses `simple-sandbox-template`, which you should create in your GKE cluster first. The associated resources can be found [here](https://github.com/volatilemolotov/agent-sandbox/tree/main/site/content/docs/sandbox/snapshots/source). | ||
|
|
||
| > [!NOTE] | ||
| > A sandbox can only be restored from its own previous snapshots (via the `suspend()` and `resume()` lifecycle). A new sandbox cannot be restored from the snapshot of another sandbox. |
There was a problem hiding this comment.
I don't think we need to mention this "A new sandbox cannot be restored from the snapshot of another sandbox.".
Since alpha -> beta upgrades comes with no backward compatibility guarantees. I can add this in the migration doc if needed.
There was a problem hiding this comment.
Okay, sure.
|
/lgtm One small comment. |
|
/lgtm |
| try: | ||
| creation_time = datetime.fromisoformat(creation_time_str.replace("Z", "+00:00")) | ||
| except ValueError: | ||
| creation_time = None |
There was a problem hiding this comment.
I feel like we should not silently ignore an invalid creationTimestamp ?
There was a problem hiding this comment.
Added a warning for invalid timestamp on ps resource. Thanks !
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, SHRUTI6991, shrutiyam-glitch The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
…stamp (kubernetes-sigs#732) * Remove grouping label * Make is_restored method private * Add filtering by creation timestamp * Address comments * Update delete_by * Address comments * Update Note * Add warning for invalid timestamp in ps resource
…stamp (kubernetes-sigs#732) * Remove grouping label * Make is_restored method private * Add filtering by creation timestamp * Address comments * Update delete_by * Address comments * Update Note * Add warning for invalid timestamp in ps resource
What this PR does / why we need it:
Key Changes included:
SnapshotFilterandlistmethod inSnapshotEnginenow supportcreated_afterandcreated_beforeparameters, allowing users to retrieve snapshots within a specific time range.delete_allmethod has been refactored to remove label-based deletion in favor of global deletion with optional timestamp filters.is_restored_from_snapshotmethod inSandboxWithSnapshotSupporthas been made private (_is_restored_from_snapshot) to better align with the intended internal usage during the resume lifecycle.Which issue(s) this PR is related to:
Contributes to #709 comments.
Release Note