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

SetControllerReference should allow overwriting the previous controller #2381

Closed
therealak12 opened this issue Jun 15, 2023 · 5 comments
Closed
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@therealak12
Copy link

I want to change the controller of an object. The current implementation of SetControllerReference returns an error if the new owner is different than the previous one.

Adding a new method SetControllerReferenceOverwrite can be a solution.

@vincepri
Copy link
Member

Changing the controller owner of an object is a very rare operation, which can also impact deletion flows in case of forward collection. I'd expect users to remove the older reference first, then set a new one in that case?

@therealak12
Copy link
Author

therealak12 commented Jul 11, 2023

Agree it won't be used that much, but for doing so I needed to duplicate some controller-runtime internal methods such as referSameObject and validateOwner into our code which wasn't so pleasant!

@troy0820
Copy link
Member

troy0820 commented Aug 24, 2023

/kind support

Would creating a function to remove the controller reference (RemoveControllerReference) (RemoveOwnerReference) be something as a compromise?

@troy0820
Copy link
Member

PR merged for function RemoveOwnerReference in controllerutil that should help this use case.

@therealak12
Copy link
Author

PR merged for function RemoveOwnerReference in controllerutil that should help this use case.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
4 participants