Skip to content

feat(sandboxwarmpool): add Available status condition and observedGeneration - #1328

Open
prash2512 wants to merge 1 commit into
kubernetes-sigs:mainfrom
prash2512:warmpool-status-conditions
Open

feat(sandboxwarmpool): add Available status condition and observedGeneration#1328
prash2512 wants to merge 1 commit into
kubernetes-sigs:mainfrom
prash2512:warmpool-status-conditions

Conversation

@prash2512

@prash2512 prash2512 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Surface Deployment-style status on SandboxWarmPool so automation can block on pool health with kubectl wait --for=condition=Available sandboxwarmpool/<name> instead of inspecting individual sandboxes.

  • add Conditions ([]metav1.Condition, list-map) and ObservedGeneration to SandboxWarmPoolStatus, plus the Available condition type and the SandboxWarmPoolMinimumReplicas{Available,Unavailable} reason constants
  • set the Available condition (readyReplicas >= desiredReplicas) and observedGeneration in reconcilePool via meta.SetStatusCondition; the existing updateStatus DeepEqual gate suppresses no-op writes
  • regenerate deepcopy and CRDs (k8s, helm, olm)
  • unit tests for the condition builder and reconcile wiring, plus an e2e test asserting Available=True once the pool's sandbox is ready

Which issue(s) this PR is related to:

Fixes #188

Release Note

Note: Automated release notes are generated by Gemini using the PR description in the first section.
Please ensure that description is clear and comprehensive.
For breaking changes, ensure you describe the required actions clearly and the PR is labeled with release-note-action-required.
-->

SandboxWarmPool now reports an `Available` status condition and `observedGeneration`, enabling `kubectl wait --for=condition=Available sandboxwarmpool/<name>`.

Summary by CodeRabbit

  • New Features

    • Sandbox warm pools now report availability through Kubernetes status conditions.
    • Status includes the observed resource generation and indicates whether the desired number of sandboxes is ready.
    • Added availability reasons for ready and unavailable warm pools, including zero-replica pools.
    • Updated API documentation and resource schemas to describe the new status fields.
  • Tests

    • Added unit and end-to-end coverage for availability conditions and generation updates.

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 37e1c8d
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6a71753e554be20007d8167a

@kubernetes-prow kubernetes-prow Bot 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 Aug 4, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @prash2512. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

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.

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.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (3)
  • needs-ok-to-test
  • do-not-merge/work-in-progress
  • cncf-cla: no

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01361356-6f8c-49ed-bf83-a487ef5a32b0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds ObservedGeneration and Conditions to SandboxWarmPoolStatus, defines CRD schemas, sets an Available condition during reconciliation, and adds unit, reconciliation, and end-to-end tests.

Changes

SandboxWarmPool availability status

Layer / File(s) Summary
Status contract and schemas
extensions/api/v1beta1/sandboxwarmpool_types.go, helm/crds/...sandboxwarmpools.yaml, olm/config/crd/bases/...sandboxwarmpools.yaml, docs/api.md
The status API and CRD schemas now define ObservedGeneration and mergeable Conditions fields. The schemas validate Kubernetes condition entries.
Availability condition reconciliation
extensions/controllers/sandboxwarmpool_controller.go
Reconciliation records the pool generation and sets Available to true when ready replicas meet the desired count. Otherwise, it sets the condition to false.
Condition and reconciliation validation
extensions/controllers/sandboxwarmpool_controller_test.go, test/e2e/extensions/warmpool_status_condition_test.go
Tests verify condition status, reasons, zero-replica behavior, observed generation, reconciliation results, and end-to-end readiness.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SandboxWarmPool
  participant sandboxwarmpool_controller
  participant Kubernetes_status_API
  SandboxWarmPool->>sandboxwarmpool_controller: provide generation and replica state
  sandboxwarmpool_controller->>sandboxwarmpool_controller: construct Available condition
  sandboxwarmpool_controller->>Kubernetes_status_API: record ObservedGeneration and Conditions
Loading

Possibly related issues

  • #1326 — Adds the SandboxWarmPool.status.conditions infrastructure and Available condition used by a related Progressing condition.
  • #1327 — Addresses the same status condition API and controller area with a complementary Progressing condition proposal.

