@@ -21,7 +21,7 @@ general and how they can be written in a way that they are flexible enough to su
21
21
## Basic ClusterClass
22
22
23
23
The following example shows a basic ClusterClass. It contains templates to shape the control plane,
24
- infrastructure and workers of a Cluster. When a Cluster is using this ClusterClass, the templates
24
+ infrastructure and workers of a Cluster. When a Cluster is using this ClusterClass, the templates
25
25
are used to generate the objects of the managed topology of the Cluster.
26
26
27
27
``` yaml
@@ -88,16 +88,20 @@ spec:
88
88
controlPlane:
89
89
replicas: 3
90
90
metadata:
91
- labels: {}
92
- annotations: {}
91
+ labels:
92
+ cpLabel: cpLabelValue
93
+ annotations:
94
+ cpAnnotation: cpAnnotationValue
93
95
workers:
94
96
machineDeployments:
95
97
- class: default-worker
96
98
name: md-0
97
99
replicas: 4
98
100
metadata:
99
- labels: {}
100
- annotations: {}
101
+ labels:
102
+ mdLabel: mdLabelValue
103
+ annotations:
104
+ mdAnnotation: mdAnnotationValue
101
105
failureDomain: region
102
106
` ` `
103
107
@@ -350,6 +354,9 @@ spec:
350
354
valueFrom:
351
355
# This template is first rendered with Go templating, then parsed by
352
356
# a YAML/JSON parser and then used as value of the JSON patch.
357
+ # For example, if the variable etcdImageTag is set to ` 3.5.1-0` the
358
+ # .../clusterConfiguration/etcd field will be set to:
359
+ # {"local": {"imageTag": "3.5.1-0"}}
353
360
template : |
354
361
local:
355
362
imageTag: {{ .etcdImageTag }}
@@ -524,10 +531,22 @@ spec:
524
531
names:
525
532
- default-worker
526
533
jsonPatches:
527
- - op: replace
534
+ - op: add
528
535
path: /spec/template/spec/instanceType
529
536
valueFrom:
530
537
variable: workerMachineType
538
+ ---
539
+ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
540
+ kind: AWSMachineTemplate
541
+ metadata:
542
+ name: aws-clusterclass-v0.1.0-default-worker
543
+ spec:
544
+ template:
545
+ spec:
546
+ # instanceType: workerMachineType will be set by the patch.
547
+ iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io"
548
+ ---
549
+ ...
531
550
` ` `
532
551
533
552
In the Cluster resource the `workerMachineType` variable can then be set cluster-wide and
0 commit comments