Repository navigation
fix(resource): tolerate existing usage in Track - #1270
jonasz-lasut wants to merge 1 commit into
Conversation
Track gets the ProviderConfigUsage and creates it when the get returns NotFound. With a cache-backed client a second Track for the same managed resource, run before the informer has seen the first create, gets NotFound again, and its create fails with AlreadyExists: cannot apply ProviderConfigUsage: cannot create object: providerconfigusages.gcp.m.upbound.io "<uid>" already exists Upjet providers call Track twice per reconcile, from the reconciliationpolicy wrapper and from Connect, so every new managed resource fails its first reconcile and emits a warning event. The double call was read from provider code; the cache lag is inferred from the code, not observed at runtime. Track and the legacy tracker's Track now ignore AlreadyExists from the apply, next to IsNotAllowed. APIUpdatingApplicator is unchanged, so its other callers still get the error. If the existing usage references a different ProviderConfig it is left as is until the next Track, whose get finds it and updates it through AllowUpdateIf. Reported in crossplane-contrib/provider-upjet-gcp#1067. Signed-off-by: Jonasz Małecki <jonasz@upbound.io>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Closing, we decided to resolve it on provider level by splitting providerconfig resolution to read and write paths |
Description of your changes
Fixes crossplane-contrib/provider-upjet-gcp#1067
With a cache-backed client, a second
Trackfor the same managed resource can run before the informer has seen theProviderConfigUsagethe first one created: itsGetreturns NotFound, itsCreatereturns AlreadyExists, and the reconcile fails withcannot apply ProviderConfigUsage: cannot create object: providerconfigusages.gcp.m.upbound.io "c9c357e2-1f8a-4065-a6d3-8d2044781bfd" already exists. Upjet providers callTracktwice per reconcile, from thereconciliationpolicywrapper and fromConnect, and crossplane-contrib/provider-upjet-gcp#1067 reports every new managed resource failing its first reconcile this way in some cases.ProviderConfigUsageTracker.TrackandLegacyProviderConfigUsageTracker.Tracknow ignore AlreadyExists from the apply, next toIsNotAllowed.APIUpdatingApplicatoris unchanged, so its other callers still get the error. If the existing usage references a different ProviderConfig, it's left as is until the nextTrack, whoseGetfinds it and updates it throughAllowUpdateIf.TestTrackModernandTestTrackLegacyeach have a newAlreadyExistscase that runsTrackthroughNewAPIUpdatingApplicatorwith a mock client returning NotFound fromGetand AlreadyExists fromCreate.I have:
./nix.sh flake checkto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.