Fixed tenant operator target label behavior #430
Merged
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.
Description
This PR fixes a little bug in the tenant operator related to the targetLabel behavior. The bug is that the filter performed at the event-level in the
SetupWithManager
function does not apply when entering the reconcile after returning from the previous reconcile with a non-nilRequeeAfter
. This causes the resource to be reconciled by contrasting operators.How it has been discovered
The issue appeared after changing the label on a tenant from
production
topre-production
. Doing this, the tenant will be later reconciled by thepre-production
operator. But on the last reconcile performed by theproduction
operator, aRequeAfter
set the next reconcile in 1-2 hours, which will not be filtered by the event-filter mentioned before and will change the label on all resources related to the tenant (namespaces, roleBindings,..). This behavior leaves the label on the tenant with the valuepre-production
but effectively brings back the tenant frompre-production
toproduction
through the change on every related resource.Note
The fix is not the best solution. The best solution would be probably trying to update the
controller-runtime
dependencies to the latest version and see if this has been fixed., if not, we could write to thekubeBuilder
guys.How Has This Been Tested?
This has been tested manually using kind locally