Suggested reviewers: shruti6991, lunarwhite, dongjiang1989

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes add Conditions and Available status reporting, enabling the kubectl wait workflow requested by issue #188.
Out of Scope Changes check ✅ Passed The API, controller, documentation, CRD, and test changes directly support the stated SandboxWarmPool status objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the addition of the Available status condition and observedGeneration to SandboxWarmPool.
Description check ✅ Passed The description explains the purpose, implementation, issue link, release note, regenerated artifacts, and test coverage.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the SandboxWarmPool extension API to expose Deployment-style status signaling so automation can reliably wait on pool health (e.g., kubectl wait --for=condition=Available sandboxwarmpool/<name>), instead of inspecting individual Sandbox resources.

Changes:

  • Added status.conditions (list-map of metav1.Condition) and status.observedGeneration to SandboxWarmPool, including an Available condition type and reason constants.
  • Updated the warm pool reconciler to set ObservedGeneration and maintain the Available condition via meta.SetStatusCondition.
  • Added unit and e2e tests validating Available=True behavior, and regenerated API artifacts (deepcopy + CRDs + docs).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/e2e/extensions/warmpool_status_condition_test.go New e2e test asserting Available=True and observedGeneration once the pool’s sandbox is ready.
extensions/controllers/sandboxwarmpool_controller.go Sets status.observedGeneration and the Available condition during reconcile.
extensions/controllers/sandboxwarmpool_controller_test.go Unit tests for the condition builder and reconcile wiring.
extensions/api/v1beta1/sandboxwarmpool_types.go API changes: new Conditions + ObservedGeneration fields and related constants.
extensions/api/v1beta1/zz_generated.deepcopy.go Regenerated deepcopy to properly deep-copy status.conditions.
docs/api.md Regenerated API reference docs to include the new status fields.
k8s/crds/extensions.agents.x-k8s.io_sandboxwarmpools.yaml Regenerated CRD schema to include status.conditions and status.observedGeneration.
helm/crds/extensions.agents.x-k8s.io_sandboxwarmpools.yaml Regenerated Helm CRD schema changes for the new status fields.
olm/config/crd/bases/extensions.agents.x-k8s.io_sandboxwarmpools.yaml Regenerated OLM CRD base schema changes for the new status fields.
Files not reviewed (1)
  • extensions/api/v1beta1/zz_generated.deepcopy.go: Generated file

Comment thread extensions/api/v1beta1/sandboxwarmpool_types.go
…eration

Surface Deployment-style status on SandboxWarmPool so automation can block on
pool health with `kubectl wait --for=condition=Available sandboxwarmpool/<name>`
instead of inspecting individual sandboxes.

- add Conditions ([]metav1.Condition, list-map) and ObservedGeneration to
  SandboxWarmPoolStatus, plus the Available condition type and the
  SandboxWarmPoolMinimumReplicas{Available,Unavailable} reason constants
- set the Available condition (readyReplicas >= desiredReplicas) and
  observedGeneration in reconcilePool via meta.SetStatusCondition; the existing
  updateStatus DeepEqual gate suppresses no-op writes
- regenerate deepcopy and CRDs (k8s, helm, olm)
- unit tests for the condition builder and reconcile wiring, plus an e2e test
  asserting Available=True once the pool's sandbox is ready
@prash2512
prash2512 force-pushed the warmpool-status-conditions branch from 360f1ca to 37e1c8d Compare August 4, 2026 05:14
@aditya-shantanu

Copy link
Copy Markdown
Collaborator

/lgtm
/ok-to-test

@kubernetes-prow kubernetes-prow Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Aug 6, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aditya-shantanu, prash2512
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.

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

@kubernetes-prow kubernetes-prow Bot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 6, 2026
@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2026
@prash2512

prash2512 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/assign @janetkuo @barney-s
Could you help review this PR when you get a chance? It's a follow-up to #1053, continuing the SandboxWarmPool observability work — it adds an Available status condition and observedGeneration so automation can kubectl wait --for=condition=Available sandboxwarmpool/<name>
Thanks!

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. ready-for-review size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Enhance SandboxWarmPool status with Ready, Available, and Conditions fields

5 participants