Skip to content

Commit 74c12d8

Browse files
committed
ai review fixes
1 parent 51dcb42 commit 74c12d8

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

operator/v1alpha1/types_crdchecker.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type CRDCompatibilityRequirementSpec struct {
5858
// CompatibilitySchema defines the schema used by crdSchemaValidation and objectSchemaValidation.
5959
type CompatibilitySchema struct {
6060
// crdYAML contains the complete YAML document of the CRD for schema and object validation purposes.
61-
// This field is required.
61+
// This field is required and must be between 1 and 1,572,864 characters in length.
6262
// +kubebuilder:validation:MinLength=1
6363
// +kubebuilder:validation:MaxLength=1572864
6464
// +required
@@ -75,6 +75,9 @@ type CompatibilitySchema struct {
7575

7676
// additionalVersions is a set of versions to require in addition to those discovered by requireVersions.
7777
// Overlap with requireVersions is explicitly permitted.
78+
// When present, each version string must be between 1 and 255 characters in length.
79+
// The list may contain at most 255 items.
80+
// When not specified, no additional versions are required.
7881
// +kubebuilder:validation:items:MinLength=1
7982
// +kubebuilder:validation:items:MaxLength=255
8083
// +kubebuilder:validation:MaxItems=255
@@ -84,7 +87,10 @@ type CompatibilitySchema struct {
8487

8588
// excludeFields is a set of fields in the yaml which will not be validated by either
8689
// crdSchemaValidation or objectSchemaValidation.
87-
// FIXME(chrischdi): explain the format which is
90+
// Each field path string must be between 1 and 8,192 characters in length.
91+
// The list may contain at most 1,024 field paths.
92+
// When not specified, all fields in the YAML will be validated.
93+
// FIXME(chrischdi): explain the format for it. // FIXME(chrischdi): explain the format for it.
8894
// +kubebuilder:validation:items:MinLength=1
8995
// +kubebuilder:validation:items:MaxLength=8192
9096
// +kubebuilder:validation:MaxItems=1024
@@ -115,14 +121,19 @@ type ObjectSchemaValidation struct {
115121
Action CRDAdmitAction `json:"action,omitempty"`
116122

117123
// namespaceSelector defines the namespaceSelector field of the resulting ValidatingWebhookConfiguration.
124+
// When not specified, objects from all namespaces matching the objectSelector will be subject to validation.
118125
// +optional
119126
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
120127

121128
// objectSelector defines the objectSelector field of the resulting ValidatingWebhookConfiguration.
129+
// When not specified, all objects matching the namespaceSelector will be subject to validation.
122130
// +optional
123131
ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty"`
124132

125133
// matchConditions defines the matchConditions field of the resulting ValidatingWebhookConfiguration.
134+
// When present, must contain between 1 and 64 match conditions.
135+
// When not specified, the webhook will match all requests according to its other selectors.
136+
// FIXME(chrischdi): should we embed this type? Or maintain our own copy of MatchCondition?
126137
// +listType=map
127138
// +listMapKey=name
128139
// +kubebuilder:validation:MinItems=1
@@ -226,8 +237,10 @@ type CRDCompatibilityRequirementStatus struct {
226237
// exist, as we may legitimately place requirements on it before it is
227238
// created. The observed CRD is given in status.observedCRD, which will be
228239
// empty if no CRD is observed.
240+
// When present, must be between 1 and 253 characters and conform to RFC 1123 subdomain format:
241+
// lowercase alphanumeric characters, '-' or '.', starting and ending with alphanumeric characters.
242+
// When not specified, the requirement applies to any CRD name discovered from the compatibility schema.
229243
// This field is optional.
230-
// crdRef must be at most 253 characters in length and must consist only of lower-case alphanumeric characters, periods (.) and hyphens (-). Each period separated label must start and end with an alphanumeric character and be at most 63 characters in length.
231244
// +kubebuilder:validation:MinLength=1
232245
// +kubebuilder:validation:MaxLength=253
233246
// +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character."
@@ -239,6 +252,8 @@ type CRDCompatibilityRequirementStatus struct {
239252
// +kubebuilder:validation:MinProperties=1
240253
type ObservedCRD struct {
241254
// uid is the uid of the observed CRD.
255+
// Must be a valid UUID consisting of lowercase hexadecimal digits in 5 hyphenated blocks (8-4-4-4-12 format).
256+
// Length must be between 1 and 36 characters.
242257
// +kubebuilder:validation:MinLength=1
243258
// +kubebuilder:validation:MaxLength=36
244259
// +kubebuilder:validation:Format=uuid
@@ -247,6 +262,7 @@ type ObservedCRD struct {
247262
UID string `json:"uid,omitempty"`
248263

249264
// generation is the observed generation of the CRD.
265+
// Must be a positive integer (minimum value of 1).
250266
// +kubebuilder:validation:Minimum=1
251267
// +required
252268
Generation int64 `json:"generation,omitempty"`

0 commit comments

Comments
 (0)