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

Issue #8772 ensure pv removed #8777

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ix-rzi
Copy link

@ix-rzi ix-rzi commented Mar 11, 2025

Thank you for contributing to Velero!

Please add a summary of your change

The node-agent does not wait for the PV to be removed on the cluster before deleting the VolumeSnapshot. The change
lets the node-agent wait for the PV to be removed from the cluster before removing the VS.

Does your change fix a particular issue?

Fixes #8772

Please indicate you've done the following:

ix-rzi added 4 commits March 11, 2025 16:07
Signed-off-by: Roger Zimmermann <[email protected]>
Signed-off-by: Roger Zimmermann <[email protected]>
Signed-off-by: Roger Zimmermann <[email protected]>
Signed-off-by: Roger Zimmermann <[email protected]>

Signed-off-by: Roger Zimmermann <[email protected]>
@ix-rzi ix-rzi force-pushed the Issue-#8772-ensure-pv-removed branch from 50f5141 to 081eb46 Compare March 11, 2025 15:08
@ix-rzi
Copy link
Author

ix-rzi commented Mar 11, 2025

Don't think there is something to update in the docs, but I might be mistaken.

@ix-rzi ix-rzi marked this pull request as ready for review March 11, 2025 15:27
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 59.55%. Comparing base (1516e72) to head (081eb46).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pkg/util/kube/pvc_pv.go 81.81% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8777      +/-   ##
==========================================
+ Coverage   59.53%   59.55%   +0.01%     
==========================================
  Files         371      371              
  Lines       40196    40258      +62     
==========================================
+ Hits        23932    23975      +43     
- Misses      14767    14782      +15     
- Partials     1497     1501       +4     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -74,6 +74,10 @@ func DeletePVAndPVCIfAny(ctx context.Context, client corev1client.CoreV1Interfac
if err := EnsureDeletePVC(ctx, client, pvcName, pvcNamespace, ensureTimeout); err != nil {
log.Warnf("failed to delete pvc %s/%s with err %v", pvcNamespace, pvcName, err)
}

if err := EnsureDeletePV(ctx, client, pvcObj.Spec.VolumeName, ensureTimeout); err != nil {
log.Warnf("pv %s was not removed with err %v", &pvcObj.Spec.VolumeName, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we pass a pointer (of pvcObj.Spec.VolumeName) here for %s?

Copy link
Member

Choose a reason for hiding this comment

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

good catch..

Suggested change
log.Warnf("pv %s was not removed with err %v", &pvcObj.Spec.VolumeName, err)
log.Warnf("pv %s was not removed with err %v", pvcObj.Spec.VolumeName, err)

@@ -157,6 +161,37 @@ func EnsureDeletePVC(ctx context.Context, pvcGetter corev1client.CoreV1Interface
return nil
}

// EnsureDeletePV ensures a PV has been deleted. This function is supposed to be called after EnsureDeletePVC
// If timeout is 0, it doesn't wait and return nil
func EnsureDeletePV(ctx context.Context, pvGetter corev1client.CoreV1Interface, pvName string, timeout time.Duration) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to have the name as EnsurePVDeleted since we don't make any deletion as same as other EnsureDelete* functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node-agent not waiting for PV removal
3 participants