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

fix: Mark composite as unready if resources are skipped #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MisterMX
Copy link
Contributor

@MisterMX MisterMX commented Jul 26, 2024

This small fix marks the desired composite as unready in the response if one of the resource templates is skipped due to a missing required patch path.

Related to #12.
Fixes #152

Comment on lines +276 to +278
if skipped > 0 {
rsp.GetDesired().GetComposite().Ready = fnv1beta1.Ready_READY_FALSE
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't think this'll work. Functions can't directly specify the readiness of the XR, they're supposed to influence it by specifying the readiness of composed resources.

https://github.com/crossplane/function-sdk-go/blob/29ea8ddbfa554ede602e4ca7f13c5883112159a3/proto/v1beta1/run_function.proto#L230-L231

Obviously that makes this tricky, given Crossplane wouldn't even know the composed resource exists in this case. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tests turned out, that it is not working as expected since the ready state of the composite is hardcoded in crossplane to be determined by the ready state of the composed resources.

We have implemented a workaround that sets an arbitrary composed resource to unready until a set of dependent resources is available. Its more like a hack than an actual solution but it seems to be the only way to prevent this issue at the moment.

@negz are there any plans to change this behaviour in the implementation of the function renderer of Crossplane? It is very confusing that the ready field exists but is not recognized at all.

@MisterMX
Copy link
Contributor Author

Closing since it does not actually solve the problem due to Crossplane ignoring the ready property for composite resources.

We solved this problem in a custom function implementation by keeping an arbitrary resource explicitly as unready until all other resources exist. Then the regular readiness checks takes over.

@phisco
Copy link
Collaborator

phisco commented Nov 8, 2024

This should now work, but we'll need to bump the function-sdk-go dependency once we bump it to crossplane/crossplane#6021

@phisco
Copy link
Collaborator

phisco commented Nov 8, 2024

Ah no, actually this will just be ignored, there was no schema change! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report XR as not ready if required patch failing
3 participants