feat: add kube-api-linter support - #2717
Open
dongjiang1989 wants to merge 2 commits into
Open
dongjiang1989 wants to merge 2 commits into
dongjiang1989 wants to merge 2 commits into
Conversation
✅ Deploy Preview for theagentrouter canceled.
|
dongjiang1989
force-pushed
the
add-kube-api-linter
branch
from
September 20, 2026 09:49
cc02f96 to
09e43f5
Compare
Contributor
|
This is a breaking change |
dongjiang1989
force-pushed
the
add-kube-api-linter
branch
from
September 22, 2026 09:05
6b27d81 to
69b6bb0
Compare
Add kube-api-linter (KAL) to validate CRDs against Kubernetes API conventions. Reference: https://github.com/kubernetes-sigs/kube-api-linter Changes: - tools/.custom-gcl.yaml: custom golangci-lint build config with KAL plugin (golangci-lint version unchanged at v2.13.2) - tools/.golangci-kal.yml: KAL config with enabled linters: conflictingmarkers, duplicatemarkers, nofloats, uniquemarkers, nophase, nonullable, forbiddenmarkers, nomaps - Makefile: add lint-api target following the existing lint target style - tools/go.mod: add sigs.k8s.io/kube-api-linter dependency - .gitignore: ignore tools/tmp/ (custom binary output) API changes: - Define custom Condition type in api/v1alpha1/status.go and api/v1beta1/status.go replacing metav1.Condition with enum validation: * Type: +kubebuilder:validation:Enum=Accepted;NotAccepted * Status: +kubebuilder:validation:Enum=True;False;Unknown - Make Conditions field required (remove +optional and omitempty) - Update controller.go and quota_policy.go to use the custom Condition type Regenerate CRDs, typed clients, and API docs via make apigen codegen apidoc. Restore license headers on generated files via make format. Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
The CI was failing with 'missing go.sum entry for go.mod file' errors for dependencies like github.com/bytedance/sonic/loader, github.com/tklauser/numcpus, etc. Running go mod tidy adds the missing checksums. Signed-off-by: dongjiang <dongjiang@users.noreply.github.com> Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
dongjiang1989
force-pushed
the
add-kube-api-linter
branch
from
September 22, 2026 11:23
69b6bb0 to
f8ca840
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.
Description
Add kube-api-linter [1] to validate CRDs against Kubernetes API conventions.
tools/.custom-gcl.yaml: custom golangci-lint build config with KAL plugin (golangci-lint version unchanged at v2.13.2)tools/.golangci-kal.yml: KAL config with enabled linters: conflictingmarkers, duplicatemarkers, nofloats, uniquemarkers, nophase, nonullable, forbiddenmarkers, nomapsMakefile: addlint-apitarget following the existinglinttarget styletools/go.mod: addsigs.k8s.io/kube-api-linterdependency.gitignore: ignoretools/tmp/(custom binary output)Define custom
Conditiontype replacingmetav1.Conditionwith enum validation onType(Accepted/NotAccepted) andStatus(True/False/Unknown). MakeConditionsfield required (remove+optionalandomitempty).Regenerate CRDs, typed clients, and API docs via
make apigen codegen apidoc.Related Issues/PRs (if applicable)
Reference PR: https://github.com/kubernetes-sigs/kube-api-linter
Special notes for reviewers (if applicable)
The
jsontags,statusoptional, andstatussubresourcelinters are disabled. Enablingjsontagswould require renamingjson:"OIDCProvider"tojson:"oidcProvider"which is a breaking API change. Thestatusoptional/statussubresourcelinters conflict with the requirement thatConditionsis a required field.