4
4
package v1alpha1
5
5
6
6
import (
7
+ "k8s.io/apimachinery/pkg/api/resource"
7
8
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
8
9
)
9
10
11
+ // NutanixIdentifierType is an enumeration of different resource identifier types.
12
+ type NutanixIdentifierType string
13
+
14
+ // NutanixBootType is an enumeration of different boot types.
15
+ type NutanixBootType string
16
+
17
+ // NutanixGPUIdentifierType is an enumeration of different resource identifier types for GPU entities.
18
+ type NutanixGPUIdentifierType string
19
+
10
20
type NutanixNodeSpec struct {
21
+ // vcpusPerSocket is the number of vCPUs per socket of the VM
22
+ VCPUsPerSocket int32 `json:"vcpusPerSocket"`
23
+
24
+ // vcpuSockets is the number of vCPU sockets of the VM
25
+ VCPUSockets int32 `json:"vcpuSockets"`
26
+
27
+ // memorySize is the memory size (in Quantity format) of the VM
28
+ MemorySize resource.Quantity `json:"memorySize"`
29
+
30
+ // image is to identify the rhcos image uploaded to the Prism Central (PC)
31
+ // The image identifier (uuid or name) can be obtained from the Prism Central console
32
+ // or using the prism_central API.
33
+ Image NutanixResourceIdentifier `json:"image"`
34
+
35
+ // cluster is to identify the cluster (the Prism Element under management
36
+ // of the Prism Central), in which the Machine's VM will be created.
37
+ // The cluster identifier (uuid or name) can be obtained from the Prism Central console
38
+ // or using the prism_central API.
39
+ Cluster NutanixResourceIdentifier `json:"cluster"`
40
+
41
+ // subnet is to identify the cluster's network subnet to use for the Machine's VM
42
+ // The cluster identifier (uuid or name) can be obtained from the Prism Central console
43
+ // or using the prism_central API.
44
+ Subnets []NutanixResourceIdentifier `json:"subnet"`
45
+
46
+ // List of categories that need to be added to the machines. Categories must already exist in Prism Central
47
+ AdditionalCategories []NutanixCategoryIdentifier `json:"additionalCategories,omitempty"`
48
+
49
+ // Add the machine resources to a Prism Central project
50
+ Project * NutanixResourceIdentifier `json:"project,omitempty"`
51
+
52
+ // Defines the boot type of the virtual machine. Only supports UEFI and Legacy
53
+ BootType string `json:"bootType,omitempty"` //TODO use enum NutanixBootType
54
+
55
+ // systemDiskSize is size (in Quantity format) of the system disk of the VM
56
+ // The minimum systemDiskSize is 20Gi bytes
57
+ SystemDiskSize resource.Quantity `json:"systemDiskSize"`
58
+
59
+ // List of GPU devices that need to be added to the machines.
60
+ GPUs []NutanixGPU `json:"gpus,omitempty"`
11
61
}
12
62
13
63
func (NutanixNodeSpec ) VariableSchema () clusterv1.VariableSchema {
@@ -19,3 +69,69 @@ func (NutanixNodeSpec) VariableSchema() clusterv1.VariableSchema {
19
69
},
20
70
}
21
71
}
72
+
73
+ type NutanixResourceIdentifier struct {
74
+ // Type is the identifier type to use for this resource.
75
+ Type NutanixIdentifierType `json:"type"`
76
+
77
+ // uuid is the UUID of the resource in the PC.
78
+ // +optional
79
+ UUID * string `json:"uuid,omitempty"`
80
+
81
+ // name is the resource name in the PC
82
+ // +optional
83
+ Name * string `json:"name,omitempty"`
84
+ }
85
+
86
+ func (NutanixResourceIdentifier ) VariableSchema () clusterv1.VariableSchema {
87
+ return clusterv1.VariableSchema {
88
+ OpenAPIV3Schema : clusterv1.JSONSchemaProps {
89
+ Description : "Nutanix Resource Identifier" ,
90
+ Type : "object" ,
91
+ Properties : map [string ]clusterv1.JSONSchemaProps {},
92
+ },
93
+ }
94
+ }
95
+
96
+ type NutanixCategoryIdentifier struct {
97
+ // key is the Key of category in PC.
98
+ // +optional
99
+ Key string `json:"key,omitempty"`
100
+
101
+ // value is the category value linked to the category key in PC
102
+ // +optional
103
+ Value string `json:"value,omitempty"`
104
+ }
105
+
106
+ func (NutanixCategoryIdentifier ) VariableSchema () clusterv1.VariableSchema {
107
+ return clusterv1.VariableSchema {
108
+ OpenAPIV3Schema : clusterv1.JSONSchemaProps {
109
+ Description : "Nutanix Category Identifier" ,
110
+ Type : "object" ,
111
+ Properties : map [string ]clusterv1.JSONSchemaProps {},
112
+ },
113
+ }
114
+ }
115
+
116
+ type NutanixGPU struct {
117
+ // Type is the identifier type to use for this resource.
118
+ Type NutanixGPUIdentifierType `json:"type"`
119
+
120
+ // deviceID is the id of the GPU entity.
121
+ // +optional
122
+ DeviceID * int64 `json:"deviceID,omitempty"`
123
+
124
+ // name is the GPU name
125
+ // +optional
126
+ Name * string `json:"name,omitempty"`
127
+ }
128
+
129
+ func (NutanixGPU ) VariableSchema () clusterv1.VariableSchema {
130
+ return clusterv1.VariableSchema {
131
+ OpenAPIV3Schema : clusterv1.JSONSchemaProps {
132
+ Description : "Nutanix GPU type" ,
133
+ Type : "object" ,
134
+ Properties : map [string ]clusterv1.JSONSchemaProps {},
135
+ },
136
+ }
137
+ }
0 commit comments