Repository navigation
Conversation
Add an optional spec.connectionSecretRecovery field to the cluster and namespaced Token (enum None or Recreate, default None) and regenerate the CRDs. The field is not an upstream parameter, so it sits next to forProvider rather than inside it. Signed-off-by: Tobias Kässer <tobias.kasser@upbound.io>
With spec.connectionSecretRecovery: Recreate, Observe no longer stops at the missing-secret error added in #37. Once an uncached read confirms the secret is missing or has no token, it deletes the upstream token (404 counts as gone), emits a RecreatingToken warning naming the old token ID and reports the token as gone, so the managed reconciler creates a new token and publishes its connection secret. Recovery is refused when the deletion policy is Orphan (cluster scope) or the effective management policies don't allow Create and Delete, and within 10 minutes of the last successful creation, so that a new token whose secret can't be published isn't recreated on every reconcile. With None, the default, only the error message changes: it names the option. Signed-off-by: Tobias Kässer <tobias.kasser@upbound.io>
Add a short Token Connection Secrets section to the quickstart and set the field in both Token examples. Signed-off-by: Tobias Kässer <tobias.kasser@upbound.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 of your changes
Follow-up to #37. The Upbound API only returns a token's JWT at creation, so when a Token MR is restored without its connection secret (for example after a control plane export/import, which typically drops Secrets), #37 surfaces an error and leaves recovery to the user: delete the upstream token by hand so it gets recreated.
This adds an opt-in way to do that automatically, keeping the current behaviour as the default:
spec.connectionSecretRecoveryon the cluster and namespaced Token:None(default) orRecreate. It isn't an upstream parameter, so it sits next toforProvider.Recreate: once an uncached read confirms the connection secret is missing or has no token,Observedeletes the upstream token (404 counts as gone), emits aRecreatingTokenwarning naming the old token ID, and reports the token as gone. The managed reconciler then creates a new token and publishes its connection secret, so the old token isn't left orphaned.Orphan(cluster scope) or the management policies don't allow Create and Delete, and within 10 minutes of the last successful creation, so a token whose secret can't be published isn't recreated on every reconcile.None: the behaviour from Fix token connection secret handling and auth session caching #37 is unchanged. Only the error message now names the option.Consumers that still hold the old token need to pick up the new secret (for example a restart), the same as with a manual rotation.
I have:
make reviewableto ensure this PR is ready for review. (Rango build ./...,go test ./...,golangci-lint run ./...andgo generate ./apis/...with a clean tree.)backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
tokenandid, only the new token remains, and one warning names the old ID. Recovery took 26–36 s (next poll).Orphanand management policies without Delete block recovery with an error that says why.