You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/v1alpha1/ionoscloudmachine_types.go
+25-4Lines changed: 25 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,10 @@ const (
98
98
ServerTypeEnterpriseServerType="ENTERPRISE"
99
99
// ServerTypeVCPU server of type VCPU.
100
100
ServerTypeVCPUServerType="VCPU"
101
+
// ServerTypeCUBE server of type CUBE.
102
+
ServerTypeCUBEServerType="CUBE"
103
+
// ServerTypeGPU server of type GPU.
104
+
ServerTypeGPUServerType="GPU"
101
105
)
102
106
103
107
// String returns the string representation of the ServerType.
@@ -107,6 +111,8 @@ func (a ServerType) String() string {
107
111
108
112
// IonosCloudMachineSpec defines the desired state of IonosCloudMachine.
109
113
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.networkID) || has(self.networkID)", message="networkID is required once set"
114
+
// +kubebuilder:validation:XValidation:rule="(self.type != 'CUBE' && self.type != 'GPU') || self.templateID != ''",message="templateID is required when type is CUBE or GPU"
115
+
// +kubebuilder:validation:XValidation:rule="(self.type == 'CUBE' || self.type == 'GPU') || !has(self.templateID) || self.templateID == ''",message="templateID must only be used with CUBE or GPU type"
110
116
typeIonosCloudMachineSpecstruct {
111
117
// ProviderID is the IONOS Cloud provider ID
112
118
// will be in the format ionos://ee090ff2-1eef-48ec-a246-a51a33aa4f3a
@@ -118,7 +124,17 @@ type IonosCloudMachineSpec struct {
118
124
//+kubebuilder:validation:Format=uuid
119
125
DatacenterIDstring`json:"datacenterID"`
120
126
127
+
// TemplateID is the ID of the template for creating CUBE or GPU servers.
128
+
// If a template has GPU cards assigned, then it can only be used to create GPU servers,
129
+
// otherwise it can only be used for CUBE servers.
130
+
// NumCores, MemoryMB, CPUFamily and the size parameter of the first volume (boot Disk) are ignored when this is set.
131
+
// Available TemplateIDs can be listed using the cloud api.
132
+
//+kubebuilder:validation:Format=uuid
133
+
//+optional
134
+
TemplateIDstring`json:"templateID,omitempty"`
135
+
121
136
// NumCores defines the number of cores for the VM.
137
+
// Ignored when TemplateID is specified.
122
138
//+kubebuilder:validation:Minimum=1
123
139
//+kubebuilder:default=1
124
140
//+optional
@@ -133,6 +149,7 @@ type IonosCloudMachineSpec struct {
133
149
// MemoryMB is the memory size for the VM in MB.
134
150
// Size must be specified in multiples of 256 MB with a minimum of 1024 MB
135
151
// which is required as we are using hot-pluggable RAM by default.
152
+
// Ignored when TemplateID is specified.
136
153
//+kubebuilder:validation:MultipleOf=1024
137
154
//+kubebuilder:validation:Minimum=2048
138
155
//+kubebuilder:default=3072
@@ -144,6 +161,7 @@ type IonosCloudMachineSpec struct {
144
161
//
145
162
// If not specified, the cloud will select a suitable CPU family
146
163
// based on the availability in the data center.
164
+
// Ignored when TemplateID is specified.
147
165
//+kubebuilder:example=AMD_OPTERON
148
166
//+optional
149
167
CPUFamily*string`json:"cpuFamily,omitempty"`
@@ -180,9 +198,10 @@ type IonosCloudMachineSpec struct {
180
198
// +kubebuilder:validation:MinLength=1
181
199
NetworkID*string`json:"networkID,omitempty"`
182
200
183
-
// Type is the server type of the VM. Can be either ENTERPRISE or VCPU.
201
+
// Type is the server type of the VM. Can be either ENTERPRISE, VCPU, CUBE or GPU.
202
+
// Use the types CUBE or GPU together with TemplateID.
184
203
//+kubebuilder:validation:XValidation:rule="self == oldSelf",message="type is immutable"
// Ignored when TemplateID of IonosCloudMachineSpec is specified (for the boot volume).
225
246
//+kubebuilder:validation:Minimum=10
226
247
//+kubebuilder:default=20
227
248
//+optional
@@ -392,7 +413,7 @@ type IonosCloudMachine struct {
392
413
metav1.TypeMeta`json:",inline"`
393
414
metav1.ObjectMeta`json:"metadata,omitempty"`
394
415
395
-
//+kubebuilder:validation:XValidation:rule="self.type != 'VCPU' || !has(self.cpuFamily)",message="cpuFamily must not be specified when using VCPU"
416
+
//+kubebuilder:validation:XValidation:rule="(self.type != 'VCPU' && self.type != 'CUBE' && self.type != 'GPU') || !has(self.cpuFamily)",message="cpuFamily must not be specified when using VCPU, CUBE or GPU"
0 commit comments