Skip to content

chore: keep KB-managed tools image updates in-place - #10484

Merged
leon-ape merged 1 commit into
mainfrom
support/kbmanaged-inplace-update
Jul 1, 2026
Merged

chore: keep KB-managed tools image updates in-place#10484
leon-ape merged 1 commit into
mainfrom
support/kbmanaged-inplace-update

Conversation

@leon-ape

@leon-ape leon-ape commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep KB-managed tools image-only updates in-place even when podUpgradePolicy is ReCreate
  • cover kbagent, kbagent-worker, init-kbagent, and legacy config-manager tools containers by fixed container name plus KBToolsImage repo/name
  • document ComponentDefinition ReCreate precedence over user Cluster/Component podUpgradePolicy and regenerate CRDs

Root Cause

KubeBlocks-managed sidecar/tools image changes were classified as container/initContainer upgrade diffs. When the resolved podUpgradePolicy was ReCreate, the update reconciler converted an otherwise in-place image update into Pod deletion and recreation.

Validation

  • make test-go-generate
  • make manifests
  • go test ./pkg/controllerutil ./pkg/controller/instanceset ./pkg/controller/instance ./controllers/apps/component

Fixes #10472

@github-actions github-actions Bot added the size/L Denotes a PR that changes 100-499 lines. label Jun 30, 2026
@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

CLA Recheck Instructions

Usage:
  - /recheck-cla: Trigger a re-check of CLA status for this pull request.
Example:
  - /recheck-cla

@leon-ape leon-ape changed the title fix: keep KB-managed tools image updates in-place chore: keep KB-managed tools image updates in-place Jun 30, 2026
@leon-ape leon-ape added the nopick Not auto cherry-pick when PR merged label Jun 30, 2026
@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch from 3226dcf to d34bf20 Compare June 30, 2026 09:58
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.07547% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.54%. Comparing base (84e21fd) to head (834f574).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controllerutil/image_util.go 72.72% 10 Missing and 5 partials ⚠️
pkg/controller/instance/in_place_update_utils.go 83.33% 2 Missing and 1 partial ⚠️
pkg/controller/instance/reconciler_update.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10484      +/-   ##
==========================================
+ Coverage   63.40%   63.54%   +0.13%     
==========================================
  Files         517      517              
  Lines       62542    62636      +94     
==========================================
+ Hits        39657    39799     +142     
+ Misses      19304    19260      -44     
+ Partials     3581     3577       -4     
Flag Coverage Δ
unittests 63.54% <82.07%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch 2 times, most recently from f0e6f87 to 6f4a4b0 Compare July 1, 2026 06:13
@leon-ape
leon-ape marked this pull request as ready for review July 1, 2026 06:18
@leon-ape
leon-ape requested a review from a team as a code owner July 1, 2026 06:18
@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch from 6f4a4b0 to a32367c Compare July 1, 2026 08:26
@leon-ape
leon-ape marked this pull request as draft July 1, 2026 08:27
@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch from a32367c to a498621 Compare July 1, 2026 08:34
@leon-ape
leon-ape marked this pull request as ready for review July 1, 2026 08:47
Comment thread pkg/controllerutil/image_util.go Outdated
if toolsImage == "" {
return false
}
initChanged, ok := onlyKBManagedContainerImageFieldsChanged(oldPod.Spec.InitContainers, newPod.Spec.InitContainers, toolsImage)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[P2] This helper treats initContainer image changes as safe in-place updates, but already-completed init containers are not re-executed when their PodSpec image is patched. For init-kbagent, kbagent-worker, or install-config-manager-tool, the controller can bypass a ReCreate policy, patch the spec, and then consider the pod updated even though the init-time tool/binary remains from the old image. Please keep the ReCreate path for initContainer-only KB tools image changes, or otherwise prove that a normal running container restart applies the new tool payload.

@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch from a498621 to 4c29af6 Compare July 1, 2026 08:54
@leon-ape
leon-ape marked this pull request as draft July 1, 2026 08:54
@leon-ape
leon-ape marked this pull request as ready for review July 1, 2026 09:07
@leon-ape
leon-ape force-pushed the support/kbmanaged-inplace-update branch from 4c29af6 to 834f574 Compare July 1, 2026 09:08
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines. and removed size/L Denotes a PR that changes 100-499 lines. labels Jul 1, 2026
@leon-ape

leon-ape commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

/approve

@apecloud-bot apecloud-bot added the approved PR Approved Test label Jul 1, 2026
@leon-ape
leon-ape merged commit 74318f5 into main Jul 1, 2026
35 checks passed
@leon-ape
leon-ape deleted the support/kbmanaged-inplace-update branch July 1, 2026 09:44
@github-actions github-actions Bot added this to the Release 1.2.0 milestone Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR Approved Test nopick Not auto cherry-pick when PR merged size/XL Denotes a PR that changes 500-999 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Upgrade KB from 1.0.3 to 1.1.0 redis/es/damengdb cluster pod restart

2 participants