Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const (

// NutanixResourceIdentifier holds the identity of a Nutanix PC resource (cluster, image, subnet, etc.)
// +union
// +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"
// +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"
type NutanixResourceIdentifier struct {
// Type is the identifier type to use for this resource.
// +kubebuilder:validation:Required
Expand All @@ -69,10 +71,14 @@ type NutanixResourceIdentifier struct {

// uuid is the UUID of the resource in the PC.
// +optional
// +kubebuilder:validation:Format=uuid
// +kubebuilder:validation:MaxLength=36
// +kubebuilder:validation:MinLength=36
UUID *string `json:"uuid,omitempty"`

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
)

// NutanixFailureDomainSpec defines the desired state of NutanixFailureDomain.
// +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"
type NutanixFailureDomainSpec struct {
// prismElementCluster is to identify the Prism Element cluster in the Prism Central for the failure domain.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="prismElementCluster is immutable once set"
Expand All @@ -42,6 +43,7 @@ type NutanixFailureDomainSpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="subnets is immutable once set"
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=32
Subnets []NutanixResourceIdentifier `json:"subnets"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type NutanixImageLookup struct {

// NutanixMachineSpec defines the desired state of NutanixMachine
// +kubebuilder:validation:XValidation:rule="has(self.image) != has(self.imageLookup)",message="Either 'image' or 'imageLookup' must be set, but not both"
// +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"
type NutanixMachineSpec struct {
// SPEC FIELDS - desired state of NutanixMachine
// Important: Run "make" to regenerate code after modifying this file
Expand Down Expand Up @@ -136,6 +137,7 @@ type NutanixMachineSpec struct {
// subnet is to identify the cluster's network subnet to use for the Machine's VM
// The cluster identifier (uuid or name) can be obtained from the Prism Central console
// or using the prism_central API.
// +kubebuilder:validation:MaxItems=32
// +kubebuilder:validation:Optional
Subnets []NutanixResourceIdentifier `json:"subnet,omitempty"`
// List of categories that need to be added to the machines. Categories must already exist in Prism Central
Expand Down
36 changes: 36 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -385,10 +386,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
gpus:
description: List of GPU devices that need to be added to the machines.
items:
Expand Down Expand Up @@ -418,6 +427,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -427,10 +437,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
imageLookup:
description: imageLookup is a container that holds how to look up vm images for the cluster.
properties:
Expand Down Expand Up @@ -470,6 +488,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -479,10 +498,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
subnets:
description: |-
subnet identifies the network subnet to use for the machine.
Expand All @@ -492,6 +519,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -501,10 +529,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
maxItems: 16
type: array
systemDiskSize:
Expand Down
36 changes: 36 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixworkernodeconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -99,10 +100,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
gpus:
description: List of GPU devices that need to be added to the machines.
items:
Expand Down Expand Up @@ -132,6 +141,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -141,10 +151,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
imageLookup:
description: imageLookup is a container that holds how to look up vm images for the cluster.
properties:
Expand Down Expand Up @@ -184,6 +202,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -193,10 +212,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
subnets:
description: |-
subnet identifies the network subnet to use for the machine.
Expand All @@ -206,6 +233,7 @@ spec:
properties:
name:
description: name is the resource name in the PC
minLength: 1
type: string
type:
description: Type is the identifier type to use for this resource.
Expand All @@ -215,10 +243,18 @@ spec:
type: string
uuid:
description: uuid is the UUID of the resource in the PC.
format: uuid
maxLength: 36
minLength: 36
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: '''name'' must be set when type is ''name'', and forbidden otherwise'
rule: 'self.type == ''name'' ? has(self.name) : !has(self.name)'
- message: '''uuid'' must be set when type is ''uuid'', and forbidden otherwise'
rule: 'self.type == ''uuid'' ? has(self.uuid) && self.uuid.contains(''-'') : !has(self.uuid)'
maxItems: 16
type: array
systemDiskSize:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ spec:
spec:
bootType: legacy
image:
name: ""
name: placeholder-image
type: name
memorySize: 4Gi
systemDiskSize: 40Gi
Expand All @@ -362,7 +362,7 @@ spec:
spec:
bootType: legacy
image:
name: ""
name: placeholder-image
type: name
memorySize: 4Gi
systemDiskSize: 40Gi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,3 @@ patches:
kind: KubeadmConfigTemplate
path: ../../../patches/cis/kubeadmconfigtemplate/kubelet-file-permissions.yaml
# END CIS patches

- target:
kind: NutanixMachineTemplate
path: ../../../patches/nutanix/remove-cluster-and-subnet-from-machinetemplates.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion hack/third-party/capx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.24.0

toolchain go1.24.3

require github.com/nutanix-cloud-native/cluster-api-provider-nutanix v1.7.0
require github.com/nutanix-cloud-native/cluster-api-provider-nutanix v1.7.1

require (
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
Expand Down
Loading
Loading