@@ -133,6 +133,11 @@ type WorkersClass struct {
133
133
// a set of worker nodes.
134
134
// +optional
135
135
MachineDeployments []MachineDeploymentClass `json:"machineDeployments,omitempty"`
136
+
137
+ // MachinePools is a list of machine pool classes that can be used to create
138
+ // a set of worker nodes.
139
+ // +optional
140
+ MachinePools []MachinePoolClass `json:"machinePools,omitempty"`
136
141
}
137
142
138
143
// MachineDeploymentClass serves as a template to define a set of worker nodes of the cluster
@@ -244,6 +249,69 @@ type MachineHealthCheckClass struct {
244
249
RemediationTemplate * corev1.ObjectReference `json:"remediationTemplate,omitempty"`
245
250
}
246
251
252
+ // MachinePoolClass serves as a template to define a pool of worker nodes of the cluster
253
+ // provisioned using `ClusterClass`.
254
+ type MachinePoolClass struct {
255
+ // Class denotes a type of machine pool present in the cluster,
256
+ // this name MUST be unique within a ClusterClass and can be referenced
257
+ // in the Cluster to create a managed MachinePool.
258
+ Class string `json:"class"`
259
+
260
+ // Template is a local struct containing a collection of templates for creation of
261
+ // MachinePools objects representing a pool of worker nodes.
262
+ Template MachinePoolClassTemplate `json:"template"`
263
+
264
+ // FailureDomains is the list of failure domains the MachinePool should be attached to.
265
+ // Must match a key in the FailureDomains map stored on the cluster object.
266
+ // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
267
+ // +optional
268
+ FailureDomains []string `json:"failureDomains,omitempty"`
269
+
270
+ // NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
271
+ // The default value is 0, meaning that the node can be drained without any time limitations.
272
+ // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
273
+ // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
274
+ // +optional
275
+ NodeDrainTimeout * metav1.Duration `json:"nodeDrainTimeout,omitempty"`
276
+
277
+ // NodeVolumeDetachTimeout is the total amount of time that the controller will spend on waiting for all volumes
278
+ // to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
279
+ // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
280
+ // +optional
281
+ NodeVolumeDetachTimeout * metav1.Duration `json:"nodeVolumeDetachTimeout,omitempty"`
282
+
283
+ // NodeDeletionTimeout defines how long the controller will attempt to delete the Node that the Machine
284
+ // hosts after the Machine Pool is marked for deletion. A duration of 0 will retry deletion indefinitely.
285
+ // Defaults to 10 seconds.
286
+ // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
287
+ // +optional
288
+ NodeDeletionTimeout * metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
289
+
290
+ // Minimum number of seconds for which a newly created machine pool should
291
+ // be ready.
292
+ // Defaults to 0 (machine will be considered available as soon as it
293
+ // is ready)
294
+ // NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
295
+ MinReadySeconds * int32 `json:"minReadySeconds,omitempty"`
296
+ }
297
+
298
+ // MachinePoolClassTemplate defines how a MachinePool generated from a MachinePoolClass
299
+ // should look like.
300
+ type MachinePoolClassTemplate struct {
301
+ // Metadata is the metadata applied to the MachinePool.
302
+ // At runtime this metadata is merged with the corresponding metadata from the topology.
303
+ // +optional
304
+ Metadata ObjectMeta `json:"metadata,omitempty"`
305
+
306
+ // Bootstrap contains the bootstrap template reference to be used
307
+ // for the creation of the Machines in the MachinePool.
308
+ Bootstrap LocalObjectTemplate `json:"bootstrap"`
309
+
310
+ // Infrastructure contains the infrastructure template reference to be used
311
+ // for the creation of the MachinePool.
312
+ Infrastructure LocalObjectTemplate `json:"infrastructure"`
313
+ }
314
+
247
315
// IsZero returns true if none of the values of MachineHealthCheckClass are defined.
248
316
func (m MachineHealthCheckClass ) IsZero () bool {
249
317
return reflect .ValueOf (m ).IsZero ()
@@ -472,6 +540,11 @@ type PatchSelectorMatch struct {
472
540
// .spec.workers.machineDeployments.
473
541
// +optional
474
542
MachineDeploymentClass * PatchSelectorMatchMachineDeploymentClass `json:"machineDeploymentClass,omitempty"`
543
+
544
+ // MachinePoolClass selects templates referenced in specific MachinePoolClasses in
545
+ // .spec.workers.machinePools.
546
+ // +optional
547
+ MachinePoolClass * PatchSelectorMatchMachinePoolClass `json:"machinePoolClass,omitempty"`
475
548
}
476
549
477
550
// PatchSelectorMatchMachineDeploymentClass selects templates referenced
@@ -482,6 +555,14 @@ type PatchSelectorMatchMachineDeploymentClass struct {
482
555
Names []string `json:"names,omitempty"`
483
556
}
484
557
558
+ // PatchSelectorMatchMachinePoolClass selects templates referenced
559
+ // in specific MachinePoolClasses in .spec.workers.machinePools.
560
+ type PatchSelectorMatchMachinePoolClass struct {
561
+ // Names selects templates by class names.
562
+ // +optional
563
+ Names []string `json:"names,omitempty"`
564
+ }
565
+
485
566
// JSONPatch defines a JSON patch.
486
567
type JSONPatch struct {
487
568
// Op defines the operation of the patch.
0 commit comments