Skip to content

Conversation

@cjc7373
Copy link
Contributor

@cjc7373 cjc7373 commented Jul 7, 2025

In #8328, pod's serviceaccount name has been changed to kb-{cmpdName} so that pods with the same cmpd can share one serviceaccount. However, this leads to a problem that when upgrading a component's cmpd (by changing the .spec.compDef field in component object), it will trigger a pod restart since serviceaccount has changed.

To avoid pod restarting, we can rollback a serviceaccount change if the underlying policyrules do not change.

An alternate solution is to change the serviceaccount name rule back to kb-{clusterName}-{componentName}. But this way can lead to a pod restart to all existing clusters.

@apecloud-bot
Copy link
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.0

@github-actions github-actions bot added the size/M Denotes a PR that changes 30-99 lines. label Jul 7, 2025
@cjc7373 cjc7373 added the pick-1.0 Auto cherry-pick to release-1.0 when PR merged label Jul 7, 2025
@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment

@github-actions github-actions bot added the Stale label Aug 25, 2025
@cjc7373 cjc7373 force-pushed the support/rollback-service-account-name-when-upgrade-cmpd branch from 999e169 to 8e2364b Compare September 3, 2025 06:22
@github-actions github-actions bot added size/L Denotes a PR that changes 100-499 lines. and removed size/M Denotes a PR that changes 30-99 lines. labels Sep 3, 2025
@cjc7373 cjc7373 force-pushed the support/rollback-service-account-name-when-upgrade-cmpd branch from 35c0a3a to a8ea87f Compare September 3, 2025 07:17
@cjc7373 cjc7373 force-pushed the support/rollback-service-account-name-when-upgrade-cmpd branch from a8ea87f to f9a98f1 Compare September 3, 2025 08:25
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 62.25490% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.99%. Comparing base (1cd2f9c) to head (36e88f8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...llers/apps/component/transformer_component_rbac.go 70.83% 28 Missing and 14 partials ⚠️
controllers/apps/componentdefinition_controller.go 33.33% 24 Missing and 2 partials ⚠️
pkg/controller/builder/builder_cluster_role.go 0.00% 7 Missing ⚠️
pkg/constant/pattern.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9518      +/-   ##
==========================================
- Coverage   51.06%   50.99%   -0.08%     
==========================================
  Files         541      542       +1     
  Lines       58340    58510     +170     
==========================================
+ Hits        29793    29837      +44     
- Misses      25611    25720     +109     
- Partials     2936     2953      +17     
Flag Coverage Δ
unittests 50.99% <62.25%> (-0.08%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@cjc7373 cjc7373 marked this pull request as ready for review September 3, 2025 08:37
@cjc7373 cjc7373 requested a review from a team as a code owner September 3, 2025 08:37
@apecloud-bot apecloud-bot added the approved PR Approved Test label Sep 4, 2025
@github-actions github-actions bot removed the Stale label Sep 8, 2025
@apecloud-bot apecloud-bot removed the approved PR Approved Test label Dec 23, 2025
@cjc7373 cjc7373 requested a review from leon-inf as a code owner December 24, 2025 08:29
@cjc7373
Copy link
Contributor Author

cjc7373 commented Dec 24, 2025

The new approach is:

  • add a hash to indicate the policy rule, lifecycle action and restart status
  • when a cmpd upgrade happens
    • if the hash has not changed: don't change serviceaccount name
    • if it does change, switch to the new naming rule (kb-{clusterName}-{componentName})
  • when a new cluster creates, use the new naming rule

@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 Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pick-1.0 Auto cherry-pick to release-1.0 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.

4 participants