Skip to content

Commit e1ffc17

Browse files
committed
Fix review findings
1 parent e340ae4 commit e1ffc17

File tree

36 files changed

+204
-141
lines changed

36 files changed

+204
-141
lines changed

api/v1beta1/cluster_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ type Topology struct {
555555
ClassNamespace string `json:"classNamespace,omitempty"`
556556

557557
// version is the Kubernetes version of the cluster.
558+
// +kubebuilder:validation:MinLength=1
558559
// +kubebuilder:validation:MaxLength=256
559560
Version string `json:"version"`
560561

@@ -672,6 +673,7 @@ type MachineDeploymentTopology struct {
672673
// class is the name of the MachineDeploymentClass used to create the set of worker nodes.
673674
// This should match one of the deployment classes defined in the ClusterClass object
674675
// mentioned in the `Cluster.Spec.Class` field.
676+
// +kubebuilder:validation:MinLength=1
675677
// +kubebuilder:validation:MaxLength=256
676678
Class string `json:"class"`
677679

@@ -778,6 +780,7 @@ type MachinePoolTopology struct {
778780
// class is the name of the MachinePoolClass used to create the pool of worker nodes.
779781
// This should match one of the deployment classes defined in the ClusterClass object
780782
// mentioned in the `Cluster.Spec.Class` field.
783+
// +kubebuilder:validation:MinLength=1
781784
// +kubebuilder:validation:MaxLength=256
782785
Class string `json:"class"`
783786

@@ -960,9 +963,8 @@ type ClusterStatus struct {
960963
FailureMessage *string `json:"failureMessage,omitempty"`
961964

962965
// phase represents the current phase of cluster actuation.
963-
// E.g. Pending, Running, Terminating, Failed etc.
964966
// +optional
965-
// +kubebuilder:validation:MaxLength=50
967+
// +kubebuilder:validation:Enum=Pending;Provisioning;Provisioned;Deleting;Failed;Unknown
966968
Phase string `json:"phase,omitempty"`
967969

968970
// infrastructureReady is the state of the infrastructure provider.

api/v1beta1/clusterclass_types.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ type ControlPlaneClassNamingStrategy struct {
214214
// * `.cluster.name`: The name of the cluster object.
215215
// * `.random`: A random alphanumeric string, without vowels, of length 5.
216216
// +optional
217-
// +kubebuilder:validation:MaxLength=512
217+
// +kubebuilder:validation:MaxLength=1024
218218
Template *string `json:"template,omitempty"`
219219
}
220220

@@ -228,7 +228,7 @@ type InfrastructureNamingStrategy struct {
228228
// * `.cluster.name`: The name of the cluster object.
229229
// * `.random`: A random alphanumeric string, without vowels, of length 5.
230230
// +optional
231-
// +kubebuilder:validation:MaxLength=512
231+
// +kubebuilder:validation:MaxLength=1024
232232
Template *string `json:"template,omitempty"`
233233
}
234234

@@ -354,7 +354,7 @@ type MachineDeploymentClassNamingStrategy struct {
354354
// * `.random`: A random alphanumeric string, without vowels, of length 5.
355355
// * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).
356356
// +optional
357-
// +kubebuilder:validation:MaxLength=512
357+
// +kubebuilder:validation:MaxLength=1024
358358
Template *string `json:"template,omitempty"`
359359
}
360360

@@ -491,7 +491,7 @@ type MachinePoolClassNamingStrategy struct {
491491
// * `.random`: A random alphanumeric string, without vowels, of length 5.
492492
// * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name).
493493
// +optional
494-
// +kubebuilder:validation:MaxLength=512
494+
// +kubebuilder:validation:MaxLength=1024
495495
Template *string `json:"template,omitempty"`
496496
}
497497

@@ -568,7 +568,7 @@ type JSONSchemaProps struct {
568568
// type is the type of the variable.
569569
// Valid values are: object, array, string, integer, number or boolean.
570570
// +optional
571-
// +kubebuilder:validation:MaxLength=16
571+
// +kubebuilder:validation:Enum=object;array;string;integer;number;boolean
572572
Type string `json:"type,omitempty"`
573573

574574
// properties specifies fields of an object.
@@ -824,7 +824,7 @@ type ValidationRule struct {
824824
// skipped if an old value could not be found.
825825
//
826826
// +required
827-
// +kubebuilder:validation:MaxLength=512
827+
// +kubebuilder:validation:MaxLength=4096
828828
Rule string `json:"rule"`
829829
// message represents the message displayed when validation fails. The message is required if the Rule contains
830830
// line breaks. The message must not contain line breaks.
@@ -843,7 +843,7 @@ type ValidationRule struct {
843843
// Example:
844844
// "x must be less than max ("+string(self.max)+")"
845845
// +optional
846-
// +kubebuilder:validation:MaxLength=512
846+
// +kubebuilder:validation:MaxLength=1024
847847
MessageExpression string `json:"messageExpression,omitempty"`
848848
// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
849849
// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
@@ -894,7 +894,7 @@ type ClusterClassPatch struct {
894894
Name string `json:"name"`
895895

896896
// description is a human-readable description of this patch.
897-
// +kubebuilder:validation:MaxLength=512
897+
// +kubebuilder:validation:MaxLength=1024
898898
Description string `json:"description,omitempty"`
899899

900900
// enabledIf is a Go template to be used to calculate if a patch should be enabled.
@@ -998,7 +998,7 @@ type PatchSelectorMatchMachinePoolClass struct {
998998
type JSONPatch struct {
999999
// op defines the operation of the patch.
10001000
// Note: Only `add`, `replace` and `remove` are supported.
1001-
// +kubebuilder:validation:MaxLength=8
1001+
// +kubebuilder:validation:Enum=add;replace;remove
10021002
Op string `json:"op"`
10031003

10041004
// path defines the path of the patch.

api/v1beta1/common_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ var (
270270
)
271271

272272
// MachineAddressType describes a valid MachineAddress type.
273-
// +kubebuilder:validation:MaxLength=16
273+
// +kubebuilder:validation:Enum=Hostname;ExternalIP;InternalIP;ExternalDNS;InternalDNS
274274
type MachineAddressType string
275275

276276
// Define the MachineAddressType constants.

api/v1beta1/condition_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
// ANCHOR: ConditionSeverity
2525

2626
// ConditionSeverity expresses the severity of a Condition Type failing.
27-
// +kubebuilder:validation:MaxLength=8
27+
// +kubebuilder:validation:MaxLength=32
2828
type ConditionSeverity string
2929

3030
const (
@@ -85,7 +85,7 @@ type Condition struct {
8585
// message is a human readable message indicating details about the transition.
8686
// This field may be empty.
8787
// +optional
88-
// +kubebuilder:validation:MaxLength=2048
88+
// +kubebuilder:validation:MaxLength=10240
8989
Message string `json:"message,omitempty"`
9090
}
9191

api/v1beta1/machine_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ type MachineSpec struct {
406406
// This field will be set by the actuators and consumed by higher level entities like autoscaler that will
407407
// be interfacing with cluster-api as generic provider.
408408
// +optional
409-
// +kubebuilder:validation:MaxLength=253
409+
// +kubebuilder:validation:MaxLength=512
410410
ProviderID *string `json:"providerID,omitempty"`
411411

412412
// failureDomain is the failure domain the machine will be created in.
@@ -552,9 +552,8 @@ type MachineStatus struct {
552552
Addresses MachineAddresses `json:"addresses,omitempty"`
553553

554554
// phase represents the current phase of machine actuation.
555-
// E.g. Pending, Running, Terminating, Failed etc.
556555
// +optional
557-
// +kubebuilder:validation:MaxLength=50
556+
// +kubebuilder:validation:Enum=Pending;Provisioning;Provisioned;Running;Deleting;Deleted;Failed;Unknown
558557
Phase string `json:"phase,omitempty"`
559558

560559
// certificatesExpiryDate is the expiry date of the machine certificates.
@@ -660,6 +659,7 @@ type Bootstrap struct {
660659
// dataSecretName is the name of the secret that stores the bootstrap data script.
661660
// If nil, the Machine should remain in the Pending state.
662661
// +optional
662+
// +kubebuilder:validation:MinLength=1
663663
// +kubebuilder:validation:MaxLength=253
664664
DataSecretName *string `json:"dataSecretName,omitempty"`
665665
}

api/v1beta1/machinedeployment_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ type MachineDeploymentStatus struct {
490490

491491
// phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown).
492492
// +optional
493-
// +kubebuilder:validation:MaxLength=50
493+
// +kubebuilder:validation:Enum=ScalingUp;ScalingDown;Running;Failed;Unknown
494494
Phase string `json:"phase,omitempty"`
495495

496496
// conditions defines current service state of the MachineDeployment.

api/v1beta1/zz_generated.openapi.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ type APIServer struct {
182182
// certSANs sets extra Subject Alternative Names for the API Server signing cert.
183183
// +optional
184184
// +kubebuilder:validation:MaxItems=100
185-
// +kubebuilder:validation:items:MaxLength=512
185+
// +kubebuilder:validation:items:MaxLength=253
186186
CertSANs []string `json:"certSANs,omitempty"`
187187

188188
// timeoutForControlPlane controls the timeout that we use for API server to appear
@@ -284,7 +284,6 @@ type NodeRegistrationOptions struct {
284284
// with Kubernetes version equal to 1.22 and later.
285285
// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
286286
// +optional
287-
// +kubebuilder:validation:MaxLength=16
288287
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
289288

290289
// imagePullSerial specifies if image pulling performed by kubeadm must be done serially or in parallel.
@@ -437,13 +436,13 @@ type LocalEtcd struct {
437436
// serverCertSANs sets extra Subject Alternative Names for the etcd server signing cert.
438437
// +optional
439438
// +kubebuilder:validation:MaxItems=100
440-
// +kubebuilder:validation:items:MaxLength=512
439+
// +kubebuilder:validation:items:MaxLength=253
441440
ServerCertSANs []string `json:"serverCertSANs,omitempty"`
442441

443442
// peerCertSANs sets extra Subject Alternative Names for the etcd peer signing cert.
444443
// +optional
445444
// +kubebuilder:validation:MaxItems=100
446-
// +kubebuilder:validation:items:MaxLength=512
445+
// +kubebuilder:validation:items:MaxLength=253
447446
PeerCertSANs []string `json:"peerCertSANs,omitempty"`
448447
}
449448

@@ -635,7 +634,7 @@ type KubeConfigCluster struct {
635634
// Defaults to the Cluster's CA certificate if empty.
636635
//
637636
// +optional
638-
// +kubebuilder:validation:MaxLength=4096
637+
// +kubebuilder:validation:MaxLength=51200
639638
CertificateAuthorityData []byte `json:"certificateAuthorityData,omitempty"`
640639

641640
// proxyURL is the URL to the proxy to be used for all requests made by this

bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ type Partition struct {
732732
// 'mbr': default and setups a MS-DOS partition table
733733
// 'gpt': setups a GPT partition table
734734
// +optional
735-
// +kubebuilder:validation:MaxLength=3
735+
// +kubebuilder:validation:Enum=mbr;gpt
736736
TableType *string `json:"tableType,omitempty"`
737737
}
738738

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)