chore(linter): add new kube-api-linter and fix CRD lint issues #1985
Open
dongjiang1989 wants to merge 3 commits into
Open
chore(linter): add new kube-api-linter and fix CRD lint issues #1985dongjiang1989 wants to merge 3 commits into
dongjiang1989 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates Kubernetes API type documentation and linter configuration to satisfy newly enabled kubeapilinter checks in Go.
Changes:
- Enabled additional
kubeapilinterchecks (e.g.,jsontags,nomaps,notimestamp,nodurations) ingolangci-lintconfig. - Reworded many field doc comments to start with the JSON tag name (lowerCamel) rather than the Go field name.
- Added
//nolint:kubeapilintersuppressions for a few fields in deprecated / soon-to-change APIs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| go/api/v1alpha2/remotemcpserver_types.go | Adjusts CRD field docstrings and adds kubeapilinter suppressions for duration fields. |
| go/api/v1alpha2/modelproviderconfig_types.go | Updates field docstrings to match JSON tag names. |
| go/api/v1alpha2/modelconfig_types.go | Updates field docstrings to match JSON tag names across multiple config structs. |
| go/api/v1alpha2/common_types.go | Updates AllowedNamespaces field docstrings to match JSON tag names. |
| go/api/v1alpha2/agentharness_types.go | Updates many docstrings to match JSON tag names. |
| go/api/v1alpha2/agent_types.go | Updates many docstrings to match JSON tag names. |
| go/api/v1alpha1/toolserver_types.go | Adds kubeapilinter suppressions for deprecated API fields. |
| go/api/v1alpha1/modelconfig_types.go | Updates docstrings to match JSON tag names. |
| go/api/v1alpha1/agent_types.go | Updates A2AConfig docstring to match JSON tag name. |
| go/.golangci.yaml | Enables additional kubeapilinter checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c7fecf6 to
07c2061
Compare
Contributor
Author
|
@EItanya PTAL, thanks |
Signed-off-by: dongjiang <dongjiang1989@126.com>
Signed-off-by: dongjiang <dongjiang1989@126.com>
Signed-off-by: dongjiang <dongjiang1989@126.com>
07c2061 to
bee5af8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add the
kube-api-lintercustom golangci-lint plugin to enforce Kubernetes API conventions across CRD type definitions. The following sub-linters are now enabled:nodurations— disallowstime.Durationfields in API types (use string-based durations)noreferences— prevents use of pointer/reference types in API fieldsnotimestamp— disallowstime.Timefields in API typesjsontags— ensures JSON struct tags follow Go naming conventions (lowercase first letter)statusoptional— enforces// +optionalmarker on status subfieldsAll resulting lint violations across
v1alpha1andv1alpha2CRD types have been resolved. Most fixes involve lowercasing the first letter of JSON struct tags for compliance.