@@ -18,7 +18,7 @@ linters:
1818 - " conditions" # Ensure conditions have the correct json tags and markers.
1919 - " conflictingmarkers"
2020 - " duplicatemarkers" # Ensure there are no exact duplicate markers. for types and fields.
21- # - "forbiddenmarkers" # Ensure that types and fields do not contain any markers that are forbidden.
21+ - " forbiddenmarkers" # Ensure that types and fields do not contain any markers that are forbidden.
2222 - " integers" # Ensure only int32 and int64 are used for integers.
2323 - " jsontags" # Ensure every field has a json tag.
2424 - " maxlength" # Ensure all strings and arrays have maximum lengths/maximum items.
@@ -53,6 +53,10 @@ linters:
5353 - ["default", "kubebuilder:default"]
5454 - ["required", "kubebuilder:validation:Required", "k8s:required"]
5555 description : " A field with a default value cannot be required"
56+ forbiddenmarkers :
57+ markers :
58+ - identifier : " kubebuilder:default"
59+ - identifier : " default"
5660 conditions :
5761 isFirstField : Warn # Require conditions to be the first field in the status struct.
5862 usePatchStrategy : Forbid # Forbid patchStrategy markers on the Conditions field.
@@ -158,6 +162,17 @@ linters:
158162 linters :
159163 - kubeapilinter
160164
165+ # Excludes for existing default markers
166+ # We don't want to use OpenAPI defaulting anymore.
167+ - path : " api/core/v1beta2/clusterclass_types.go"
168+ text : ' forbiddenmarkers: field Reason has forbidden marker "kubebuilder:default=FieldValueInvalid"'
169+ linters :
170+ - kubeapilinter
171+ - path : " api/core/v1beta2/clusterclass_types.go"
172+ text : ' forbiddenmarkers: field Reason has forbidden marker "default=ref\(sigs.k8s.io/cluster-api/api/core/v1beta2.FieldValueInvalid\)"'
173+ linters :
174+ - kubeapilinter
175+
161176 # TODO: Excludes that should be removed once the corresponding issues in KAL are fixed
162177 # KAL incorrectly reports that the Taints field doesn't have to be a pointer (it has to be to preserve []).
163178 # See: https://github.com/kubernetes-sigs/kube-api-linter/issues/116
0 commit comments