-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add provision to update the CSP issuer to TCSP #793
Conversation
4b65a11
to
ff3fc60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. This will be really useful once the backend is ready to switch to TCSP. Just one minor comment but otherwise LGTM.
} | ||
// if all the contexts are updated successfully, update the flag in the data store | ||
if updateSuccess { | ||
_ = datastore.SetDataStoreValue(isCLIContextsUpdatedToTCSPIssuers, &updateSuccess) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we show a log message to the user that all the contexts have been migrated to TCSP and tokens have been invalidated? That way, users might not be surprised when the interactive login happens again and it points to a new location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Adding the log is useful to inform user about the changes. I updated the PR with the new log message as shown below. Thanks
The CLI contexts have been updated to use the Tanzu CSP issuer. Any existing tokens obtained through interactive login are now invalid and CLI will automatically obtain a new token through interactive login using the new Tanzu CSP issuer
ff3fc60
to
002ea08
Compare
- Add provision through central configuration to update the CSP issuer from VCSP to TCSP. Also added an option in central configuration so that CLI can react to the configuration flag set in central configuration to update the issuers in the already created contexts. Signed-off-by: Prem Kumar Kalle <[email protected]>
002ea08
to
543c695
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks 🚀
What this PR does / why we need it
This PR adds provision to update the CSP issuer to TCSP
Summary of changes:
Which issue(s) this PR fixes
Fixes #
Describe testing done for PR
API_TOKEN testing:
$HOME/.config/tanzu/.data-store.yaml
file doesn't the entryisCLIContextsUpdatedToTCSPIssuers: true
. (This would be set once we set thecli.core.tanzu_cli_config_csp_issuer_update_flag: true
on a cutover date to update the current CLI contexts created using the old CLI version or current CLI version using the VCSP Issuer. If we set the update the flag to true the contexts issuers would be updated to TCSP.)Now set the
cli.core.tanzu_cli_config_csp_issuer_update_flag: true
in the central config file~/.cache/tanzu/plugin_inventory/default/central_config.yaml
and run any command and verify the context is updated with TCSP issuer.Interactive login test
~/.config/tanzu/.data-store.yaml
toisCLIContextsUpdatedToTCSPIssuers: false
TAP pre-integration
organization using interactive login as shown belowTANZU_CLI_USE_TANZU_CLOUD_SERVICE_PROVIDER
and verify both contexts works.Verified the refresh tokens are obtained from the respective issuers (issuer stored in CLI contexts) for both contexts.(You can do that by modifying the expiration time to past time frame so that CLI would automatically refresh it.
Now verify that by updating the central config to update the CLI contexts to new Issuer, the
TAP_pre-integration-staging-d03c5c97
context created using VCSP would be updated to new Issuer(and existing tokens are invalidated) and when we try to access the UCP plugin list it should trigger the Interactive login and fetch the access token from the new issuer. (Please setcli.core.tanzu_cli_config_csp_issuer_update_flag: true
in "~/.cache/tanzu/plugin_inventory/default/central_config.yaml" so that CLI would update the issuer to new issuer URL and deactivate the interactive login tokens )Release note
Additional information
Special notes for your reviewer