Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement CEL validation proc macro for generated CRDs #1621
Implement CEL validation proc macro for generated CRDs #1621
Changes from 2 commits
332423c
159e746
024cd08
d32bfe5
4eec7d8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
what is the first arg here for? the new proc macro seems take
args
andinput
, but you seem to be discardingargs
?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.
Probably need to be checked, they are currently empty. Could be a good place for name overrides to avoid clashes
Check warning on line 552 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L549-L552
Check warning on line 557 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L555-L557
Check warning on line 560 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L560
Check warning on line 564 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L563-L564
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.
magic names needs a comment here probably
Check warning on line 566 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L566
Check warning on line 569 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L568-L569
Check warning on line 572 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L571-L572
Check warning on line 582 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L579-L582
Check warning on line 585 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L585
Check warning on line 589 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L587-L589
Check warning on line 592 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L591-L592
Check warning on line 594 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L594
Check warning on line 596 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L596
Check warning on line 602 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L602
Check warning on line 608 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L606-L608
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.
This stuff here could do with some comments. You're implementing a method fith a fixed name. Could this ave clashing issues? Can we parametrise such a function from kube-core instead?
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.
As long as there is no structure Validation in the scope, there should not be a clash, but makes sense to add an override for such occasion 👍🏻
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.
Should be added now -
#[cel_validation(struct_name = "FooSpecValidation")]
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.
i guess i am still confused about the temporary struct you are making. it seems to me that the #[cel_validation(struct_name = X struct X is there for you to implement a method, but that method feels like something we can define cleanly inside kube-core, and invoke from kube-derive.
Check warning on line 610 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L610
Check warning on line 628 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L627-L628
Check warning on line 635 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L633-L635
Check warning on line 640 in kube-derive/src/custom_resource.rs
Codecov / codecov/patch
kube-derive/src/custom_resource.rs#L640
Check warning on line 346 in kube-derive/src/lib.rs
Codecov / codecov/patch
kube-derive/src/lib.rs#L346
Check warning on line 350 in kube-derive/src/lib.rs
Codecov / codecov/patch
kube-derive/src/lib.rs#L350