-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for CEL marker comments #445
Conversation
variable was shadowed so indexing was off
@alexzielenski: GitHub didn't allow me to request PR reviews from the following users: Schnides123. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good. Still familiarizing myself with parts of CEL so lmk if any comments don't make sense.
ed5ea8b
to
c4daa81
Compare
cb51cdf
to
04e61a8
Compare
pkg/generators/markers.go
Outdated
subscriptIdx := strings.Index(line, "[") | ||
split := strings.Split(line, "=") | ||
if len(split) < 2 { | ||
// Ignore malformed key in linter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, just realized this is possible with bool, so in a sense it's not malformed?
The error would still get caught later on when validating empty CEL tags, not sure if you'd like to error earlier though?
Test case:
`+k8s:validation:cel[0]:rule="oldSelf == self"`,
`+k8s:validation:cel[6]:optionalOldSelf`,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error would still get caught later on when validating empty CEL tags, not sure if you'd like to error earlier though?
The linter is not meant to catch those types of errors. Just avoid common mistakes labelling array indices
actually, just realized this is possible with bool, so in a sense it's not malformed?
That's a good catch. Ill add a test and fix that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed & added tests
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexzielenski, Jefftree The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
7beda1b
to
85574cf
Compare
squashed, @Jefftree can you re-lgtm? |
/hold cancel |
/lgtm |
Adds CEL marker comments support to kube-openapi. Previous extension support only allowed strings. This PR makes use of new marker comment system introduced in #435 to emit CEL vendor extensions.
Multiline syntax is not yet supported. Proposed syntax is 1:1 with CEL CRD fields:
There are linter errors to help keep the indexing straight
/assign @Jefftree
/cc @Schnides123