Skip to content

Implement Sandbox status via conditions#422

Open
SHRUTI6991 wants to merge 13 commits intokubernetes-sigs:mainfrom
SHRUTI6991:add_status_condition
Open

Implement Sandbox status via conditions#422
SHRUTI6991 wants to merge 13 commits intokubernetes-sigs:mainfrom
SHRUTI6991:add_status_condition

Conversation

@SHRUTI6991
Copy link
Copy Markdown
Contributor

@SHRUTI6991 SHRUTI6991 commented Mar 16, 2026

Fixes #119

Motivation

We need to expose status method for Sandboxes in the Python SDK: #280. The current outstanding implementation checks the Pod status instead of Sandbox and transforms the Pod status into the Sandbox status on the client side. This is not an ideal implementation. We should expose status of the Sandbox on the controller side as a first class field. To align with Kubernetes API standards and address the previous limitations of using phase for Sandbox as discussed in #121, this proposal replaces the deprecated status.phase field with status.conditions model. This model establishes three conditions: Initialized, Ready and Suspended.

Description

This PR includes the KEP and implementation of the Sandbox status via condition. The details for the condition types and reasons are added in the KEP.

Testing Strategy

  1. Unit test across 2 (Initialized) X 2 (Suspended) X 3 (Ready) condition matrix.
  2. Integration Test: https://paste.googleplex.com/4805827690102784

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 16, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 9fe5a13
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69cd45efed829000081bf97c

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 16, 2026
@SHRUTI6991
Copy link
Copy Markdown
Contributor Author

/assign @janetkuo

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 24, 2026
@SHRUTI6991 SHRUTI6991 changed the title Add status condition Implement Sandbox status via conditions Mar 26, 2026
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 26, 2026
@SHRUTI6991 SHRUTI6991 force-pushed the add_status_condition branch from ac14f0c to 94fa3f1 Compare March 26, 2026 22:42
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 26, 2026
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 26, 2026
@SHRUTI6991
Copy link
Copy Markdown
Contributor Author

/assign @barney-s

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: SHRUTI6991
Once this PR has been reviewed and has the lgtm label, please ask for approval from barney-s. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@SHRUTI6991
Copy link
Copy Markdown
Contributor Author

/assign @justinsb

@aditya-shantanu
Copy link
Copy Markdown
Contributor

/assign @barney-s

@justinsb
Copy link
Copy Markdown
Contributor

justinsb commented Apr 1, 2026

We need to be more precise about what we're changing here: AIUI we already have a ready status.condition, and we want to add more conditions. I'm not yet clear about what problem those conditions are solving.

For "aggregation" objects, my rule of thumb is that Ready is true when all the child objects are applied to the cluster and are themselves Ready. I consider Sandbox an aggregation object.

There's some ambiguity about whether a suspended sandbox should be considered Ready. I think convention would say yes, a Deployment of size 0 is not generally treated as broken (I think).

A controller can observe that the pod should be suspended from spec, see in status.observedGeneration that the controller has acted on this spec, and then look at the status to understand whether the child objects have been applied. I think there's an argument to be made that the current setup makes it harder to know when the Sandbox is in the process of scaling down, and I think we need to focus on that argument.

@SHRUTI6991
Copy link
Copy Markdown
Contributor Author

We need to be more precise about what we're changing here: AIUI we already have a ready status.condition, and we want to add more conditions. I'm not yet clear about what problem those conditions are solving.

For "aggregation" objects, my rule of thumb is that Ready is true when all the child objects are applied to the cluster and are themselves Ready. I consider Sandbox an aggregation object.

There's some ambiguity about whether a suspended sandbox should be considered Ready. I think convention would say yes, a Deployment of size 0 is not generally treated as broken (I think).

A controller can observe that the pod should be suspended from spec, see in status.observedGeneration that the controller has acted on this spec, and then look at the status to understand whether the child objects have been applied. I think there's an argument to be made that the current setup makes it harder to know when the Sandbox is in the process of scaling down, and I think we need to focus on that argument.

I have reworded the motivation and emphasized focus on suspension.

My main argument against using just a single "Ready" field is that we end up recreating the issues of using Phase field. The reasons within Ready condition cannot still differentiate between "SandboxSuspended" vs "SandboxPodInitializing" for example.

In addition to that, Initialized makes the first-time setup of persistent infrastructure observable separately from the Pod which is very similar to how Pod exposes it's conditions: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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.

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. next-step:contributor size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the status of the sandbox.

7 participants