eventing
eventing copied to clipboard
Event Discovery: Add Variables to EventType V1Beta3 spec
Problem In the new v1beta3 api for eventtypes, we are allowing users to place "variables" into template strings for the various eventtype attributes. It would be good to allow users to give more information about what values are allowed for those variables.
To accomplish this, we can add a variables
section to the spec like this:
apiVersion: eventing.knative.dev/v1beta3
kind: EventType
spec:
reference:
...
attributes:
- name: "type"
value: "event.{requestStatus}.foo"
required: true
...
variables:
- name: "requestStatus"
pattern: "req_est.%"
example: "request.failed"
cc @pierDipi @matzew @dsimansk
I'd love to get some feedback on this idea
@pierDipi can we discuss this at the WG call this week? I need a decision on how we are planning to proceed here for #7883
Was there any outcome on that discussion?
@matzew I think the decision was that we would aim to include this, as long as people were happy with the API. Any thoughts on the API proposed here/anything you would change?
Any thoughts on the API proposed here/anything you would change?
attributes:
- name: "type"
value: "event.{requestStatus}.foo"
required: true
...
variables:
- name: "requestStatus"
regex: "[a-zA-Z]"
example: "request.failed"
so for reconciling these, we would expect that if {variables}
are used, it MUST have variables
section, containing those that are specified. Otherwise: not getting to ready
state.
For the implementation, I guess we could just rely on simple regex library? Should we prevent some parts? Expressions and templating always causes hell of problems. Does CE-SQL have something?
so for reconciling these, we would expect that if {variables} are used, it MUST have variables section, containing those that are specified. Otherwise: not getting to ready state.
Yeah, I think that makes sense to me, we might also want to verify that the example
in the variable is allowable based on the pattern for the variable
Does CE-SQL have something?
For CESQL, it doesn't support full regex matches instead it allows for a wildcard character %
that matches any number of wildcard characters and another wildcard character _
that matches exactly one wildcard character. This would simplify the templating allowed for the variables a lot I think, which should make it easier to manage.
Yeah, I think that makes sense to me, we might also want to verify that the example in the variable is allowable based on the pattern for the variable
I agree, so we have a set of "scoped" rules
This would simplify the templating allowed for the variables a lot I think, which should make it easier to manage.
some reuse possible?
Yeah I think the reuse would make this easier, and also would make implementing the event lineage matches easier too! I've updated the proposed API to have the pattern
match the CESQL syntax, instead of being a regex
. @matzew @pierDipi are we good to move forwards with this?
@pierDipi quick ping here - are you good with moving forwards with the CESQL LIKE
syntax here?