Skip to content

feat(k8s): add Pool rolling update maxUnavailable, close #610#621

Merged
Spground merged 1 commit intoalibaba:mainfrom
Spground:feature/public-pool-rolling-update-maxu
Apr 8, 2026
Merged

feat(k8s): add Pool rolling update maxUnavailable, close #610#621
Spground merged 1 commit intoalibaba:mainfrom
Spground:feature/public-pool-rolling-update-maxu

Conversation

@Spground
Copy link
Copy Markdown
Collaborator

@Spground Spground commented Apr 1, 2026

Summary

  • What is changing and why?

Core Feature:

  • Added UpdateStrategy field to Pool CRD with maxUnavailable support, enabling controlled rolling updates of sandbox pods
  • Introduced PoolUpdateStrategy interface with recreateUpdateStrategy implementation that handles revision-based pod replacements

Controller Refactoring:

  • Restructured reconcilePool into 6 clear phases: eviction handling → sandbox scheduling → upgrade computation → scaling → status update
  • Encapsulated return values into ScheduleResult and UpdateResult structs for cleaner data flow
  • Merged handlePodEvictions and filterEvictingPods into unified handleEviction function

Update Strategy Logic:

  • Implements stable sorting for deterministic pod deletion order (unassigned < assigned, pending < running, not-ready < ready, etc.)
  • Calculates unavailable budget excluding already-unavailable pods to avoid unnecessary throttling
  • Tracks upgrade progress via new Updated field in PoolStatus

API Changes:

  • Added UpdateStrategy type with MaxUnavailable field (intstr for percentage or absolute values)
  • Added Updated field to PoolStatus indicating pods running target revision
  • Added kubectl print columns for UPDATED count and AGE

Testing:

  • Added comprehensive E2E test covering: allocated pod preservation, new allocation during upgrade, maxUnavailable enforcement, status tracking, and eventual completion
  • Added ComparePodsForDeletion utility with priority-based ordering for consistent pod selection

Bug Fixes:

  • Fixed requeue logic for pending unallocated BatchSandboxes
  • Removed redundant idle pod offset logic from scalePool

Why
Previously, Pool template changes triggered immediate recreation of all idle pods without rate limiting, potentially causing service disruption. This change enables safe,
gradual rollouts with configurable availability guarantees—critical for production workloads requiring controlled deployment strategies.

Testing

  • Not run (explain why)
  • Unit tests
  • Integration tests
  • e2e / manual verification

Breaking Changes

  • None
  • Yes (describe impact and migration path)

Checklist

  • Linked Issue or clearly described motivation
  • Added/updated docs (if needed)
  • Added/updated tests (if needed)
  • Security impact considered
  • Backward compatibility considered

@Spground Spground self-assigned this Apr 1, 2026
@Spground Spground added feature New feature or request component/k8s For kubernetes runtime go Pull requests that update go code labels Apr 1, 2026
@Spground
Copy link
Copy Markdown
Collaborator Author

Spground commented Apr 1, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 338beb5c38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Spground Spground force-pushed the feature/public-pool-rolling-update-maxu branch 2 times, most recently from a75da9e to 6c57461 Compare April 1, 2026 13:04
@Spground
Copy link
Copy Markdown
Collaborator Author

Spground commented Apr 1, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c57461230

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Spground Spground force-pushed the feature/public-pool-rolling-update-maxu branch from 6c57461 to 9602b65 Compare April 2, 2026 02:19
@Spground
Copy link
Copy Markdown
Collaborator Author

Spground commented Apr 2, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9602b6585c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Spground Spground force-pushed the feature/public-pool-rolling-update-maxu branch from 9602b65 to 342576a Compare April 8, 2026 10:03
@Spground
Copy link
Copy Markdown
Collaborator Author

Spground commented Apr 8, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown
Collaborator

@Generalwin Generalwin left a comment

Choose a reason for hiding this comment

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

LGTM

@Spground Spground merged commit bc4b0f8 into alibaba:main Apr 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/k8s For kubernetes runtime feature New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants