Skip to content

Commit ca84e1a

Browse files
authored
fix: Align validation with upstream Kubeadm Bootstrap Provider types (#1342)
**What problem does this PR solve?**: The maxLength was too short in some cases, breaking cluster creation. Now, all parameters align with the upstream types. **Which issue(s) this PR fixes**: Fixes https://jira.nutanix.com/browse/NCN-110334 **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent 1961ebf commit ca84e1a

6 files changed

+36
-24
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ type ImageRegistry struct {
362362
type User struct {
363363
// Name specifies the user name.
364364
// +kubebuilder:validation:Required
365+
// +kubebuilder:validation:MinLength=1
365366
// +kubebuilder:validation:MaxLength=256
366367
Name string `json:"name"`
367368

@@ -371,23 +372,24 @@ type User struct {
371372
// An empty string is not marshalled, because it is not a valid value.
372373
// +kubebuilder:validation:Optional
373374
// +kubebuilder:validation:MinLength=1
374-
// +kubebuilder:validation:MaxLength=106
375+
// +kubebuilder:validation:MaxLength=256
375376
HashedPassword string `json:"hashedPassword,omitempty"`
376377

377378
// SSHAuthorizedKeys is a list of public SSH keys to write to the
378379
// machine. Use the corresponding private SSH keys to authenticate. See SSH
379380
// documentation for instructions to create a key pair.
380381
// +kubebuilder:validation:Optional
381-
// +kubebuilder:validation:MaxItems=32
382-
// +kubebuilder:validation:items:MaxLength=256
382+
// +kubebuilder:validation:MaxItems=100
383+
// +kubebuilder:validation:items:MinLength=1
384+
// +kubebuilder:validation:items:MaxLength=2048
383385
SSHAuthorizedKeys []string `json:"sshAuthorizedKeys,omitempty"`
384386

385387
// Sudo is a sudo user specification, formatted as described in the sudo
386388
// documentation.
387389
// An empty string is not marshalled, because it is not a valid value.
388390
// +kubebuilder:validation:Optional
389391
// +kubebuilder:validation:MinLength=1
390-
// +kubebuilder:validation:MaxLength=1024
392+
// +kubebuilder:validation:MaxLength=256
391393
Sudo string `json:"sudo,omitempty"`
392394
}
393395

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,29 +804,31 @@ spec:
804804
by the crypt(5) man page. See your distribution's documentation for
805805
instructions to create a hashed password.
806806
An empty string is not marshalled, because it is not a valid value.
807-
maxLength: 106
807+
maxLength: 256
808808
minLength: 1
809809
type: string
810810
name:
811811
description: Name specifies the user name.
812812
maxLength: 256
813+
minLength: 1
813814
type: string
814815
sshAuthorizedKeys:
815816
description: |-
816817
SSHAuthorizedKeys is a list of public SSH keys to write to the
817818
machine. Use the corresponding private SSH keys to authenticate. See SSH
818819
documentation for instructions to create a key pair.
819820
items:
820-
maxLength: 256
821+
maxLength: 2048
822+
minLength: 1
821823
type: string
822-
maxItems: 32
824+
maxItems: 100
823825
type: array
824826
sudo:
825827
description: |-
826828
Sudo is a sudo user specification, formatted as described in the sudo
827829
documentation.
828830
An empty string is not marshalled, because it is not a valid value.
829-
maxLength: 1024
831+
maxLength: 256
830832
minLength: 1
831833
type: string
832834
required:

api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,29 +605,31 @@ spec:
605605
by the crypt(5) man page. See your distribution's documentation for
606606
instructions to create a hashed password.
607607
An empty string is not marshalled, because it is not a valid value.
608-
maxLength: 106
608+
maxLength: 256
609609
minLength: 1
610610
type: string
611611
name:
612612
description: Name specifies the user name.
613613
maxLength: 256
614+
minLength: 1
614615
type: string
615616
sshAuthorizedKeys:
616617
description: |-
617618
SSHAuthorizedKeys is a list of public SSH keys to write to the
618619
machine. Use the corresponding private SSH keys to authenticate. See SSH
619620
documentation for instructions to create a key pair.
620621
items:
621-
maxLength: 256
622+
maxLength: 2048
623+
minLength: 1
622624
type: string
623-
maxItems: 32
625+
maxItems: 100
624626
type: array
625627
sudo:
626628
description: |-
627629
Sudo is a sudo user specification, formatted as described in the sudo
628630
documentation.
629631
An empty string is not marshalled, because it is not a valid value.
630-
maxLength: 1024
632+
maxLength: 256
631633
minLength: 1
632634
type: string
633635
required:

api/v1alpha1/crds/caren.nutanix.com_eksclusterconfigs.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,29 +479,31 @@ spec:
479479
by the crypt(5) man page. See your distribution's documentation for
480480
instructions to create a hashed password.
481481
An empty string is not marshalled, because it is not a valid value.
482-
maxLength: 106
482+
maxLength: 256
483483
minLength: 1
484484
type: string
485485
name:
486486
description: Name specifies the user name.
487487
maxLength: 256
488+
minLength: 1
488489
type: string
489490
sshAuthorizedKeys:
490491
description: |-
491492
SSHAuthorizedKeys is a list of public SSH keys to write to the
492493
machine. Use the corresponding private SSH keys to authenticate. See SSH
493494
documentation for instructions to create a key pair.
494495
items:
495-
maxLength: 256
496+
maxLength: 2048
497+
minLength: 1
496498
type: string
497-
maxItems: 32
499+
maxItems: 100
498500
type: array
499501
sudo:
500502
description: |-
501503
Sudo is a sudo user specification, formatted as described in the sudo
502504
documentation.
503505
An empty string is not marshalled, because it is not a valid value.
504-
maxLength: 1024
506+
maxLength: 256
505507
minLength: 1
506508
type: string
507509
required:

api/v1alpha1/crds/caren.nutanix.com_genericclusterconfigs.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,31 @@ spec:
159159
by the crypt(5) man page. See your distribution's documentation for
160160
instructions to create a hashed password.
161161
An empty string is not marshalled, because it is not a valid value.
162-
maxLength: 106
162+
maxLength: 256
163163
minLength: 1
164164
type: string
165165
name:
166166
description: Name specifies the user name.
167167
maxLength: 256
168+
minLength: 1
168169
type: string
169170
sshAuthorizedKeys:
170171
description: |-
171172
SSHAuthorizedKeys is a list of public SSH keys to write to the
172173
machine. Use the corresponding private SSH keys to authenticate. See SSH
173174
documentation for instructions to create a key pair.
174175
items:
175-
maxLength: 256
176+
maxLength: 2048
177+
minLength: 1
176178
type: string
177-
maxItems: 32
179+
maxItems: 100
178180
type: array
179181
sudo:
180182
description: |-
181183
Sudo is a sudo user specification, formatted as described in the sudo
182184
documentation.
183185
An empty string is not marshalled, because it is not a valid value.
184-
maxLength: 1024
186+
maxLength: 256
185187
minLength: 1
186188
type: string
187189
required:

api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,29 +892,31 @@ spec:
892892
by the crypt(5) man page. See your distribution's documentation for
893893
instructions to create a hashed password.
894894
An empty string is not marshalled, because it is not a valid value.
895-
maxLength: 106
895+
maxLength: 256
896896
minLength: 1
897897
type: string
898898
name:
899899
description: Name specifies the user name.
900900
maxLength: 256
901+
minLength: 1
901902
type: string
902903
sshAuthorizedKeys:
903904
description: |-
904905
SSHAuthorizedKeys is a list of public SSH keys to write to the
905906
machine. Use the corresponding private SSH keys to authenticate. See SSH
906907
documentation for instructions to create a key pair.
907908
items:
908-
maxLength: 256
909+
maxLength: 2048
910+
minLength: 1
909911
type: string
910-
maxItems: 32
912+
maxItems: 100
911913
type: array
912914
sudo:
913915
description: |-
914916
Sudo is a sudo user specification, formatted as described in the sudo
915917
documentation.
916918
An empty string is not marshalled, because it is not a valid value.
917-
maxLength: 1024
919+
maxLength: 256
918920
minLength: 1
919921
type: string
920922
required:

0 commit comments

Comments
 (0)