notification-controller icon indicating copy to clipboard operation
notification-controller copied to clipboard

Implement Receiver resource filtering with CEL

Open bigkevmcd opened this issue 1 year ago • 1 comments

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

Closes: https://github.com/fluxcd/notification-controller/issues/491

Spec: https://github.com/fluxcd/notification-controller/issues/491#issuecomment-2404615301

bigkevmcd avatar Oct 10 '24 05:10 bigkevmcd

@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 avatar Oct 10 '24 05:10 bigkevmcd

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

stefanprodan avatar Nov 01 '24 20:11 stefanprodan

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

bigkevmcd avatar Nov 13 '24 16:11 bigkevmcd

@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.

bigkevmcd avatar Nov 18 '24 19:11 bigkevmcd

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

:pray:

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

matheuscscp avatar Jan 31 '25 14:01 matheuscscp

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

stefanprodan avatar Feb 01 '25 07:02 stefanprodan

Thanks very much for this contribution @bigkevmcd ! :rocket: :rocket: :rocket:

matheuscscp avatar Feb 11 '25 08:02 matheuscscp