You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "A field with a default value cannot be required"
40
53
conditions:
41
54
isFirstField: Warn # Require conditions to be the first field in the status struct.
42
-
usePatchStrategy: Forbid #Require conditions to be the first field in the status struct.
55
+
usePatchStrategy: Forbid #Forbid patchStrategy markers on the Conditions field.
43
56
useProtobuf: Forbid # We don't use protobuf, so protobuf tags are not required.
44
-
# jsonTags:
45
-
# jsonTagRegex: "^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$" # The default regex is appropriate for our use case.
46
-
# optionalOrRequired:
47
-
# preferredOptionalMarker: optional | kubebuilder:validation:Optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
48
-
# preferredRequiredMarker: required | kubebuilder:validation:Required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
49
-
# requiredFields:
50
-
# pointerPolicy: Warn | SuggestFix # Defaults to `SuggestFix`. We want our required fields to not be pointers.
57
+
optionalfields:
58
+
pointers:
59
+
preference: WhenRequired # Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
60
+
policy: SuggestFix # SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
61
+
omitempty:
62
+
policy: SuggestFix # SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
51
63
52
64
exclusions:
53
65
generated: strict
@@ -63,86 +75,96 @@ linters:
63
75
linters:
64
76
- kubeapilinter
65
77
66
-
## Excludes that can be removed once v1alpha1/v1beta1 apiVersions are dropped
67
-
68
-
# .status.deprecated.v1beta1.conditions fields are using v1beta1.Condition types, these fields will be removed once v1alpha1/v1beta1 is removed.
# We want to align Properties to the corresponding field in CustomResourceDefinitions.
116
+
- path: "api/core/v1beta2/clusterclass_types"
117
+
text: "Properties should not use a map type, use a list type with a unique name/identifier instead"
102
118
linters:
103
119
- kubeapilinter
104
-
105
-
## controller-gen does not allow to add MaxItems to Schemaless fields
106
-
- path: "api/core/v1beta2/*|api/core/v1beta1/*"
107
-
text: "maxlength: field (AllOf|OneOf|AnyOf) must have a maximum items, add kubebuilder:validation:MaxItems marker"
120
+
# It's simpler to check these fields against nil vs. using reflect.DeepEqual everywhere.
121
+
- path: "api/core/v1beta2/clusterclass_types.go"
122
+
text: "optionalfields: field (AdditionalProperties|Items|Not) does not allow the zero value. (The field does not need to be a pointer|It must have the omitzero tag)"
108
123
linters:
109
124
- kubeapilinter
110
125
111
126
## Removal of bool fields of existing types requires further discussion
text: "nomaps: FeatureGates should not use a map type, use a list type with a unique name/identifier instead"
121
136
linters:
122
137
- kubeapilinter
123
-
# We want to align Properties to the corresponding field in CustomResourceDefinitions.
124
-
- path: "api/core/v1beta2/*|api/core/v1beta1/*"
125
-
text: "Properties should not use a map type, use a list type with a unique name/identifier instead"
138
+
139
+
## Excludes for requiredfields
140
+
# Empty Bootstrap object is blocked via validating webhooks. This cannot be detected by KAL (same if we move the validation to CEL).
141
+
- path: "api/core/v1beta2/machine_types.go"
142
+
text: "requiredfields: field Bootstrap has a valid zero value \\({}\\), but the validation is not complete \\(e.g. min properties/adding required fields\\). The field should be a pointer to allow the zero value to be set. If the zero value is not a valid use case, complete the validation and remove the pointer."
126
143
linters:
127
144
- kubeapilinter
128
145
129
-
## Excludes for kubeadm types
130
-
# We want to align the FeatureGates field to the FeatureGates field in kubeadm.
0 commit comments