Set WithDeterministicExternalName on generated controllers#682
Open
polds wants to merge 1 commit into
Open
Conversation
Generated controllers never passed managed.WithDeterministicExternalName, so deterministicExternalName was always false. Resources with a user-supplied (deterministic) external name could not recover from an incomplete create (external-create-pending the newest of the create-* annotations, e.g. after a provider restart mid async create): crossplane-runtime refuses to retry and the MR sticks on "cannot determine creation result - remove the external-create-pending annotation if it is safe to proceed" until the annotation is removed by hand. Derive determinism from the existing DisableNameInitializer template variable (IdentifierFromProvider sets it true, so non-deterministic; user-supplied external names leave it false, so deterministic) and pass it to the reconciler. Fixes crossplane#681 Signed-off-by: Peter Olds <2372558+polds@users.noreply.github.com>
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
Generated controllers never pass
managed.WithDeterministicExternalName, sodeterministicExternalNameis always false for every upjet resource. A resource with a user-supplied (deterministic) external name then cannot recover from an incomplete create: ifexternal-create-pendingends up the newest of the three create-* annotations (for example the provider restarts mid async create), crossplane-runtime refuses to retry and the MR sticks indefinitely on:crossplane-runtime already handles this safely: with
deterministicExternalNametrue it logs "proceeding due to deterministic external name" and continues, because re-queuing a deterministically named resource cannot leak one. This passes that flag, derived from the existingDisableNameInitializertemplate variable (IdentifierFromProvidersets it true, so non-deterministic; user-supplied external names leave it false, so deterministic).Fixes #681
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
make reviewablepasses (generate is a no-op, lint and unit tests green). I also rendered the changed template fragment directly to confirm the output:DisableNameInitializertrue yieldsmanaged.WithDeterministicExternalName(false), false yields(true). No committed golden/fixture controllers reference these opts, so there is nothing to regenerate.