CFP: Cilium policy selector expression#94
Conversation
Signed-off-by: Deepesh Pathak <deepeshpathak09@gmail.com>
65eab75 to
56b17c0
Compare
|
Should we set a cost limit for CEL expressions? It could be caught in the Sanitize function(). We can always increase the cost limit, but never decrease it :-/. |
|
Could you also draft some specific user stories about selections they would like to do? I think that would help to inform what the solution should look like in order to satisfy the intent of our users. |
| #### Option 2: CEL Expression | ||
|
|
||
| A more natural option for the use-case is to use CEL(Common Expression Language) based expression for label selectors. Cilium already imports the `cel-go` library and has experimental support for CEL based expression language in hubble filters. This option will give us the opportunity to build a strong foundation for CEL usage in Cilium project, allowing easier adoption for similar usecases in future. | ||
|
|
There was a problem hiding this comment.
We should probably include some examples here, along with the expected CEL variables and functions we intend to expose.
There was a problem hiding this comment.
I was thinking of keeping the implementation details separate from the high level CFP. I am working on the implementation of CEL env here. Do you think it makes sense to keep this detailed documentation there(working on a package level README) or should I include everything here?
There was a problem hiding this comment.
I would say that the CEL environment is probably worth briefly discussing, since it's essentially unchangeable once landed. We don't need to consider every possible function
|
So, I'm thinking about the existing Anyways. From your comments, it seems that looking up labels via function calls is expensive. What the environment had a single variable, map[string]struct{
Value string `cel:"value"`
Source string `cel:"source"`
}
env, err := cel.NewEnv(
ext.NativeTypes(
ext.ParseStructTag("cel"),
reflect.TypeFor[*Label](),
),
cel.Variable("labels",
cel.MapType(cel.StringType, cel.ObjectType("main.Label"))),
)We could even add some useful macros, like |
No description provided.