Skip to content

chore(linter): add new kube-api-linter and fix CRD lint issues #1985

Open
dongjiang1989 wants to merge 3 commits into
kagent-dev:mainfrom
dongjiang1989:add-new-kube-api-linter
Open

chore(linter): add new kube-api-linter and fix CRD lint issues #1985
dongjiang1989 wants to merge 3 commits into
kagent-dev:mainfrom
dongjiang1989:add-new-kube-api-linter

Conversation

@dongjiang1989

Copy link
Copy Markdown
Contributor

Add the kube-api-linter custom golangci-lint plugin to enforce Kubernetes API conventions across CRD type definitions. The following sub-linters are now enabled:

  • nodurations — disallows time.Duration fields in API types (use string-based durations)
  • noreferences — prevents use of pointer/reference types in API fields
  • notimestamp — disallows time.Time fields in API types
  • jsontags — ensures JSON struct tags follow Go naming conventions (lowercase first letter)
  • statusoptional — enforces // +optional marker on status subfields

All resulting lint violations across v1alpha1 and v1alpha2 CRD types have been resolved. Most fixes involve lowercasing the first letter of JSON struct tags for compliance.

Copilot AI review requested due to automatic review settings June 9, 2026 07:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 kubeapilinter checks (e.g., jsontags, nomaps, notimestamp, nodurations) in golangci-lint config.
  • Reworded many field doc comments to start with the JSON tag name (lowerCamel) rather than the Go field name.
  • Added //nolint:kubeapilinter suppressions 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.

Comment thread go/api/v1alpha2/remotemcpserver_types.go
Comment thread go/.golangci.yaml
Comment thread go/api/v1alpha1/toolserver_types.go
Comment thread go/api/v1alpha1/toolserver_types.go
Comment thread go/api/v1alpha1/toolserver_types.go
Comment thread go/api/v1alpha2/common_types.go
Comment thread go/api/v1alpha2/common_types.go
@dongjiang1989 dongjiang1989 force-pushed the add-new-kube-api-linter branch from c7fecf6 to 07c2061 Compare June 10, 2026 14:20
@dongjiang1989

Copy link
Copy Markdown
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>
@dongjiang1989 dongjiang1989 force-pushed the add-new-kube-api-linter branch from 07c2061 to bee5af8 Compare June 11, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants