-
Notifications
You must be signed in to change notification settings - Fork 50
feat: Enhance nomos vet with flag validation and raw resource processing #1926
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
base: main
Are you sure you want to change the base?
feat: Enhance nomos vet with flag validation and raw resource processing #1926
Conversation
|
Hi @cowsking. Thanks for your PR. I'm waiting for a GoogleContainerTools member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Summary of ChangesHello @cowsking, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Code Review
This pull request enhances the nomos vet command by introducing a --no-api-server-check-for-group flag to skip API server validation for specific resource groups, which resolves an issue with OPA Gatekeeper resources. The changes include adding the new flag, implementing validation to ensure it's not used with the existing --no-api-server-check flag, and updating the resource processing logic to respect the new flag. The accompanying tests are a good addition. My review includes a critical fix to prevent unintended error suppression and a suggestion to improve test robustness.
|
/ok-to-test |
|
@cowsking: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
d866819 to
579caba
Compare
|
/ok-to-test |
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.
Pull Request Overview
This PR introduces a new flag --no-api-server-check-for-group to skip API server validation for specific API groups, providing a more granular alternative to the existing --no-api-server-check flag. This is particularly useful for scenarios like Gatekeeper constraint templates where the GVK may not be discoverable but should still be validated.
- Added a new utility package
gvkutilfor parsing and matching GroupKind patterns - Implemented flag exclusivity validation to prevent simultaneous use of both flags
- Integrated the new flag into the validation flow to skip errors for matching GVKs
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/util/gvkutil/gvk.go | New utility for parsing group patterns and matching GroupKind objects |
| pkg/util/gvkutil/gvk_test.go | Test coverage for the new gvkutil package |
| pkg/validate/fileobjects/raw.go | Integrated gvkutil to skip errors for matching GVKs during validation |
| cmd/nomos/flags/flags.go | Added the new --no-api-server-check-for-group flag definition |
| cmd/nomos/vet/vet.go | Added PreRunE validation to ensure flag exclusivity |
| cmd/nomos/vet/vet_test.go | Tests for flag exclusivity validation |
| e2e/testdata/gatekeeper-skip-gvk/constraint.yaml | Test data for Gatekeeper constraint |
| e2e/testdata/gatekeeper-skip-gvk/constraint-template.yaml | Test data for Gatekeeper constraint template |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
30c3ed3 to
09f4ad2
Compare
| SkipAPIServerFlag = "no-api-server-check" | ||
|
|
||
| // NoAPIServerCheckForGroupFlag is the flag name for NoAPIServerCheckForGroup below. | ||
| NoAPIServerCheckForGroupFlag = "no-api-server-check-for-group" |
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 seems pretty long... I would consider something shorter.
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.
It was designed to name as skip-gvk but we wanted it to align with no-api-server-check. go/nomos-vet-skip-gvk-dd
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.
Pull Request Overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2ac367c to
8676a36
Compare
8676a36 to
12238bd
Compare
This commit expands the nomos vet command's capabilities by:
These changes specifically address issue #1633, where nomos vet failed to validate OPA Gatekeeper custom resources when a ConstraintTemplate and its corresponding Constraint were present in the same commit. The improved raw resource processing and flag handling now allow nomos vet to correctly process such configurations, preventing the KNV1021 error.