fix tenant reconciliation #728
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.
Jira Issue: https://issues.redhat.com/browse/THREESCALE-8301
what
When a tenant is created declaratively, using the TenantCR, and afterwards it’s deleted from the 3scale admin portal UI, the operator starts creating tenants in an infinite loop.
how
The issue was caused by a wrong reconciliation logic that did not take into account the NOT FOUND response when reading an admin user. That returned an error, which turned up into a new reconciliation loop before the tenantID and AdminID was stored in the status section. Every new reconciliation loop ended up creatiing a new tenant.
The reconciliation loop logic has been refactored. Basically:
Verification steps
Deploy 3scale with the APIManager
Wait for the deployment to be ready
Deploy new tenant CR
From the 3scale admin portal delete the tenant created (it will not be deleted, just scheduled for deletion)
Fully delete the tenant with the rails console:
open console
delete with lines (takes few seconds)
the tenant controller should not have notified the deletion of the tenant. We need to force tenant reconciliation for our tenant CR. Either stop and start the operator or update something in the TenantCR. I usually add harmless annotation
The tenant controller should create (only) one new tenant with the CR spec.