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
@@ -18,7 +22,6 @@ flexible enough to be used in as many Clusters as possible by supporting variant
18
22
*[Optional patches](#optional-patches)
19
23
*[Version-aware patches](#version-aware-patches)
20
24
*[JSON patches tips & tricks](#json-patches-tips--tricks)
21
-
22
25
23
26
## Basic ClusterClass
24
27
@@ -289,6 +292,103 @@ a default value, the value is automatically added to the variables list.
289
292
290
293
</aside>
291
294
295
+
## ClusterClass with custom naming strategies
296
+
297
+
The controller needs to generate names for new objects when a Cluster is getting created
298
+
from a ClusterClass. These names have to be unique for each namespace. The naming
299
+
strategy enables this by concatenating the cluster name with a random suffix.
300
+
301
+
It is possible to provide a custom template for the name generation of ControlPlane, MachineDeployment
302
+
and MachinePool objects.
303
+
304
+
The generated names must comply with the [RFC 1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names) standard.
305
+
306
+
### Defining a custom naming strategy for ControlPlane objects
307
+
308
+
The naming strategy for ControlPlane supports the following properties:
309
+
310
+
- `template`: Custom template which is used when generating the name of the ControlPlane object.
311
+
312
+
The following variables can be referenced in templates:
313
+
314
+
- `.cluster.name`: The name of the cluster object.
315
+
- `.random`: A random alphanumeric string, without vowels, of length 5.
316
+
317
+
Example which would match the default behavior:
318
+
319
+
```yaml
320
+
apiVersion: cluster.x-k8s.io/v1beta1
321
+
kind: ClusterClass
322
+
metadata:
323
+
name: docker-clusterclass-v0.1.0
324
+
spec:
325
+
controlPlane:
326
+
...
327
+
namingStrategy:
328
+
template: "{{ .cluster.name }}-{{ .random }}"
329
+
...
330
+
```
331
+
332
+
### Defining a custom naming strategy for MachineDeployment objects
333
+
334
+
The naming strategy for MachineDeployments supports the following properties:
335
+
336
+
- `template`: Custom template which is used when generating the name of the MachineDeployment object.
337
+
338
+
The following variables can be referenced in templates:
339
+
340
+
- `.cluster.name`: The name of the cluster object.
341
+
- `.random`: A random alphanumeric string, without vowels, of length 5.
342
+
- `.machineDeployment.topologyName`: The name of the MachineDeployment topology (`Cluster.spec.topology.workers.machineDeployments[].name`)
0 commit comments