4
4
package v1alpha1
5
5
6
6
import (
7
- "k8s.io/apimachinery/pkg/api/resource"
7
+ capxv1 "github.com/d2iq-labs/capi-runtime-extensions/api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
8
+ "github.com/d2iq-labs/capi-runtime-extensions/api/variables"
8
9
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
9
10
)
10
11
@@ -25,7 +26,7 @@ type NutanixNodeSpec struct {
25
26
VCPUSockets int32 `json:"vcpuSockets"`
26
27
27
28
// memorySize is the memory size (in Quantity format) of the VM
28
- MemorySize resource. Quantity `json:"memorySize"`
29
+ MemorySize string `json:"memorySize"`
29
30
30
31
// image is to identify the rhcos image uploaded to the Prism Central (PC)
31
32
// The image identifier (uuid or name) can be obtained from the Prism Central console
@@ -41,7 +42,7 @@ type NutanixNodeSpec struct {
41
42
// subnet is to identify the cluster's network subnet to use for the Machine's VM
42
43
// The cluster identifier (uuid or name) can be obtained from the Prism Central console
43
44
// or using the prism_central API.
44
- Subnets [] NutanixResourceIdentifier `json:"subnet"`
45
+ Subnets NutanixResourceIdentifiers `json:"subnet"`
45
46
46
47
// List of categories that need to be added to the machines. Categories must already exist in Prism Central
47
48
AdditionalCategories []NutanixCategoryIdentifier `json:"additionalCategories,omitempty"`
@@ -50,11 +51,11 @@ type NutanixNodeSpec struct {
50
51
Project * NutanixResourceIdentifier `json:"project,omitempty"`
51
52
52
53
// Defines the boot type of the virtual machine. Only supports UEFI and Legacy
53
- BootType string `json:"bootType,omitempty"` //TODO use enum NutanixBootType
54
+ BootType string `json:"bootType,omitempty"` //TODO use NutanixBootType enum somehow
54
55
55
56
// systemDiskSize is size (in Quantity format) of the system disk of the VM
56
57
// The minimum systemDiskSize is 20Gi bytes
57
- SystemDiskSize resource. Quantity `json:"systemDiskSize"`
58
+ SystemDiskSize string `json:"systemDiskSize"`
58
59
59
60
// List of GPU devices that need to be added to the machines.
60
61
GPUs []NutanixGPU `json:"gpus,omitempty"`
@@ -65,7 +66,55 @@ func (NutanixNodeSpec) VariableSchema() clusterv1.VariableSchema {
65
66
OpenAPIV3Schema : clusterv1.JSONSchemaProps {
66
67
Description : "Nutanix Node configuration" ,
67
68
Type : "object" ,
68
- Properties : map [string ]clusterv1.JSONSchemaProps {},
69
+ Properties : map [string ]clusterv1.JSONSchemaProps {
70
+ "vcpusPerSocket" : {
71
+ Description : "vcpusPerSocket is the number of vCPUs per socket of the VM" ,
72
+ Type : "integer" ,
73
+ },
74
+ "vcpuSockets" : {
75
+ Description : "vcpuSockets is the number of vCPU sockets of the VM" ,
76
+ Type : "integer" ,
77
+ },
78
+ "memorySize" : {
79
+ Description : "memorySize is the memory size (in Quantity format) of the VM eg. 4Gi" ,
80
+ Type : "string" ,
81
+ },
82
+ "image" : NutanixResourceIdentifier {}.VariableSchema ().OpenAPIV3Schema ,
83
+ "cluster" : NutanixResourceIdentifier {}.VariableSchema ().OpenAPIV3Schema ,
84
+ "subnet" : NutanixResourceIdentifiers {}.VariableSchema ().OpenAPIV3Schema ,
85
+ "bootType" : {
86
+ Description : "Defines the boot type of the virtual machine. Only supports UEFI and Legacy" ,
87
+ Type : "string" ,
88
+ },
89
+ "systemDiskSize" : {
90
+ Description : "systemDiskSize is size (in Quantity format) of the system disk of the VM eg. 20Gi" ,
91
+ Type : "string" ,
92
+ },
93
+ // "project": {},
94
+ // "additionalCategories": {},
95
+ // "gpus": {},
96
+ },
97
+ },
98
+ }
99
+ }
100
+
101
+ func (NutanixBootType ) VariableSchema () clusterv1.VariableSchema {
102
+ supportedBootType := []capxv1.NutanixBootType {
103
+ capxv1 .NutanixBootTypeLegacy ,
104
+ capxv1 .NutanixBootTypeUEFI ,
105
+ }
106
+
107
+ return clusterv1.VariableSchema {
108
+ OpenAPIV3Schema : clusterv1.JSONSchemaProps {
109
+ Description : "Nutanix Boot type enum" ,
110
+ Type : "string" ,
111
+ Properties : map [string ]clusterv1.JSONSchemaProps {
112
+ "bootType" : {
113
+ Description : "Defines the boot type of the virtual machine. Only supports UEFI and Legacy" ,
114
+ Type : "string" ,
115
+ Enum : variables .MustMarshalValuesToEnumJSON (supportedBootType ... ),
116
+ },
117
+ },
69
118
},
70
119
}
71
120
}
0 commit comments