-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: main
Are you sure you want to change the base?
Conversation
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]>
50f5141
to
081eb46
Compare
Don't think there is something to update in the docs, but I might be mistaken. |
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
@@ -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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch..
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 { |
There was a problem hiding this comment.
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.
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:
make new-changelog
) or comment/kind changelog-not-required
on this PR.site/content/docs/main
.