Skip to content

Commit ad63d08

Browse files
committed
fixup! build: Sync CAPX APIs and examples
1 parent 9f4c679 commit ad63d08

File tree

8 files changed

+84
-10
lines changed

8 files changed

+84
-10
lines changed

api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1/nutanix_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ const (
6161

6262
// NutanixResourceIdentifier holds the identity of a Nutanix PC resource (cluster, image, subnet, etc.)
6363
// +union
64+
// +kubebuilder:validation:XValidation:rule="self.type == 'name' ? has(self.name) : !has(self.name)",message="'name' must be set when type is 'name', and forbidden otherwise"
65+
// +kubebuilder:validation:XValidation:rule="self.type == 'uuid' ? has(self.uuid) && self.uuid.contains('-') : !has(self.uuid)",message="'uuid' must be set when type is 'uuid', and forbidden otherwise"
6466
type NutanixResourceIdentifier struct {
6567
// Type is the identifier type to use for this resource.
6668
// +kubebuilder:validation:Required
@@ -69,10 +71,14 @@ type NutanixResourceIdentifier struct {
6971

7072
// uuid is the UUID of the resource in the PC.
7173
// +optional
74+
// +kubebuilder:validation:Format=uuid
75+
// +kubebuilder:validation:MaxLength=36
76+
// +kubebuilder:validation:MinLength=36
7277
UUID *string `json:"uuid,omitempty"`
7378

7479
// name is the resource name in the PC
7580
// +optional
81+
// +kubebuilder:validation:MinLength=1
7682
Name *string `json:"name,omitempty"`
7783
}
7884

api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1/nutanixfailuredomain_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const (
3131
)
3232

3333
// NutanixFailureDomainSpec defines the desired state of NutanixFailureDomain.
34+
// +kubebuilder:validation:XValidation:rule="size(self.subnets) > 1 ? self.subnets.all(x, self.subnets.exists_one(y, x == y)) : true",message="each subnet must be unique"
3435
type NutanixFailureDomainSpec struct {
3536
// prismElementCluster is to identify the Prism Element cluster in the Prism Central for the failure domain.
3637
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="prismElementCluster is immutable once set"
@@ -42,6 +43,7 @@ type NutanixFailureDomainSpec struct {
4243
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="subnets is immutable once set"
4344
// +kubebuilder:validation:Required
4445
// +kubebuilder:validation:MinItems=1
46+
// +kubebuilder:validation:MaxItems=32
4547
Subnets []NutanixResourceIdentifier `json:"subnets"`
4648
}
4749

api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1/nutanixmachine_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ type NutanixImageLookup struct {
9898

9999
// NutanixMachineSpec defines the desired state of NutanixMachine
100100
// +kubebuilder:validation:XValidation:rule="has(self.image) != has(self.imageLookup)",message="Either 'image' or 'imageLookup' must be set, but not both"
101+
// +kubebuilder:validation:XValidation:rule="has(self.subnet) && size(self.subnet) > 1 ? self.subnet.all(x, self.subnet.exists_one(y, x == y)) : true",message="each subnet must be unique"
101102
type NutanixMachineSpec struct {
102103
// SPEC FIELDS - desired state of NutanixMachine
103104
// Important: Run "make" to regenerate code after modifying this file
@@ -136,6 +137,7 @@ type NutanixMachineSpec struct {
136137
// subnet is to identify the cluster's network subnet to use for the Machine's VM
137138
// The cluster identifier (uuid or name) can be obtained from the Prism Central console
138139
// or using the prism_central API.
140+
// +kubebuilder:validation:MaxItems=32
139141
// +kubebuilder:validation:Optional
140142
Subnets []NutanixResourceIdentifier `json:"subnet,omitempty"`
141143
// List of categories that need to be added to the machines. Categories must already exist in Prism Central

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ spec:
376376
properties:
377377
name:
378378
description: name is the resource name in the PC
379+
minLength: 1
379380
type: string
380381
type:
381382
description: Type is the identifier type to use for this resource.
@@ -385,10 +386,18 @@ spec:
385386
type: string
386387
uuid:
387388
description: uuid is the UUID of the resource in the PC.
389+
format: uuid
390+
maxLength: 36
391+
minLength: 36
388392
type: string
389393
required:
390394
- type
391395
type: object
396+
x-kubernetes-validations:
397+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
398+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
399+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
400+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
392401
gpus:
393402
description: List of GPU devices that need to be added to the machines.
394403
items:
@@ -418,6 +427,7 @@ spec:
418427
properties:
419428
name:
420429
description: name is the resource name in the PC
430+
minLength: 1
421431
type: string
422432
type:
423433
description: Type is the identifier type to use for this resource.
@@ -427,10 +437,18 @@ spec:
427437
type: string
428438
uuid:
429439
description: uuid is the UUID of the resource in the PC.
440+
format: uuid
441+
maxLength: 36
442+
minLength: 36
430443
type: string
431444
required:
432445
- type
433446
type: object
447+
x-kubernetes-validations:
448+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
449+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
450+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
451+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
434452
imageLookup:
435453
description: imageLookup is a container that holds how to look up vm images for the cluster.
436454
properties:
@@ -470,6 +488,7 @@ spec:
470488
properties:
471489
name:
472490
description: name is the resource name in the PC
491+
minLength: 1
473492
type: string
474493
type:
475494
description: Type is the identifier type to use for this resource.
@@ -479,10 +498,18 @@ spec:
479498
type: string
480499
uuid:
481500
description: uuid is the UUID of the resource in the PC.
501+
format: uuid
502+
maxLength: 36
503+
minLength: 36
482504
type: string
483505
required:
484506
- type
485507
type: object
508+
x-kubernetes-validations:
509+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
510+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
511+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
512+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
486513
subnets:
487514
description: |-
488515
subnet identifies the network subnet to use for the machine.
@@ -492,6 +519,7 @@ spec:
492519
properties:
493520
name:
494521
description: name is the resource name in the PC
522+
minLength: 1
495523
type: string
496524
type:
497525
description: Type is the identifier type to use for this resource.
@@ -501,10 +529,18 @@ spec:
501529
type: string
502530
uuid:
503531
description: uuid is the UUID of the resource in the PC.
532+
format: uuid
533+
maxLength: 36
534+
minLength: 36
504535
type: string
505536
required:
506537
- type
507538
type: object
539+
x-kubernetes-validations:
540+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
541+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
542+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
543+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
508544
maxItems: 16
509545
type: array
510546
systemDiskSize:

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ spec:
9090
properties:
9191
name:
9292
description: name is the resource name in the PC
93+
minLength: 1
9394
type: string
9495
type:
9596
description: Type is the identifier type to use for this resource.
@@ -99,10 +100,18 @@ spec:
99100
type: string
100101
uuid:
101102
description: uuid is the UUID of the resource in the PC.
103+
format: uuid
104+
maxLength: 36
105+
minLength: 36
102106
type: string
103107
required:
104108
- type
105109
type: object
110+
x-kubernetes-validations:
111+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
112+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
113+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
114+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
106115
gpus:
107116
description: List of GPU devices that need to be added to the machines.
108117
items:
@@ -132,6 +141,7 @@ spec:
132141
properties:
133142
name:
134143
description: name is the resource name in the PC
144+
minLength: 1
135145
type: string
136146
type:
137147
description: Type is the identifier type to use for this resource.
@@ -141,10 +151,18 @@ spec:
141151
type: string
142152
uuid:
143153
description: uuid is the UUID of the resource in the PC.
154+
format: uuid
155+
maxLength: 36
156+
minLength: 36
144157
type: string
145158
required:
146159
- type
147160
type: object
161+
x-kubernetes-validations:
162+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
163+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
164+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
165+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
148166
imageLookup:
149167
description: imageLookup is a container that holds how to look up vm images for the cluster.
150168
properties:
@@ -184,6 +202,7 @@ spec:
184202
properties:
185203
name:
186204
description: name is the resource name in the PC
205+
minLength: 1
187206
type: string
188207
type:
189208
description: Type is the identifier type to use for this resource.
@@ -193,10 +212,18 @@ spec:
193212
type: string
194213
uuid:
195214
description: uuid is the UUID of the resource in the PC.
215+
format: uuid
216+
maxLength: 36
217+
minLength: 36
196218
type: string
197219
required:
198220
- type
199221
type: object
222+
x-kubernetes-validations:
223+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
224+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
225+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
226+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
200227
subnets:
201228
description: |-
202229
subnet identifies the network subnet to use for the machine.
@@ -206,6 +233,7 @@ spec:
206233
properties:
207234
name:
208235
description: name is the resource name in the PC
236+
minLength: 1
209237
type: string
210238
type:
211239
description: Type is the identifier type to use for this resource.
@@ -215,10 +243,18 @@ spec:
215243
type: string
216244
uuid:
217245
description: uuid is the UUID of the resource in the PC.
246+
format: uuid
247+
maxLength: 36
248+
minLength: 36
218249
type: string
219250
required:
220251
- type
221252
type: object
253+
x-kubernetes-validations:
254+
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
255+
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
256+
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
257+
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
222258
maxItems: 16
223259
type: array
224260
systemDiskSize:

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ spec:
344344
spec:
345345
bootType: legacy
346346
image:
347-
name: ""
347+
name: placeholder-image
348348
type: name
349349
memorySize: 4Gi
350350
systemDiskSize: 40Gi
@@ -362,7 +362,7 @@ spec:
362362
spec:
363363
bootType: legacy
364364
image:
365-
name: ""
365+
name: placeholder-image
366366
type: name
367367
memorySize: 4Gi
368368
systemDiskSize: 40Gi

hack/examples/overlays/clusterclasses/nutanix/kustomization.yaml.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,3 @@ patches:
7272
kind: KubeadmConfigTemplate
7373
path: ../../../patches/cis/kubeadmconfigtemplate/kubelet-file-permissions.yaml
7474
# END CIS patches
75-
76-
- target:
77-
kind: NutanixMachineTemplate
78-
path: ../../../patches/nutanix/remove-cluster-and-subnet-from-machinetemplates.yaml

hack/examples/patches/nutanix/remove-cluster-and-subnet-from-machinetemplates.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)