@@ -72,119 +72,88 @@ linters:
72
72
linters :
73
73
- kubeapilinter
74
74
75
- # # Excludes that can be removed once v1alpha1/v1beta1 apiVersions are dropped
75
+ # # Excludes for old apiVersions that can be removed once the apiVersions are dropped (we don't want to make any changes to these APIs).
76
+ - path : " api/addons/v1beta1|api/bootstrap/kubeadm/v1beta1|api/controlplane/kubeadm/v1beta1|api/core/v1beta1|api/ipam/v1beta1|api/ipam/v1alpha1|api/runtime/v1alpha1"
77
+ linters :
78
+ - kubeapilinter
76
79
77
- # .status.deprecated.v1beta1.conditions fields are using v1beta1.Condition types, these fields will be removed once v1alpha1/v1beta1 is removed.
78
- - path : " api/addons/v1beta2/*|api/bootstrap/kubeadm/v1beta2/*|api/controlplane/kubeadm/v1beta2/*|api/core/v1beta2/*|api/ipam/v1beta2/*|api/runtime/v1beta2/*|api/addons/v1beta1/*|api/bootstrap/kubeadm/v1beta1/*|api/controlplane/kubeadm/v1beta1/*|api/core/v1beta1/*|api/ipam/v1beta1/*|api/ipam/v1alpha1/*|api/runtime/v1alpha1/*"
80
+ # # Excludes for current apiVersions that can be removed once v1beta1 is removed.
81
+ # .status.deprecated.v1beta1.conditions fields are using v1beta1.Condition types.
82
+ - path : " api/addons/v1beta2|api/bootstrap/kubeadm/v1beta2|api/controlplane/kubeadm/v1beta2|api/core/v1beta2|api/ipam/v1beta2|api/runtime/v1beta2"
79
83
text : " Conditions field must be a slice of metav1.Condition"
80
84
linters :
81
85
- kubeapilinter
82
- - path : " api/core/v1beta2/*|api/core/v1beta1/* "
86
+ - path : " api/core/v1beta2"
83
87
text : " field Conditions type Conditions must have a maximum items, add kubebuilder:validation:MaxItems marker"
84
88
linters :
85
89
- kubeapilinter
86
- # excludes for v1alpha1/v1beta1 API packages
87
- - path : " api/core/v1beta1/*"
88
- text : " type ClusterIPFamily should not use an int, int8 or int16. Use int32 or int64 depending on bounding requirements"
89
- linters :
90
- - kubeapilinter
91
- - path : " api/ipam/v1alpha1/*|api/ipam/v1beta1/*"
92
- text : " field Prefix should not use an int, int8 or int16. Use int32 or int64 depending on bounding requirements"
93
- linters :
94
- - kubeapilinter
95
- - path : " api/core/v1beta1/*"
96
- text : " field Addresses type MachineAddresses must have a maximum items, add kubebuilder:validation:MaxItems marker"
97
- linters :
98
- - kubeapilinter
99
- - path : " api/bootstrap/kubeadm/v1beta1/*"
100
- text : " nomaps: APIEndpoints should not use a map type, use a list type with a unique name/identifier instead"
101
- linters :
102
- - kubeapilinter
103
- - path : " api/core/v1beta1/*"
104
- text : " nomaps: FailureDomains should not use a map type, use a list type with a unique name/identifier instead"
105
- linters :
106
- - kubeapilinter
107
- - path : " api/addons/v1beta1/*|api/bootstrap/kubeadm/v1beta1/*|api/controlplane/kubeadm/v1beta1/*|api/core/v1beta1/*|api/ipam/v1beta1/*|api/ipam/v1alpha1/*|api/runtime/v1alpha1/*|cmd/clusterctl/api/v1alpha3/*"
108
- text : " optionalfields"
109
- linters :
110
- - kubeapilinter
111
- - path : " api/core/v1beta1/clusterclass_types.go"
112
- text : " field Ref is marked as required, should not be a pointer"
113
- linters :
114
- - kubeapilinter
115
90
116
- # # Excludes for clusterctl and Runtime Hooks (can be fixed once we bump their apiVersion)
91
+ # # Excludes for current clusterctl v1alpha3 and Runtime Hooks v1alpha1 apiVersions (can be fixed once we bump their apiVersion).
117
92
- path : " cmd/clusterctl/api/v1alpha3|api/runtime/hooks/v1alpha1"
118
- text : " maxlength"
93
+ text : " optionalfields| maxlength"
119
94
linters :
120
95
- kubeapilinter
121
96
122
- # # controller-gen does not allow to add MaxItems to Schemaless fields
123
- - path : " api/core/v1beta2/*|api/core/v1beta1/*"
97
+ # # Excludes for JSONSchemaProps
98
+ # controller-gen does not allow to add MaxItems to Schemaless fields
99
+ - path : " api/core/v1beta2/clusterclass_types.go"
124
100
text : " maxlength: field (AllOf|OneOf|AnyOf) must have a maximum items, add kubebuilder:validation:MaxItems marker"
125
101
linters :
126
102
- kubeapilinter
127
-
128
- # # Removal of bool fields of existing types requires further discussion
129
- - path : " api/bootstrap/kubeadm/v1beta2/*|api/controlplane/kubeadm/v1beta2/*|api/core/v1beta2/*|api/addons/v1beta2/*|api/bootstrap/kubeadm/v1beta1/*|api/controlplane/kubeadm/v1beta1/*|api/v1alpha1/*|api/core/v1beta1/*|api/addons/v1beta1/*"
130
- text : " nobools"
131
- linters :
132
- - kubeapilinter
133
-
134
- # # Excludes for JSONSchemaProps
135
103
# We want to align to the JSON tags of the CustomResourceDefinition fields.
136
- - path : " api/core/v1beta2/*|api/core/v1beta1/* "
104
+ - path : " api/core/v1beta2/clusterclass_types "
137
105
text : " field (XPreserveUnknownFields|XPreserveUnknownFields|XValidations|XMetadata|XIntOrString) json tag does not match pattern"
138
106
linters :
139
107
- kubeapilinter
140
108
# We want to align Properties to the corresponding field in CustomResourceDefinitions.
141
- - path : " api/core/v1beta2/*|api/core/v1beta1/* "
109
+ - path : " api/core/v1beta2/clusterclass_types "
142
110
text : " Properties should not use a map type, use a list type with a unique name/identifier instead"
143
111
linters :
144
112
- kubeapilinter
145
113
114
+ # # Removal of bool fields of existing types requires further discussion
115
+ - path : " api/bootstrap/kubeadm/v1beta2|api/controlplane/kubeadm/v1beta2|api/core/v1beta2|api/addons/v1beta2"
116
+ text : " nobools"
117
+ linters :
118
+ - kubeapilinter
119
+
146
120
# # Excludes for kubeadm types
147
121
# We want to align the FeatureGates field to the FeatureGates field in kubeadm.
148
- - path : " api/bootstrap/kubeadm/v1beta2/*|api/bootstrap/kubeadm/v1beta1/* "
122
+ - path : " api/bootstrap/kubeadm/v1beta2/kubeadm_types.go "
149
123
text : " nomaps: FeatureGates should not use a map type, use a list type with a unique name/identifier instead"
150
124
linters :
151
125
- kubeapilinter
126
+ # Note: Maybe this has to stay a pointer for marshalling reasons.
127
+ # TODO: we should eventually remove the pointer: https://github.com/kubernetes-sigs/cluster-api/issues/10852
128
+ - path : " api/bootstrap/kubeadm/v1beta2/kubeadm_types.go"
129
+ text : " field Token is marked as required, should not be a pointer"
130
+ linters :
131
+ - kubeapilinter
152
132
153
133
# # Excludes for optionalfields
154
134
# Empty Bootstrap object is blocked via validating webhooks. This cannot be detected by KAL (same if we move the validation to CEL).
155
135
- path : " api/core/v1beta2/machine_types.go"
156
136
text : " optionalfields: field (Bootstrap) is optional and (should be a pointer|should have the omitempty tag|has a valid zero value)"
157
137
linters :
158
138
- kubeapilinter
139
+
140
+ # TODO: Excludes that should be removed once the corresponding issues in KAL are fixed
159
141
# KAL incorrectly reports that the Taints field doesn't have to be a pointer (it has to be to preserve []).
142
+ # See: https://github.com/kubernetes-sigs/kube-api-linter/issues/116
160
143
- path : " api/bootstrap/kubeadm/v1beta2/kubeadm_types.go"
161
144
text : " optionalfields: field Taints is optional but the underlying type does not need to be a pointer. The pointer should be removed."
162
145
linters :
163
146
- kubeapilinter
164
-
165
- # # TODO: The following rules are disabled until we migrate to the new API.
166
- # Note: Maybe this has to stay a pointer for marshalling reasons.
167
- - path : " api/bootstrap/kubeadm/v1beta2/kubeadm_types.go|api/bootstrap/kubeadm/v1beta1/kubeadm_types.go"
168
- text : " field Token is marked as required, should not be a pointer"
169
- linters :
170
- - kubeapilinter
171
-
172
- # Audit the entire hook types + builtins from a serialization point of view when bumping the API (this is not a CRD)
173
- - path : " api/runtime/hooks/v1alpha1/*"
174
- text : " optionalfields"
175
- linters :
176
- - kubeapilinter
177
-
178
147
# KAL does not handle omitzero correctly yet: https://github.com/kubernetes-sigs/kube-api-linter/pull/115
179
148
- path : " api/.*"
180
149
text : " optionalfields: field Status is optional and should (be a pointer|have the omitempty tag)"
181
150
linters :
182
151
- kubeapilinter
183
- - path : " api/bootstrap/kubeadm/v1beta2/* "
152
+ - path : " api/bootstrap/kubeadm/v1beta2"
184
153
text : " optionalfields: field (Spec|NodeRegistration|LocalAPIEndpoint|Etcd|APIServer|ControllerManager|Scheduler|DNS|Discovery|ObjectMeta) is optional and should (be a pointer|have the omitempty tag)"
185
154
linters :
186
155
- kubeapilinter
187
- - path : " api/controlplane/kubeadm/v1beta2/* "
156
+ - path : " api/controlplane/kubeadm/v1beta2"
188
157
text : " optionalfields: field (Spec|ObjectMeta|KubeadmConfigSpec) is optional and should (be a pointer|have the omitempty tag)"
189
158
linters :
190
159
- kubeapilinter
@@ -200,12 +169,12 @@ linters:
200
169
text : " optionalfields: field AddressRef is optional and should (be a pointer|have the omitempty tag)"
201
170
linters :
202
171
- kubeapilinter
203
-
204
- # KAL does not handle enum markers on enum types yet: https://github.com/kubernetes-sigs/kube-api-linter/issues/113
172
+ # KAL does not handle enum markers on enum types yet: https://github.com/kubernetes-sigs/kube-api-linter/issues/113
205
173
- path : " .*"
206
174
text : " optionalfields: field (Format|Encoding|Type|DeletePolicy) is optional and (should be a pointer|has a valid zero value)"
207
175
linters :
208
176
- kubeapilinter
177
+
209
178
issues :
210
179
max-same-issues : 0
211
180
max-issues-per-linter : 0
0 commit comments