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

Harmonize finalizer addition across all controllers #4730

Closed
timebertt opened this issue Sep 27, 2021 · 11 comments
Closed

Harmonize finalizer addition across all controllers #4730

timebertt opened this issue Sep 27, 2021 · 11 comments
Labels
area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)

Comments

@timebertt
Copy link
Member

How to categorize this issue?

/area robustness
/kind enhancement

What would you like to be added:

From #4696 (comment):

In some controllers (e.g. shoot controller) we return nil after adding the finalizer and wait for an update watch event to prevent duplicated reconciliations (see #2364).
However, a majority of the other controllers behaves differently and presumably does duplicated/unwanted reconciliations.

We should harmonize the behavior in all our controllers to

  • prevent duplicated reconciliations
  • cause less confusion along developers and have a good template for new controllers

Ideas would be

  • a) adopt the logic from the shoot controller everywhere (return nil after adding finalizer)
  • b) changing the update event handlers to enqueue objects only when the generation changed (instead of comparing metadata.generation and status.observedGeneration), this is also what controller-runtime supports out of the box with predicate.GenerationChangedPredicate (see Optimize finalizer addition #4696 (comment))
@timebertt timebertt added the kind/enhancement Enhancement, improvement, extension label Sep 27, 2021
@gardener-robot gardener-robot added the area/robustness Robustness, reliability, resilience related label Sep 27, 2021
@BeckerMax
Copy link
Contributor

/priority 4

@gardener-robot gardener-robot added the priority/4 Priority (lower number equals higher priority) label Nov 15, 2021
@shafeeqes
Copy link
Contributor

/assign

@rfranzke
Copy link
Member

rfranzke commented May 2, 2022

@shafeeqes Can you please describe what is missing here after #5683?

@shafeeqes
Copy link
Contributor

b) changing the update event handlers to enqueue objects only when the generation changed (instead of comparing metadata.generation and status.observedGeneration), this is also what controller-runtime supports out of the box with predicate.GenerationChangedPredicate

since all the controllers are not yet refactored.

@rfranzke
Copy link
Member

rfranzke commented May 2, 2022

Thanks @shafeeqes. As discussed earlier in our meeting, let's
/close
this issue for now since the main motivation (preventing duplicate reconciliations) was tackled. We might optimize the other suggestion as part of #4251, however there is no immediate necessity to pursue this task outside of the planned controller-runtime refactoring activities.

@gardener-prow gardener-prow bot closed this as completed May 2, 2022
@gardener-prow
Copy link
Contributor

gardener-prow bot commented May 2, 2022

@rfranzke: Closing this issue.

In response to this:

Thanks @shafeeqes. As discussed earlier in our meeting, let's
/close
this issue for now since the main motivation (preventing duplicate reconciliations) was tackled. We might optimize the other suggestion as part of #4251, however there is no immediate necessity to pursue this task outside of the planned controller-runtime refactoring activities.

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.

@oliver-goetz
Copy link
Member

oliver-goetz commented Nov 21, 2022

@timebertt @rfranzke after implementing b) finalizers are not enforced anymore. When finalizers are removed by someone/something else the reconciler does not add them unless a change which affects the generation happens or the controller is restarting.
Is this an accepted side effect or a bug?

@timebertt
Copy link
Member Author

Is there a difference in this regard between a) and b)?
I think forcefully removing the finalizers is always a dangerous operation and is generally not prevented (e.g., LB services, PVCs, PVs).
It should not be protected because sometimes that's the only way to get rid of resources, however you should know what you're doing 😄

@oliver-goetz
Copy link
Member

Other controllers do the same, that's true 👍
I just checked for b) because it is on my agenda now. However, there might be not much to do anyway. I have the impression most of our controllers are already adapted this way.

@rfranzke
Copy link
Member

This sounds good @oliver-goetz, please confirm :) If there is nothing to be done, even better!

@oliver-goetz
Copy link
Member

It is harmonized at most refactored controllers, but the more I check, the more places I find, where it's not done yet 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)
Projects
None yet
Development

No branches or pull requests

6 participants