@@ -106,6 +106,10 @@ type ControlPlaneClass struct {
106
106
// +optional
107
107
MachineHealthCheck * MachineHealthCheckClass `json:"machineHealthCheck,omitempty"`
108
108
109
+ // NamingStrategy allows changing the naming pattern used when creating the control plane provider object.
110
+ // +optional
111
+ NamingStrategy * ControlPlaneClassNamingStrategy `json:"namingStrategy,omitempty"`
112
+
109
113
// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
110
114
// The default value is 0, meaning that the node can be drained without any time limitations.
111
115
// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
@@ -127,6 +131,19 @@ type ControlPlaneClass struct {
127
131
NodeDeletionTimeout * metav1.Duration `json:"nodeDeletionTimeout,omitempty"`
128
132
}
129
133
134
+ // ControlPlaneClassNamingStrategy defines the naming strategy for control plane objects.
135
+ type ControlPlaneClassNamingStrategy struct {
136
+ // Template defines the template to use for generating the name of the ControlPlane object.
137
+ // If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`.
138
+ // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
139
+ // get concatenated with a random suffix of length 5.
140
+ // The templating mechanism provides the following arguments:
141
+ // * `.cluster.name`: The name of the cluster object.
142
+ // * `.random`: A random alphanumeric string, without vowels, of length 5.
143
+ // +optional
144
+ Template * string `json:"template,omitempty"`
145
+ }
146
+
130
147
// WorkersClass is a collection of deployment classes.
131
148
type WorkersClass struct {
132
149
// MachineDeployments is a list of machine deployment classes that can be used to create
@@ -162,6 +179,10 @@ type MachineDeploymentClass struct {
162
179
// +optional
163
180
FailureDomain * string `json:"failureDomain,omitempty"`
164
181
182
+ // NamingStrategy allows changing the naming pattern used when creating the MachineDeployment.
183
+ // +optional
184
+ NamingStrategy * MachineDeploymentClassNamingStrategy `json:"namingStrategy,omitempty"`
185
+
165
186
// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
166
187
// The default value is 0, meaning that the node can be drained without any time limitations.
167
188
// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
@@ -212,6 +233,20 @@ type MachineDeploymentClassTemplate struct {
212
233
Infrastructure LocalObjectTemplate `json:"infrastructure"`
213
234
}
214
235
236
+ // MachineDeploymentClassNamingStrategy defines the naming strategy for machine deployment objects.
237
+ type MachineDeploymentClassNamingStrategy struct {
238
+ // Template defines the template to use for generating the name of the MachineDeployment object.
239
+ // If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`.
240
+ // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
241
+ // get concatenated with a random suffix of length 5.
242
+ // The templating mechanism provides the following arguments:
243
+ // * `.cluster.name`: The name of the cluster object.
244
+ // * `.random`: A random alphanumeric string, without vowels, of length 5.
245
+ // * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).
246
+ // +optional
247
+ Template * string `json:"template,omitempty"`
248
+ }
249
+
215
250
// MachineHealthCheckClass defines a MachineHealthCheck for a group of Machines.
216
251
type MachineHealthCheckClass struct {
217
252
// UnhealthyConditions contains a list of the conditions that determine
@@ -267,6 +302,10 @@ type MachinePoolClass struct {
267
302
// +optional
268
303
FailureDomains []string `json:"failureDomains,omitempty"`
269
304
305
+ // NamingStrategy allows changing the naming pattern used when creating the MachinePool.
306
+ // +optional
307
+ NamingStrategy * MachinePoolClassNamingStrategy `json:"namingStrategy,omitempty"`
308
+
270
309
// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
271
310
// The default value is 0, meaning that the node can be drained without any time limitations.
272
311
// NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`
@@ -312,6 +351,20 @@ type MachinePoolClassTemplate struct {
312
351
Infrastructure LocalObjectTemplate `json:"infrastructure"`
313
352
}
314
353
354
+ // MachinePoolClassNamingStrategy defines the naming strategy for machine pool objects.
355
+ type MachinePoolClassNamingStrategy struct {
356
+ // Template defines the template to use for generating the name of the MachinePool object.
357
+ // If not defined, it will fallback to `{{ .cluster.name }}-{{ .machinePool.topologyName }}-{{ .random }}`.
358
+ // If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
359
+ // get concatenated with a random suffix of length 5.
360
+ // The templating mechanism provides the following arguments:
361
+ // * `.cluster.name`: The name of the cluster object.
362
+ // * `.random`: A random alphanumeric string, without vowels, of length 5.
363
+ // * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name).
364
+ // +optional
365
+ Template * string `json:"template,omitempty"`
366
+ }
367
+
315
368
// IsZero returns true if none of the values of MachineHealthCheckClass are defined.
316
369
func (m MachineHealthCheckClass ) IsZero () bool {
317
370
return reflect .ValueOf (m ).IsZero ()
0 commit comments