Repository navigation
Upgrade agent sandbox v0.5.3 - #446
safiya2610 wants to merge 1 commit into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #446 +/- ##
==========================================
+ Coverage 59.98% 60.08% +0.09%
==========================================
Files 36 35 -1
Lines 3589 3650 +61
==========================================
+ Hits 2153 2193 +40
- Misses 1216 1236 +20
- Partials 220 221 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8294a36 to
822dc7b
Compare
9928ed7 to
83002f1
Compare
|
#448 has merged into /retest |
|
@ranxi2001: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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/test-infra repository. |
doing it.. |
36a4332 to
dea727d
Compare
dea727d to
d769fc5
Compare
ebc7670 to
38380c8
Compare
aedd7bb to
2eefda6
Compare
| ### Upgrade Guide (v0.4.6 to v0.5.3) | ||
|
|
||
| When upgrading an existing `v0.4.6` installation with active or cold-start `CodeInterpreter` claims (`warmPoolSize > 0`), applying `v0.5.3` directly can cause claims to map to `warmPoolRef.name=shadow-pool-<template>`. Because `v0.5.3` requeues with `WarmPoolNotFound` if the shadow pool does not exist, claims may hit AgentCube's 2-minute create timeout and enter rollback. | ||
|
|
||
| To safely upgrade from `v0.4.6` to `v0.5.3`, follow these mandatory steps: | ||
|
|
||
| 1. **Backup Existing Resources** | ||
| ```bash | ||
| kubectl get sandboxclaims,sandboxes,sandboxtemplates,sandboxwarmpools,codeinterpreters -A -o yaml > backup.yaml | ||
| ``` | ||
| 2. **Download the Migration Helper** | ||
| Obtain the pinned `v0.5.3` migration helper script from the release assets: | ||
| ```bash | ||
| wget https://raw.githubusercontent.com/kubernetes-sigs/agent-sandbox/refs/tags/v0.5.3/helm/files/migrate.sh -O migrate.sh | ||
| chmod +x migrate.sh | ||
| ``` | ||
| 3. **Run Pre-Upgrade Bootstrap** | ||
| This prevents `WarmPoolNotFound` errors for existing cold-start claims: | ||
| ```bash | ||
| ./migrate.sh --phase=bootstrap | ||
| ``` | ||
| 4. **Apply v0.5.3 Manifest** | ||
| ```bash | ||
| kubectl apply --server-side -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.3/sandbox-with-extensions.yaml | ||
| ``` | ||
| 5. **Wait for Readiness** | ||
| Wait for the new controller and conversion webhook to be fully responsive before proceeding: | ||
| ```bash | ||
| kubectl rollout status deployment/agent-sandbox-controller -n agent-sandbox-system | ||
| for i in {1..30}; do | ||
| if kubectl get sandboxwarmpools.extensions.agents.x-k8s.io --all-namespaces >/dev/null 2>&1; then break; fi | ||
| if [ $i -eq 30 ]; then echo "Timed out waiting for webhook"; exit 1; fi | ||
| sleep 2 | ||
| done | ||
| ``` | ||
| 6. **Run Post-Upgrade Migrate** | ||
| Execute the migration phase to finalize the upgrade: | ||
| ```bash | ||
| ./migrate.sh --phase=migrate | ||
| ``` |
There was a problem hiding this comment.
We don't need an upgrade guide for Getting started doc.
| > - However, `workloadRef` fields are tombstoned by the Kubernetes v0.36 API schema and will **not** be copied to newly spawned Sandboxes. Legacy `workloadRef` batch-scheduling intent is **unsupported** on v0.36+. | ||
| > - Workloads requiring batch-scheduling or pod-group semantics must be updated to use `schedulingGroup` with `podGroupName: <group-name>`. | ||
|
|
||
| ### Upgrade Guide (v0.4.6 to v0.5.3) |
There was a problem hiding this comment.
Can you explain why you need to touch this file?
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
| include = ["agentcube_code_interpreter_mcp*"] | ||
| include = ["agentcube_code_interpreter_mcp*"] No newline at end of file |
There was a problem hiding this comment.
I don't see a need to touch this file.
| # Find code-generator | ||
| CODEGEN_PKG="" | ||
| CODEGEN_VERSION="v0.35.4" | ||
| CODEGEN_VERSION="v0.36.2" |
There was a problem hiding this comment.
Only this line is needed, I guess.
There was a problem hiding this comment.
Again, I don't know why this is needed.
| k8s.io/api v0.36.2 | ||
| k8s.io/apimachinery v0.36.2 | ||
| k8s.io/client-go v0.36.2 |
There was a problem hiding this comment.
Since agent-sandbox v0.5.3 requires k8s.io/* v0.36.2 and controller-runtime v0.24.1. Could you please spit this into two:
- bump k8s + controller-runtime dependencies
- then this PR keeps only the agent-sandbox v0.5.3 upgrade
That makes each change easier to review.
|
@safiya2610 Could you please rebase this PR and address the comments? |
624c875 to
415c1e1
Compare
|
New changes are detected. LGTM label has been removed. |
415c1e1 to
1767d75
Compare
Signed-off-by: Safiya <147792763+safiya2610@users.noreply.github.com>
1767d75 to
163ac42
Compare
|
@acsoto @ranxi2001 Please check it once. |
|
@RainbowMango @acsoto @ranxi2001 Please view it once. |
| } | ||
|
|
||
| // Create scheme and register agent-sandbox types | ||
| // Create scheme and register agent-sandbox types (both v1alpha1 and v1beta1) |
There was a problem hiding this comment.
This scheme has no consumers; the extra registrations and unused alpha GVRs do not provide migration compatibility.
There was a problem hiding this comment.
Agreed. Since this Scheme has no consumers, perhaps we could remove it to avoid confusion.
Also, this upgrade requires some preparation for existing installations. Could we add some upgrade guidance for users?
| func getSandboxStatus(sandbox *sandboxv1beta1.Sandbox) string { | ||
| for _, condition := range sandbox.Status.Conditions { | ||
| if condition.Type == string(sandboxv1alpha1.SandboxConditionReady) && condition.Status == metav1.ConditionTrue { | ||
| if (condition.Type == string(sandboxv1beta1.SandboxConditionReady) || condition.Type == string(sandboxv1alpha1.SandboxConditionReady)) && condition.Status == metav1.ConditionTrue { |
There was a problem hiding this comment.
Both constants are "Ready", so the alpha check and import are redundant.
| ``` | ||
|
|
||
| > [!IMPORTANT] | ||
| > **Kubernetes Dependency Boundary (`workloadRef` vs `schedulingGroup`)**: |
There was a problem hiding this comment.
The Kubernetes upgrade is already in the base; these compatibility notes and tests belong with that dependency change.
| Kind: types.SandboxKind, | ||
| Ports: agentRuntimeObj.Spec.Ports, | ||
| SessionID: sessionID, | ||
| OwnerID: ownerID, |
There was a problem hiding this comment.
Moving OwnerID assignment into both builders is unrelated to the API migration; keeping the existing assignment would reduce the scope.
| TypeMeta: metav1.TypeMeta{ | ||
| APIVersion: "extensions.agents.x-k8s.io/v1beta1", | ||
| Kind: "SandboxTemplate", | ||
| }, |
There was a problem hiding this comment.
We usually don't set TypeMeta explicitly here, since the object is already an extensionsv1beta1.SandboxTemplate and its GVK can be inferred from the registered Scheme.
| TypeMeta: metav1.TypeMeta{ | ||
| APIVersion: "extensions.agents.x-k8s.io/v1beta1", | ||
| Kind: "SandboxWarmPool", | ||
| }, |
| if warmPool.Spec.Replicas != *ci.Spec.WarmPoolSize { | ||
| warmPool.Spec.Replicas = *ci.Spec.WarmPoolSize | ||
|
|
||
| if !replicasEqual(warmPool.Spec.Replicas, ci.Spec.WarmPoolSize) { |
There was a problem hiding this comment.
| if !replicasEqual(warmPool.Spec.Replicas, ci.Spec.WarmPoolSize) { | |
| if !ptr.Equal(warmPool.Spec.Replicas, ci.Spec.WarmPoolSize) { |
Could we use the existing ptr.Equal helper here instead of introducing a new function?
| SandboxGVRv1alpha1 = schema.GroupVersionResource{ | ||
| Group: "agents.x-k8s.io", | ||
| Version: "v1alpha1", | ||
| Resource: "sandboxes", | ||
| } | ||
| SandboxClaimGVRv1alpha1 = schema.GroupVersionResource{ |
There was a problem hiding this comment.
These two GVRs aren’t used anywhere. Could we remove them?
| TypeMeta: metav1.TypeMeta{ | ||
| APIVersion: "agents.x-k8s.io/v1beta1", | ||
| Kind: types.SandboxKind, | ||
| }, |
There was a problem hiding this comment.
We don't need to set TypeMeta here. When a CodeInterpreter uses a warm pool, simpleSandbox is only a placeholder; the SandboxClaim, not this Sandbox, is sent to the dynamic client for creation.
|
Gentle ping @safiya2610 |
|
Hi @safiya2610, I’d be happy to help finish this PR and address the remaining review comments. Would you be open to me continuing the work? |
|
Hi @safiya2610, we’ve decided to upgrade directly to agent-sandbox v1.0.9 in #507, so we can close this PR. Thank you for your work on it! /close |
|
@zhzhuang-zju: You can't close an active issue/PR unless you authored it or you are a collaborator. DetailsIn response to this:
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/test-infra repository. |
|
/close |
|
@acsoto: Closed this PR. DetailsIn response to this:
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/test-infra repository. |
Description
This PR upgrades the
sigs.k8s.io/agent-sandboxdependency fromv0.4.6to the latest stable releasev0.5.3.As part of this upgrade, all internal workload manager logic and tests have been migrated to use the newly introduced
agents.x-k8s.io/v1beta1andextensions.agents.x-k8s.io/v1beta1APIs, replacing the olderv1alpha1types.Key Changes
sigs.k8s.io/agent-sandboxtov0.5.3ingo.modandgo.sum.Sandbox,SandboxClaim,SandboxWarmPool, andSandboxTemplateusages inpkg/workloadmanagertov1beta1.SandboxClaimconstruction to useWarmPoolRefinstead of the deprecatedTemplateRef.TestSandboxVolumeClaimTemplatesImmutabilityto explicitly enforce and test the new immutability behavior ofSandbox.spec.volumeClaimTemplates.test/e2e/e2e_test.goand all internalpkg/workloadmanagertests to construct and validatev1beta1objects. Fixed namespace validation defaulting logic in the HTTP creation handler.run_e2e.shto fetch thev0.5.3sandbox-with-extensions.yamlmanifest.Fixes #438