tenant controller: store access token instead of provider key #725
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.
https://issues.redhat.com/browse/THREESCALE-7911
what
This PR changes the tenant controller to store the access token owned by the admin user of the tenant in the tenant secret referenced in
spec.tenantSecretRef
.Before this PR, the tenant controller stored the tenant provider key in the tenant secret referenced in
spec.tenantSecretRef
. However, the provider key has permission issues for some endpoints in the 3scale Account Management API ( THREESCALE-8276 and THREESCALE-6625 and THREESCALE-7911)The desired UX would be:
system-seed
how
Storing the access token owned by the admin user of the tenant is tricky because the tenant controller only has access to it in the response of the tenant creation 3scale API call. The access token is no longer accessible. This breaks somewhat the idempotent pattern followed by the controller. So, the implementation creates the tenant and immediately (before reconciling the admin user as it used to do), saves the access token in the tenant controller and then saves the tenant ID in the Tenant CR status field. I would like to remind without the tenant ID, there is no way to access the tenant. None the fields from the tenant is unique (like product's and backend's systemName). So storing the access token in the tenant secret and the tenant ID in the status is critical to have access to the recently created tenant. If any of the previous two steps fails, the recently created tenant will not be accessible and the controller will generate a new tenant. In that case, the previous tenant will be left unused.
verification steps
Deploy 3scale with APIManager CR
Create a new tenant:
The secret
ecorp-tenant-secret
should keep the access token and not the provider key of the new tenant as it used to beThe access token, allows to create backends and products linked to that backend.
First create the backend
Then create the product with references to the backend
Both the backend and product resource status should show available condition