Skip to content

add arbitrary expression to CelExpression#115

Closed
zirain wants to merge 3 commits into
cncf:mainfrom
zirain:cel_expr
Closed

add arbitrary expression to CelExpression#115
zirain wants to merge 3 commits into
cncf:mainfrom
zirain:cel_expr

Conversation

@zirain

@zirain zirain commented Feb 8, 2025

Copy link
Copy Markdown

this's suggested by @yanavlasov in envoyproxy/envoy#38182 (comment)

it's useful in envoy when there's no control plane.

cc @yanavlasov @htuch

Comment thread xds/type/v3/cel.proto
Comment thread xds/type/v3/cel.proto
Comment thread xds/type/v3/cel.proto Outdated
Signed-off-by: zirain <[email protected]>
Signed-off-by: zirain <[email protected]>
@zirain
zirain requested a review from adisuissa February 13, 2025 02:07
Comment thread xds/type/v3/cel.proto
cel.expr.CheckedExpr cel_expr_checked = 4;

// Expression in abstract syntax tree (AST) form.
// This's useful when there's no control plane(e.g. XDS from file).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry, I don't fully understand what's the realtionship between having a dynamic control-plane and having it in a file.
Can you shed some light here?

Also, are there any constraints for this field, or is there some format that needs to be used?
Will a generic string, e.g. "abc", make sense in this case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Previous context is here, suggested by @yanavlasov.

I agree with that it's hard to send cel.expr.CheckedExpr when uses using file for xds instead of a control plane, or maybe I missed something.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

it's a little painful to write something like following:

    expression:
        parsed_expr:
          expr:
            id: 4
            call_expr:
              function: _!=_
              args:
              - id: 3
                select_expr:
                  field: id
                  operand:
                    id: 2
                    select_expr:
                      field: node
                      operand:
                        id: 1
                        ident_expr:
                          name: xds
              - id: 5
                const_expr:
                  string_value: "node_name"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The use case is simple deployment or tests where it is easier to make Envoy parse the CEL expression, rather than having to specify the AST proto.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree it's easier, but it is unclear what the format that is used here (perhaps add a link).
FWIW, I hope it is being validated, and the config is rejected if the string is invalid.

@zirain
zirain requested a review from adisuissa March 8, 2025 08:46
@zirain zirain closed this Mar 24, 2025
@zirain
zirain deleted the cel_expr branch March 24, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants