Skip to content

Enable Kubernetes API Linter #3917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

rikatz
Copy link

@rikatz rikatz commented Jul 14, 2025

What type of PR is this?
/kind test

What this PR does / why we need it: This PR enables Kube API Linter with a small set of validations. The enabled validations doesn't present a breaking change on existing APIs, and the plan is to progressively enable other linters that may present more disrupting changes on follow up PRs after discussion with Gateway API group.

Does this PR introduce a user-facing change?:

NONE

Note for reviewers:
The ongoing discussion is part of the document https://docs.google.com/document/d/1DSyP7Vt9E9wX2ku1C0AvCLqQe9cCiDPCLiPP0wXFYQw/edit?tab=t.0 and the thread https://kubernetes.slack.com/archives/CR0H13KGA/p1751923997220399

The proposed changes on this PR contains fix for validations that are not breaking change, and are separated on different commits per enabled linter.

For newer validations, we should enable the linters just for new changes and existing violations should be fixed individually as they may not break existing GA'd APIs.

This run contains the execution of the linter as per this PR without enabling the feature for only changed files, showing that the enabled linters don't trigger any violation.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 14, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 14, 2025
@shaneutt shaneutt self-requested a review July 15, 2025 15:22
@shaneutt shaneutt self-assigned this Jul 15, 2025
@shaneutt shaneutt moved this to In Progress in Release v1.4.0 Jul 15, 2025
@shaneutt shaneutt moved this from In Progress to Review in Release v1.4.0 Jul 15, 2025
@shaneutt shaneutt added this to the v1.4.0 milestone Jul 15, 2025
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

This is great, very much appreciate the effort. Just one nit.

/approve


jobs:
golangci:
name: lint
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name: lint
name: kube-api-lint

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2025
@shaneutt shaneutt requested a review from JoelSpeed July 15, 2025 23:59
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @rikatz!

- name: Build KAL
run: golangci-lint custom
- name: run api linter
run: ./bin/golangci-kube-api-linter run -c ./.golangci-kal.yml ./...
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget trailing new line here.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rikatz, robscott, shaneutt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/test release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

5 participants