Skip to content

feat: add kube api linter in kagent#1759

Open
dongjiang1989 wants to merge 2 commits intokagent-dev:mainfrom
dongjiang1989:add-kube-api
Open

feat: add kube api linter in kagent#1759
dongjiang1989 wants to merge 2 commits intokagent-dev:mainfrom
dongjiang1989:add-kube-api

Conversation

@dongjiang1989
Copy link
Copy Markdown
Contributor

@dongjiang1989 dongjiang1989 commented Apr 27, 2026

Add kube-api-linter: https://github.com/kubernetes-sigs/kube-api-linter

Fix

  • Added the // +kubebuilder:optional marker to the Conditions field in the status struct to comply with Kubernetes API conventions and pass kube-apilinter validation.
  • Removed the conflicting +kubebuilder:required marker.
  • Kept +kubebuilder:default:=xxx and added the explicit +kubebuilder:optional marker to comply with Kubebuilder validation rules.

Copilot AI review requested due to automatic review settings April 27, 2026 07:06
@github-actions github-actions Bot added the enhancement New feature or request label Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds kube-api-linter (via a custom golangci-lint build) to the Go module to enforce Kubernetes API/CRD marker conventions, and updates CRD types to comply with the new linting rules.

Changes:

  • Introduce a custom golangci-lint binary with the kube-api-linter plugin plus a dedicated .golangci-kal.yml config.
  • Add make lint-api / lint-api-fix targets and wire them into CI.
  • Update multiple CRD API types (v1alpha1/v1alpha2) with +optional / +required markers and related tweaks.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
go/go.mod Adds kube-api-linter/tooling dependencies and a tool directive for the custom builder.
go/go.sum Updates dependency checksums for newly introduced tooling deps.
go/Makefile Adds targets to build/run a custom golangci-lint with kube-api-linter and a clean step.
go/.golangci-kal.yml New golangci-lint config intended to run kube-api-linter on API packages.
go/.custom-gcl.yaml Defines the custom golangci-lint build and plugin pinning.
.github/workflows/ci.yaml Adds a new api-lint job to run kube-api-linter in CI.
Makefile Adds a repo-level lint-api target delegating to go/Makefile.
go/api/v1alpha2/*.go Adds/adjusts kubebuilder markers on v1alpha2 CRD types.
go/api/v1alpha1/*.go Adds/adjusts kubebuilder markers on v1alpha1 CRD types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/Makefile Outdated
Comment thread go/.golangci-kal.yml
Comment thread go/.golangci-kal.yml
Comment thread go/api/v1alpha2/agent_types.go
Comment thread go/api/v1alpha1/toolserver_types.go Outdated
Comment thread go/.custom-gcl.yaml
Signed-off-by: dongjiang <dongjiang1989@126.com>
Signed-off-by: dongjiang <dongjiang1989@126.com>
@dongjiang1989
Copy link
Copy Markdown
Contributor Author

cc @EItanya PTAL, thanks

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants