Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .custom-gcl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v2.5.0
name: golangci-lint-kube-api-linter
destination: ./bin
plugins:
- module: 'sigs.k8s.io/kube-api-linter'
version: 'v0.0.0-20251103104136-5fca1e8b5e9f'
2 changes: 2 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
uses: golangci/golangci-lint-action@v9
with:
version: latest
- name: Run kube-api-linter
run: make run-kubeapilinter
- name: Delete pre-installed shellcheck
run: sudo rm -f $(which shellcheck)
- name: Run shellcheck
Expand Down
33 changes: 33 additions & 0 deletions .golangci-kal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company
# SPDX-License-Identifier: Apache-2.0
version: "2"
linters:
default: none
enable:
- kubeapilinter # linter for Kube API conventions
settings:
custom:
kubeapilinter:
type: module
description: KAL is the Kube-API-Linter and lints Kubernetes APIs based on API conventions and best practices.
settings:
linters: {}
lintersConfig:
conditions:
useProtobuf: Forbid
optionalfields:
pointers:
preference: WhenRequired

exclusions:
generated: strict
paths:
- ".*_test.go"
- "zz_generated.*.go"
rules:
- path-except: "^api/"
linters:
- kubeapilinter
issues:
max-same-issues: 0
max-issues-per-linter: 0
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ fmt: FORCE install-gofumpt
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')

bin/golangci-lint-kube-api-linter:
@printf "\e[1;36m>> Installing golangci-lint-kube-api-linter...\e[0m\n"
@golangci-lint custom

run-kubeapilinter: FORCE bin/golangci-lint-kube-api-linter
@printf "\e[1;36m>> bin/golangci-lint-kube-api-linter run --config=.golangci-kal.yaml\e[0m\n"
@bin/golangci-lint-kube-api-linter config verify --config=.golangci-kal.yaml
@bin/golangci-lint-kube-api-linter run --config=.golangci-kal.yaml

# Run the e2e tests against a k8s cluster.
test-e2e: FORCE
@command -v kind >/dev/null 2>&1 || { \
Expand Down
9 changes: 9 additions & 0 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ verbatim: |
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')

bin/golangci-lint-kube-api-linter:
@printf "\e[1;36m>> Installing golangci-lint-kube-api-linter...\e[0m\n"
@golangci-lint custom

run-kubeapilinter: FORCE bin/golangci-lint-kube-api-linter
@printf "\e[1;36m>> bin/golangci-lint-kube-api-linter run --config=.golangci-kal.yaml\e[0m\n"
@bin/golangci-lint-kube-api-linter config verify --config=.golangci-kal.yaml
@bin/golangci-lint-kube-api-linter run --config=.golangci-kal.yaml

# Run the e2e tests against a k8s cluster.
test-e2e: FORCE
@command -v kind >/dev/null 2>&1 || { \
Expand Down
Loading