Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

update finalizer #159

Closed

Conversation

huiwq1990
Copy link
Contributor

use controller-runtime to delete or update finalizer.

Signed-off-by: huiwq1990 <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 6, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: huiwq1990
To complete the pull request process, please assign deads2k after the PR has been reviewed.
You can assign the PR to them by writing /assign @deads2k in a comment when ready.

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

}

// Spoke cluster is deleting, we remove its related resources
if !managedCluster.DeletionTimestamp.IsZero() {
if err := c.removeManagedClusterResources(ctx, managedClusterName); err != nil {
return err
}
return c.removeManagedClusterFinalizer(ctx, managedCluster)
if controllerutil.ContainsFinalizer(managedCluster, managedClusterFinalizer) {
controllerutil.RemoveFinalizer(managedCluster, managedClusterFinalizer)
Copy link
Member

Choose a reason for hiding this comment

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

I hasn't take a look at the details of RemoveFinalizer, will it ensure the ordering after a deletion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't understand the ordering meaing, did you say the order of finalizes? Why we need order? RemoveFinalizer will not change finalize order.

			f = append(f[:i], f[i+1:]...)

Copy link
Member

Choose a reason for hiding this comment

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

yes, the ordering of the finalizers. Some controllers may rely on the ordering of the finalizers, it is not normal but it happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RemoveFinalizer will keep the order. By the way, could you specify which controller use this feature?

Copy link
Member

Choose a reason for hiding this comment

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

not in registration, but an external consumer (controller) could do that.

@qiujian16
Copy link
Member

This may need to run go mod tidy & go mod vendor to update the deps. The problem we met with controller-runtime is its inconsistent deps of kube related library with library-go... I think that is one of the main reason we did not use controller-runtime utility much before.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 6, 2022

@huiwq1990: 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.

@qiujian16 qiujian16 closed this Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants