Skip to content
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

Multiple Resolver resolution results in infinite patching #694

Open
sdischer-sap opened this issue May 17, 2024 · 2 comments
Open

Multiple Resolver resolution results in infinite patching #694

sdischer-sap opened this issue May 17, 2024 · 2 comments
Labels
bug Something isn't working stale

Comments

@sdischer-sap
Copy link

What happened?

We found a reproducable inconsistancy when persisting resolved references. Basically whenever you have more then one reference and one of them is resolved in a later reconcilation loop then the first one patching this newly resolved value will purge previously resolved values at the same time, which will result in an endless loop of patching different values back and forth.

Debugging this issue showed that the issue must lie in the way that the change is send as a server-sided apply in this line:
https://github.com/crossplane/crossplane-runtime/blob/master/pkg/reconciler/managed/api.go#L193

Just FYI, doing the same patch from kubectl using a merge patch instead worked as expected.

How can we reproduce it?

A reproducable case can be easily reproduce in this example provider: https://github.com/mirzakopic/provider-xp-bug
You will find a mytype Kind having two references towards other kinds called sometype and othertype.
The issue appears when you first apply the mytype with only one reference and reapply another version with both references being set.

You can reproduce that with the provider using this flow:

  1. (Setup the provider in a local environment)
  2. kubectl apply -f examples/sample/mytype.yaml
  3. kubectl apply -f examples/sample/mytype_added_ref.yaml

Screenflow of endless resolving:
refresolverpatchbugxp (1)

What environment did it happen in?

Crossplane version:
1.16 and 1.15 (but should apply to older versions as well(

@sdischer-sap sdischer-sap added the bug Something isn't working label May 17, 2024
Copy link

github-actions bot commented Sep 3, 2024

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Sep 3, 2024
@MrVinkel
Copy link

MrVinkel commented Sep 9, 2024

We are seeing the same issue.

We have copied the resolver from crossplane-runtime and used apimachinery ExtractInto to extract the managed fields and added them to the JSON patch. This makes it so the patch always contains all the fields the reference resolver owns plus the resolved refs and stops the infinite patching.

I'm not sure this is the correct way or if there is a better way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants