crossplane-contrib / function-cel-filter

Conditionally filter composed resources using CEL
Apache License 2.0
4 stars 2 forks source link

'policy.fromFieldPath: Required': spec.xxx: no such field #24

Open haarchri opened 5 months ago

haarchri commented 5 months ago

What happened?

So, we added the function-cel-filterafter initially trying to use it embedded in function-patch-and-transform. Now, we're facing an issue where using function-cel-filter to filter resources causes required patches to fail in function-patch-and-transform, resulting in the XR getting READY: False. Does anyone have an idea for a workaround for this behavior?

kubectl get xinit
NAME                     CROSSPLANE     SYNCED   READY   COMPOSITION               AGE
space-seed-j29p9-j8fq5   v1.15.2-up.1   True     False   xinit.spaces.upbound.io   13m
  Warning  ComposeResources         4m57s (x14 over 10m)  defined/compositeresourcedefinition.apiextensions.crossplane.io  Pipeline step "patch-and-transform": not adding new composed resource "external-dns-irsa" to desired state because "CombineFromComposite" patch at index 2 has 'policy.fromFieldPath: Required': spec.parameters.operators.externaldns: no such field

How can we reproduce it?

What environment did it happen in?

Function version:

negz commented 5 months ago

Are you saying a patch from a required field fails if the CEL filter function prevents the required field from existing (e.g. by filtering the resource)? Or something else?

haarchri commented 5 months ago

I filter resources using cel-filter, but this runs after P&T. This causes P&T to fail because some filtered resources have required fields that are not available.

haarchri commented 5 months ago

let me add an reproducer