feat: add kube api linter in kagent#1759
Open
dongjiang1989 wants to merge 2 commits intokagent-dev:mainfrom
Open
feat: add kube api linter in kagent#1759dongjiang1989 wants to merge 2 commits intokagent-dev:mainfrom
dongjiang1989 wants to merge 2 commits intokagent-dev:mainfrom
Conversation
f3255f4 to
d204b92
Compare
Contributor
There was a problem hiding this comment.
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.ymlconfig. - Add
make lint-api/lint-api-fixtargets and wire them into CI. - Update multiple CRD API types (v1alpha1/v1alpha2) with
+optional/+requiredmarkers 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.
Signed-off-by: dongjiang <dongjiang1989@126.com>
340213b to
776b79b
Compare
Signed-off-by: dongjiang <dongjiang1989@126.com>
Contributor
Author
|
cc @EItanya PTAL, thanks |
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 kube-api-linter: https://github.com/kubernetes-sigs/kube-api-linter
Fix
// +kubebuilder:optionalmarker to theConditionsfield in the status struct to comply with Kubernetes API conventions and pass kube-apilinter validation.+kubebuilder:requiredmarker.+kubebuilder:default:=xxxand added the explicit+kubebuilder:optionalmarker to comply with Kubebuilder validation rules.