Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a hosted cluster is removed from OCM, it triggers the hosted cluster instance of the config-policy-controller to be uninstalled on the hosting cluster.
If any ConfigurationPolicy uses pruneObjectBehavior, they will have finalizers set on them. During an uninstall, the finalizers are immediately removed on the next evaluation of the ConfigurationPolicy with pruneObjectBehavior set so that the uninstall can proceed immediately.
The issue is if the ConfigurationPolicy sets evaluationInterval to a long value, the finalizer won't be removed until the next evaluation time, which could be hours.
This is not an issue when it's not deployed in hosted mode because the CRD is also deleted at the same time, which causes the ConfigurationPolicy to have a deletionTimestamp which then causes immediate evaluation for the finalizer to be removed.
Without the second commit, as soon as a SIGINT signal was received, mgr.Start would exit and cause the main function to finish before PeriodicallyExecConfigPolicies could finish the removal of finalizers when the config-policy-controller is being uninstalled.
Relates:
https://issues.redhat.com/browse/ACM-3233
Signed-off-by: mprahl mprahl@users.noreply.github.com