Skip to content
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

CloneSet supports to reuse PVC during upgrade #1881

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 142 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.

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
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
2 participants