-
Notifications
You must be signed in to change notification settings - Fork 13
Description
What happened?
We have APIs containing optional fields. When these optional fields are specified, they lead to the creation of multiple resources that are sequenced by this function, for example, resource-a and resource-b.
If the optional fields are not specified, neither of these resources are created, and we expect the corresponding sequences to be ignored. Instead, we see output like so:
Normal ComposeResources 4m18s (x13488 over 7d2h) defined/compositeresourcedefinition.apiextensions.crossplane.io Pipeline step "sequence-creation": Delaying creation of resource(s) matching "resource-b" because "resource-a" does not exist yet
Clearly these are false positives. Neither resource-a or resource-b will ever be created, so it makes no sense to alert the user that resource-b is waiting on resource-a. As you can see, this leads to a lot of unnecessary events.
How can we reproduce it?
On any composition using this function, add a sequence (longer than 1 item) that will never match any resources.
I'm fairly confident the issue stems from this line:
Line 97 in 6033760
| if desired == 0 || desired != readyResources { |
Here, desired is the number of desired resources that matches the previous sequence expression. Checking and printing a warning if it's zero assumes that we are actually waiting on a resource to be created. As demonstrated above, that's not always the case.
What environment did it happen in?
Function version: v0.3.0