Skip to content

refactor(controllers): clean up deprecated v1alpha1 references and no…#1064

Open
SHRUTI6991 wants to merge 1 commit into
kubernetes-sigs:mainfrom
SHRUTI6991:cleanup_beta1
Open

refactor(controllers): clean up deprecated v1alpha1 references and no…#1064
SHRUTI6991 wants to merge 1 commit into
kubernetes-sigs:mainfrom
SHRUTI6991:cleanup_beta1

Conversation

@SHRUTI6991

@SHRUTI6991 SHRUTI6991 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR cleans up the remaining deprecated v1alpha1 schema references from the core Sandbox controller and removes the redundant "none" warm pool name fallback.

Changes

  • Core Controller Decoupling: Removed v1alpha1 schema imports and registration from sandbox_controller.go. Registered v1alpha1 directly in the manager to preserve conversion webhooks.
  • Removed "none" Warm Pool Fallback: Simplified pool name resolution inside adoptSandboxFromCandidates in sandboxclaim_controller.go to directly call getWarmPoolName(adopted).

Verification

  • Verified by running unit tests:
    go test -v ./controllers/... ./extensions/controllers/...
    
    

Summary by CodeRabbit

  • Bug Fixes
    • Improved support for older sandbox resources so they’re recognized correctly at startup.
    • Adjusted warm-pool labeling so empty names are no longer replaced with "none" in adoption tracking and logs.
@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for agent-sandbox ready!

Name Link
🔨 Latest commit 934b5af
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6a42fdae413f5e0008c75fb4
😎 Deploy Preview https://deploy-preview-1064--agent-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow kubernetes-prow Bot requested review from soltysh and vicentefb June 29, 2026 23:20
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92e023ca-6cf6-4ade-bc5f-dbcdf1eef1e9

📥 Commits

Reviewing files that changed from the base of the PR and between 90dbdd1 and 934b5af.

📒 Files selected for processing (3)
  • cmd/agent-sandbox-controller/main.go
  • controllers/sandbox_controller.go
  • extensions/controllers/sandboxclaim_controller.go
💤 Files with no reviewable changes (1)
  • controllers/sandbox_controller.go

📝 Walkthrough

Walkthrough

Moves sandboxv1alpha1.AddToScheme registration from controllers/sandbox_controller.go's init() to cmd/agent-sandbox-controller/main.go startup. Also simplifies poolName assignment in adoptSandboxFromCandidates to use getWarmPoolName(adopted) directly instead of defaulting to "none".

Changes

Scheme registration and poolName fix

Layer / File(s) Summary
Move v1alpha1 scheme registration to main.go
cmd/agent-sandbox-controller/main.go, controllers/sandbox_controller.go
Adds sandboxv1alpha1 import and AddToScheme call in main.go during startup; removes the same import and registration from the controller's init().
Simplify poolName in warm-pool adoption
extensions/controllers/sandboxclaim_controller.go
Replaces the "none" default with a direct getWarmPoolName(adopted) call, allowing an empty string when no warm-pool name is present.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

ready-for-review

Suggested reviewers

  • justinsb
  • janetkuo
  • barney-s

Poem

🐇 Hoppity-hop through the scheme-land gate,
v1alpha1 now registers at the right place and date.
No more "none" when the pool has no name,
Empty strings play the warm-pool game.
The rabbit tidies up — and the code is great! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main refactor and cleanup in the changeset, though it is truncated at the end.
Description check ✅ Passed The description covers purpose, changes, and verification, but it omits the issue links section and a release-note block.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@kubernetes-prow kubernetes-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 29, 2026

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 removes remaining deprecated api/v1alpha1 wiring from the core controllers package (while still registering it in the controller manager for webhook conversion support) and simplifies warm-pool name handling during Sandbox adoption.

Changes:

  • Removed v1alpha1 import and AddToScheme registration from controllers/sandbox_controller.go’s shared scheme initialization.
  • Registered api/v1alpha1 in the controller manager (cmd/agent-sandbox-controller/main.go) to keep conversion webhook decoding working.
  • Simplified warm pool name resolution in SandboxClaimReconciler.adoptSandboxFromCandidates by removing the "none" fallback and using getWarmPoolName(...) directly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
extensions/controllers/sandboxclaim_controller.go Removes redundant "none" fallback for warm pool name during adoption logging/metrics.
controllers/sandbox_controller.go Decouples the controllers package scheme from deprecated v1alpha1 types.
cmd/agent-sandbox-controller/main.go Ensures the manager scheme still registers v1alpha1 for conversion webhook support.

@dongjiang1989 dongjiang1989 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@shrutiyam-glitch

Copy link
Copy Markdown
Contributor

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 1, 2026
@aditya-shantanu

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aditya-shantanu, dongjiang1989, SHRUTI6991
Once this PR has been reviewed and has the lgtm label, please assign soltysh 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

@janetkuo janetkuo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This lgtm, but would be good to fix the log level

}

poolName := getWarmPoolName(adopted)
logger.Info("Attempting sandbox adoption", "sandbox candidate", adopted.Name, "warm pool", poolName, "claim", claim.Name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While you're at it, update this to use V(4) for workflow checkpoints. Reserve logger.Info for major lifecycle events and state transitions to avoid spammy logs

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. ready-for-review size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

6 participants