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

Add a check for only lustrefilesystem finalizer before delete #45

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

bdevcich
Copy link
Contributor

@bdevcich bdevcich commented Nov 2, 2023

This ensures that the PV/PVC cannot be removed while something is still
using it (e.g. NNF Data Movement).

Signed-off-by: Blake Devcich blake.devcich@hpe.com

This ensures that the PV/PVC cannot be removed while something is still
using it (e.g. NNF Data Movement).

Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
// At this point, only our finalizer should be present before access is deleted. If not,
// requeue until they are gone.
if !onlyLustreFinalizer(fs) {
return ctrl.Result{Requeue: true}, nil

Choose a reason for hiding this comment

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

I don't think you need a requeue here. When a finalizer is deleted, that will generate an event and the reconciler will run

// Check to see that only the lustre filesystem finalizer exists
onlyLustreFinalizer := func(o client.Object) bool {
f := o.GetFinalizers()
if len(f) == 1 && f[0] == finalizerLustreFileSystem {
Copy link
Contributor

Choose a reason for hiding this comment

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

We got past line 85, so we've already confirmed that the finalizer owned by this controller is present. I think, before line 85 you want to know if there are other finalizers, and return if they are present.

@bdevcich bdevcich merged commit 3b0c55a into master Nov 3, 2023
2 checks passed
@bdevcich bdevcich deleted the delete-finalizer-check branch November 3, 2023 19:16
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.

None yet

3 participants