Skip to content

Conversation

@bigkevmcd
Copy link
Contributor

@bigkevmcd bigkevmcd commented Oct 10, 2024

This implementation allows filtering of wildcarded resources for receivers using CEL expressions.

Closes: #491

Spec: #491 (comment)

@bigkevmcd
Copy link
Contributor Author

bigkevmcd commented Oct 10, 2024

@stefanprodan @matheuscscp I reworked it to filter the resources using CEL.

I'm not quite sure that this is really that valuable, I suspect label filtering is also more efficient?

There's some optimisation of the CEL that could be done within requestReconciliation to reduce the creation of CEL values and I can do that but I thought I'd get this out for comment.

@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 4969c46 to 1fe996b Compare October 10, 2024 05:40
@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch 3 times, most recently from d87dbfd to b1c4e7e Compare October 10, 2024 19:03
@stefanprodan stefanprodan changed the title CEL Resource Filtering Implement Receiver resource filtering with CEL Oct 11, 2024
@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 45bd724 to 1e6929c Compare October 13, 2024 14:57
@bigkevmcd bigkevmcd marked this pull request as ready for review October 13, 2024 15:18
@bigkevmcd bigkevmcd marked this pull request as draft October 16, 2024 07:30
@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 1e6929c to d658d4a Compare October 17, 2024 08:46
@bigkevmcd bigkevmcd marked this pull request as ready for review October 17, 2024 08:54
Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

Thanks again for all the work here, @bigkevmcd! I'm very excited for this feature 😄

This is just a preliminary review. I will try to review this again soon.

@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch 4 times, most recently from 5a22c4f to bddfd56 Compare October 18, 2024 13:06
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @bigkevmcd 🥇

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @bigkevmcd! Pretty cool contribution 👍

@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch 6 times, most recently from 8e892ef to 18c1f31 Compare November 1, 2024 14:34
@stefanprodan
Copy link
Member

@bigkevmcd this is good to go, please signoff all your commits and force push.

@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 8a9e435 to 57c36b0 Compare November 1, 2024 20:58
@darkowlzz darkowlzz added the area/api API related issues and pull requests label Nov 4, 2024
@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 348c595 to 2636e01 Compare November 10, 2024 16:52
@bigkevmcd
Copy link
Contributor Author

@darkowlzz It'll be a couple of weeks before I can devote more time to these things, but I will get to them.

@bigkevmcd bigkevmcd force-pushed the cel-resource-filtering branch from 891a42c to 757f96d Compare November 13, 2024 17:44
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Almost concluding my CEL research with this. I don't think there's any hurry. This can be addressed whenever you're back to it. 🙂

Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

@bigkevmcd really good stuff, I am looking forward to seeing this landing. 🙇

@bigkevmcd
Copy link
Contributor Author

@pjbgf

+1 on leaning on k8s' default limits as a starting point. It might be worth just confirming whether the payload and expression sizes for this use case are equivalent, so that those limits would not be too forgiving.

https://github.com/kubernetes/kubernetes/blob/cf480a3a1a9cb22f3439c0a7922822d9f67f31b5/staging/src/k8s.io/apiserver/pkg/apis/cel/config.go#L40

That's 3MiB, I've definitely seen GitHub hook notifications that were > 1.5MiB.

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

New batch of comments ❤️

Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

Still need to go over internal/server/receiver_handlers.go once again

@matheuscscp
Copy link
Member

matheuscscp commented Jan 31, 2025

@bigkevmcd we have released the fluxcd/pkg packages, please pull them in with:

🙏

Edit: Like Stefan said below, just need to rebase.

@stefanprodan
Copy link
Member

@bigkevmcd if you rebase with main, you'll find runtime/cel and the InvalidCELExpressionReason.

Signed-off-by: Kevin McDermott <[email protected]>
Co-authored-by: Matheus Pimenta <[email protected]>
@matheuscscp matheuscscp force-pushed the cel-resource-filtering branch from be22b2b to 28deef9 Compare February 10, 2025 16:22
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

🚀

@stefanprodan stefanprodan merged commit 2eb3c35 into fluxcd:main Feb 11, 2025
6 checks passed
@matheuscscp
Copy link
Member

Thanks very much for this contribution @bigkevmcd ! 🚀 🚀 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API related issues and pull requests area/receiver Webhook receiver related issues and PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtering for incoming webhooks

5 participants