Skip to content

CloneSet supports to reuse PVC during upgrade #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FillZpp
Copy link
Member

@FillZpp FillZpp commented Jan 14, 2025

Ⅰ. Describe what this PR does

CloneSet supports to reuse PVC during upgrade.

Newly added:

  • CloneSetPVCReuseDuringUpdate feature-gate that enables CloneSet to reuse PVC during update.
  • apps.kruise.io/keep-pvc-for-deletion label that can either be used by the above feature, or user can directly set it in pod or pod template, so that CloneSet will keep the PVC to reuse when it deletes the pod.

Ⅱ. Does this pull request fix one issue?

fixes #1876

@FillZpp FillZpp requested review from furykerry and zmberg January 14, 2025 07:06
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.

Project coverage is 50.93%. Comparing base (0d0031a) to head (e5011c4).
Report is 220 commits behind head on master.

Files with missing lines Patch % Lines
pkg/controller/cloneset/sync/cloneset_scale.go 0.00% 1 Missing and 1 partial ⚠️
pkg/util/specifieddelete/specified_delete.go 80.00% 2 Missing ⚠️
pkg/controller/cloneset/sync/cloneset_update.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1881      +/-   ##
==========================================
+ Coverage   47.91%   50.93%   +3.02%     
==========================================
  Files         162      193      +31     
  Lines       23491    24979    +1488     
==========================================
+ Hits        11256    12724    +1468     
+ Misses      11014    10949      -65     
- Partials     1221     1306      +85     
Flag Coverage Δ
unittests 50.93% <64.28%> (+3.02%) ⬆️

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.

@FillZpp FillZpp force-pushed the cloneset-supports-to-reuse-pvc-during-upgrade branch from 7555224 to e5011c4 Compare January 14, 2025 08:06
)

func IsSpecifiedDelete(obj metav1.Object) bool {
_, ok := obj.GetLabels()[appsv1alpha1.SpecifiedDeleteKey]
return ok
}

func PatchPodSpecifiedDelete(c client.Client, pod *v1.Pod, value string) (bool, error) {
func ShouldKeepPVC(obj metav1.Object) bool {
return obj.GetLabels()[appsv1alpha1.KeepPVCForDeletionKey] == "true"
Copy link
Member

Choose a reason for hiding this comment

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

is it necessary to introduce an extra label ? can we just checking the following logic?
!cs.Spec.ScaleStrategy.DisablePVCReuse && utilfeature.DefaultFeatureGate.Enabled(features.CloneSetPVCReuseDuringUpdate)

@kruise-bot
Copy link

@FillZpp: PR needs rebase.

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.

@ABNER-1
Copy link
Member

ABNER-1 commented Mar 19, 2025

@FillZpp I think this PR still needs some modifications related to RecreatePodWhenChangeVCTInCloneSetGate. I will submit another PR for adaptation later.

Could you please rebase master?

Copy link

stale bot commented Jun 17, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 17, 2025
@stale stale bot closed this Jun 24, 2025
@furykerry furykerry removed the wontfix This will not be worked on label Jun 25, 2025
@furykerry furykerry reopened this Jun 25, 2025
@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from fillzpp by writing /assign @fillzpp in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

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

@kruise-bot kruise-bot added the size/L size/L: 100-499 label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] support cloneset update policy not to delete pvc during recreate update
4 participants