Skip to content

feat: add kube-api-linter support - #2717

Open
dongjiang1989 wants to merge 2 commits into
theagentrouter:mainfrom
dongjiang1989:add-kube-api-linter
Open

dongjiang1989 wants to merge 2 commits into
theagentrouter:mainfrom
dongjiang1989:add-kube-api-linter

Conversation

@dongjiang1989

@dongjiang1989 dongjiang1989 commented Sep 20, 2026 •

Copy link
Copy Markdown

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, 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)

Define custom Condition type replacing metav1.Condition with enum validation on Type (Accepted/NotAccepted) and Status (True/False/Unknown). Make Conditions field required (remove +optional and omitempty).

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, and statussubresource linters are disabled. Enabling jsontags would require renaming json:"OIDCProvider" to json:"oidcProvider" which is a breaking API change. The statusoptional/statussubresource linters conflict with the requirement that Conditions is a required field.

@dongjiang1989
dongjiang1989 requested a review from a team as a code owner September 20, 2026 09:37
@netlify

netlify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for theagentrouter canceled.

Name Link
🔨 Latest commit f8ca840
🔍 Latest deploy log https://app.netlify.com/projects/theagentrouter/deploys/6ab2654d7ca4530008bb5ce2

@johnugeorge

Copy link
Copy Markdown
Contributor

This is a breaking change

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>
@missBerg missBerg added enhancement New feature or request ci CI workflows and build pipeline area/api Control plane API (CRDs) labels Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Control plane API (CRDs) ci CI workflows and build pipeline enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants