Skip to content

Commit 3d6f63d

Browse files
authored
Merge pull request #12089 from sivchari/switch-kube-api-linter
🌱 Switch plugin to kube-api-linter
2 parents d0a809b + 11827d9 commit 3d6f63d

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

.golangci-kal.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ run:
66
linters:
77
disable-all: true
88
enable:
9-
- kal # linter for Kube API conventions
9+
- kubeapilinter # linter for Kube API conventions
1010

1111
linters-settings:
1212
custom:
13-
kal:
13+
kubeapilinter:
1414
type: "module"
15-
description: KAL is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
15+
description: kube-api-linter and lints Kube like APIs based on API conventions and best practices.
1616
settings:
1717
linters:
1818
enable:
@@ -61,54 +61,54 @@ issues:
6161
# KAL should only run on API folders.
6262
- path-except: "api//*"
6363
linters:
64-
- kal
64+
- kubeapilinter
6565
- path: "api/v1beta2/*|api/addons/v1beta2/*|api/v1beta1/*|api/v1alpha1/*|api/addons/v1beta1/*"
6666
text: "Conditions field must be a slice of metav1.Condition"
6767
linters:
68-
- kal
68+
- kubeapilinter
6969
- path: "api/v1beta2/*|api/v1beta1/*"
7070
text: "type ClusterIPFamily should not use an int, int8 or int16. Use int32 or int64 depending on bounding requirements"
7171
linters:
72-
- kal
72+
- kubeapilinter
7373
- path: "exp/ipam/api/v1beta2/*|exp/ipam/api/v1alpha1/*|exp/ipam/api/v1beta1/*"
7474
text: "field Prefix should not use an int, int8 or int16. Use int32 or int64 depending on bounding requirements"
7575
linters:
76-
- kal
76+
- kubeapilinter
7777
# clusterctl and Runtime Hooks can be fixed once we bump their apiVersion.
7878
- path: "cmd/clusterctl/api/v1alpha3|exp/runtime/hooks/api/v1alpha1"
7979
text: "maxlength"
8080
linters:
81-
- kal
81+
- kubeapilinter
8282
# controller-gen does not allow to add MaxItems to Schemaless fields
8383
- path: "api/v1beta2/*|api/v1beta1/*"
8484
text: "maxlength: field (AllOf|OneOf|AnyOf) must have a maximum items, add kubebuilder:validation:MaxItems marker"
8585
linters:
86-
- kal
86+
- kubeapilinter
8787
# It does not make sense to add a maxItems marker on the *List structs as they are not used to generate CRD YAMLs.
88-
# This exclude will be removed once https://github.com/JoelSpeed/kal/issues/38 is resolved.
88+
# This exclude will be removed once https://github.com/JoelSpeed/kubeapilinter/issues/38 is resolved.
8989
- path: "api/v1beta2/*|api/addons/v1beta2/*|api/v1beta1/*|api/v1alpha1/*|api/addons/v1beta1/*"
9090
text: "maxlength: field Items must have a maximum items, add kubebuilder:validation:MaxItems marker"
9191
linters:
92-
- kal
92+
- kubeapilinter
9393
- path: "api/v1beta2/*|api/addons/v1beta2/*|api/v1alpha1/*|api/v1beta1/*|api/addons/v1beta1/*"
9494
text: "nobools"
9595
linters:
96-
- kal
96+
- kubeapilinter
9797
# We follow the current CustomResourceDefinition field's json tag pattern.
9898
- path: "api/v1beta2/*|api/v1beta1/*"
9999
text: "field (XPreserveUnknownFields|XPreserveUnknownFields|XValidations|XMetadata|XIntOrString) json tag does not match pattern"
100100
linters:
101-
- kal
101+
- kubeapilinter
102102
# The following rules are disabled until we migrate to the new API.
103103
- path: "bootstrap/kubeadm/api/v1beta2/kubeadm_types.go|bootstrap/kubeadm/api/v1beta1/kubeadm_types.go"
104104
text: "field Token is marked as required, should not be a pointer"
105105
linters:
106-
- kal
106+
- kubeapilinter
107107
- path: "api/v1beta2/clusterclass_types.go|api/v1beta1/clusterclass_types.go"
108108
text: "field Ref is marked as required, should not be a pointer"
109109
linters:
110-
- kal
110+
- kubeapilinter
111111
- path: "api/v1beta2/*|api/addons/v1beta2/*|api/v1alpha1/*|api/v1beta1/*|api/v1alpha3/*|api/addons/v1beta1/*"
112112
text: "field Items must be marked as optional or required"
113113
linters:
114-
- kal
114+
- kubeapilinter

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ GOLANGCI_LINT_VER := $(shell cat .github/workflows/pr-golangci-lint.yaml | grep
164164
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER))
165165
GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
166166

167-
GOLANGCI_LINT_KAL_BIN := golangci-lint-kal
168-
GOLANGCI_LINT_KAL_VER := $(shell cat ./hack/tools/.custom-gcl.yaml | grep name: | sed 's/name: golangci-lint-kal-//')
169-
GOLANGCI_LINT_KAL := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_KAL_BIN)-$(GOLANGCI_LINT_KAL_VER))
167+
GOLANGCI_LINT_KAL_BIN := golangci-lint-kube-api-linter
168+
GOLANGCI_LINT_KAL_VER := $(shell cat ./hack/tools/.custom-gcl.yaml | grep version: | sed 's/version: //')
169+
GOLANGCI_LINT_KAL := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_KAL_BIN))
170170

171171
GOVULNCHECK_BIN := govulncheck
172172
GOVULNCHECK_VER := v1.1.4

hack/tools/.custom-gcl.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
version: v1.63.4
2-
name: golangci-lint-kal-v1.63.4
1+
version: v1.63.4
2+
name: golangci-lint-kube-api-linter
33
destination: ./bin
44
plugins:
5-
- module: 'github.com/JoelSpeed/kal'
6-
version: v0.0.0-20250305092907-abd233a9fed8
5+
- module: 'sigs.k8s.io/kube-api-linter'
6+
version: v0.0.0-20250411141643-33ef95a5ee04

0 commit comments

Comments
 (0)