Skip to content

Commit 2edc795

Browse files
authored
🌱 Update examples & code snippets in Cluster API book to v1beta2 for ClusterClass (#12491)
* update doc for ClusterClass Signed-off-by: sivchari <[email protected]> * update spec Signed-off-by: sivchari <[email protected]> * fix link Signed-off-by: sivchari <[email protected]> * address review comment Signed-off-by: sivchari <[email protected]> --------- Signed-off-by: sivchari <[email protected]>
1 parent ccfdd68 commit 2edc795

File tree

4 files changed

+68
-69
lines changed

4 files changed

+68
-69
lines changed

‎docs/book/src/security/pod-security-standards.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ By adding the following variables and patches Pod Security Standards can be adde
1212
### Adding the variables to a ClusterClass
1313

1414
```yaml
15-
apiVersion: cluster.x-k8s.io/v1beta1
15+
apiVersion: cluster.x-k8s.io/v1beta2
1616
kind: ClusterClass
1717
spec:
1818
variables:
@@ -62,7 +62,7 @@ Use this patch if the following keys **already exist** inside the `KubeadmContro
6262
- `.spec.template.spec.kubeadmConfigSpec.files`
6363

6464
```yaml
65-
apiVersion: cluster.x-k8s.io/v1beta1
65+
apiVersion: cluster.x-k8s.io/v1beta2
6666
kind: ClusterClass
6767
spec:
6868
...
@@ -128,7 +128,7 @@ Use this patches if the following keys **do not** exist inside the `KubeadmContr
128128
> **Attention:** Existing values inside the `KubeadmControlPlaneTemplate` at the mentioned keys will be replaced by this patch.
129129
130130
```yaml
131-
apiVersion: cluster.x-k8s.io/v1beta1
131+
apiVersion: cluster.x-k8s.io/v1beta2
132132
kind: ClusterClass
133133
spec:
134134
...

‎docs/book/src/tasks/experimental-features/cluster-class/operate-cluster.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ This means in the following example the Cluster topology controller will always
285285
patches for the infrastructure ref, even if the `DockerClusterTemplate` already has a `v1beta2` apiVersion.
286286

287287
```yaml
288-
apiVersion: cluster.x-k8s.io/v1beta1
288+
apiVersion: cluster.x-k8s.io/v1beta2
289289
kind: ClusterClass
290290
metadata:
291291
name: quick-start
292292
namespace: default
293293
spec:
294294
infrastructure:
295-
ref:
296-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
295+
templateRef:
296+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
297297
kind: DockerClusterTemplate
298298
...
299299
```
@@ -308,14 +308,14 @@ apiVersion of the referenced CRD. The following example shows how to upgrade the
308308

309309
ClusterClass with the old apiVersion:
310310
```yaml
311-
apiVersion: cluster.x-k8s.io/v1beta1
311+
apiVersion: cluster.x-k8s.io/v1beta2
312312
kind: ClusterClass
313313
metadata:
314314
name: quick-start
315315
spec:
316316
infrastructure:
317-
ref:
318-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
317+
templateRef:
318+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
319319
kind: DockerClusterTemplate
320320
...
321321
patches:
@@ -335,13 +335,13 @@ spec:
335335
336336
ClusterClass with the new apiVersion:
337337
```yaml
338-
apiVersion: cluster.x-k8s.io/v1beta1
338+
apiVersion: cluster.x-k8s.io/v1beta2
339339
kind: ClusterClass
340340
metadata:
341341
name: quick-start
342342
spec:
343343
infrastructure:
344-
ref:
344+
templateRef:
345345
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 # apiVersion updated
346346
kind: DockerClusterTemplate
347347
...

‎docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,33 @@ metadata:
3636
name: docker-clusterclass-v0.1.0
3737
spec:
3838
controlPlane:
39-
ref:
39+
templateRef:
4040
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
4141
kind: KubeadmControlPlaneTemplate
4242
name: docker-clusterclass-v0.1.0
43-
namespace: default
4443
machineInfrastructure:
45-
ref:
44+
templateRef:
45+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
4646
kind: DockerMachineTemplate
47-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
4847
name: docker-clusterclass-v0.1.0
49-
namespace: default
5048
infrastructure:
51-
ref:
52-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
49+
templateRef:
50+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
5351
kind: DockerClusterTemplate
5452
name: docker-clusterclass-v0.1.0-control-plane
55-
namespace: default
5653
workers:
5754
machineDeployments:
5855
- class: default-worker
59-
template:
60-
bootstrap:
61-
ref:
62-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
63-
kind: KubeadmConfigTemplate
64-
name: docker-clusterclass-v0.1.0-default-worker
65-
namespace: default
66-
infrastructure:
67-
ref:
68-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
69-
kind: DockerMachineTemplate
70-
name: docker-clusterclass-v0.1.0-default-worker
71-
namespace: default
56+
bootstrap:
57+
templateRef:
58+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
59+
kind: KubeadmConfigTemplate
60+
name: docker-clusterclass-v0.1.0-default-worker
61+
infrastructure:
62+
templateRef:
63+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
64+
kind: DockerMachineTemplate
65+
name: docker-clusterclass-v0.1.0-default-worker
7266
```
7367
7468
The following example shows a Cluster using this ClusterClass. In this case a `KubeadmControlPlane`
@@ -142,17 +136,16 @@ spec:
142136
workers:
143137
machinePools:
144138
- class: default-worker
145-
template:
146-
bootstrap:
147-
ref:
148-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
149-
kind: KubeadmConfigTemplate
150-
name: quick-start-default-worker-bootstraptemplate
151-
infrastructure:
152-
ref:
153-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
154-
kind: DockerMachinePoolTemplate
155-
name: quick-start-default-worker-machinepooltemplate
139+
bootstrap:
140+
templateRef:
141+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
142+
kind: KubeadmConfigTemplate
143+
name: quick-start-default-worker-bootstraptemplate
144+
infrastructure:
145+
templateRef:
146+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
147+
kind: DockerMachinePoolTemplate
148+
name: quick-start-default-worker-machinepooltemplate
156149
```
157150

158151
They can then be similarly defined as workers in the cluster template like so:
@@ -191,30 +184,36 @@ metadata:
191184
spec:
192185
controlPlane:
193186
...
194-
machineHealthCheck:
195-
maxUnhealthy: 33%
196-
nodeStartupTimeout: 15m
197-
unhealthyNodeConditions:
198-
- type: Ready
199-
status: Unknown
200-
timeout: 300s
201-
- type: Ready
202-
status: "False"
203-
timeout: 300s
204-
workers:
205-
machineDeployments:
206-
- class: default-worker
207-
...
208-
machineHealthCheck:
209-
unhealthyRange: "[0-2]"
210-
nodeStartupTimeout: 10m
187+
healthCheck:
188+
checks:
189+
nodeStartupTimeoutSeconds: 900
211190
unhealthyNodeConditions:
212191
- type: Ready
213192
status: Unknown
214-
timeout: 300s
193+
timeoutSeconds: 300
215194
- type: Ready
216195
status: "False"
217-
timeout: 300s
196+
timeoutSeconds: 300
197+
remediation:
198+
triggerIf:
199+
unhealthyLessThanOrEqualTo: 33%
200+
workers:
201+
machineDeployments:
202+
- class: default-worker
203+
...
204+
healthCheck:
205+
checks:
206+
nodeStartupTimeoutSeconds: 600
207+
unhealthyNodeConditions:
208+
- type: Ready
209+
status: Unknown
210+
timeoutSeconds: 300
211+
- type: Ready
212+
status: "False"
213+
timeoutSeconds: 300
214+
remediation:
215+
triggerIf:
216+
unhealthyInRange: "[0-2]"
218217
```
219218

220219
## ClusterClass with patches
@@ -479,7 +478,7 @@ spec:
479478
matchConstraints:
480479
resourceRules:
481480
- apiGroups: ["cluster.x-k8s.io"]
482-
apiVersions: ["v1beta1"]
481+
apiVersions: ["v1beta2"]
483482
operations: ["CREATE", "UPDATE"]
484483
resources: ["clusters"]
485484
validations:
@@ -537,7 +536,7 @@ spec:
537536
- name: workerMachineType
538537
definitions:
539538
- selector:
540-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
539+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
541540
kind: AWSMachineTemplate
542541
matchResources:
543542
machineDeploymentClass:
@@ -549,7 +548,7 @@ spec:
549548
valueFrom:
550549
variable: workerMachineType
551550
---
552-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
551+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
553552
kind: AWSMachineTemplate
554553
metadata:
555554
name: aws-clusterclass-v0.1.0-default-worker
@@ -662,7 +661,7 @@ spec:
662661
description: "Sets the container image that is used for running dockerMachines."
663662
definitions:
664663
- selector:
665-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
664+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
666665
kind: DockerMachineTemplate
667666
matchResources:
668667
machineDeploymentClass:

‎docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ External variable definitions are discovered by calling the DiscoverVariables ru
4747
Once discovered the variable definitions are validated and stored in ClusterClass status.
4848

4949
```yaml
50-
apiVersion: cluster.x-k8s.io/v1beta1
50+
apiVersion: cluster.x-k8s.io/v1beta2
5151
kind: ClusterClass
5252
# metadata
5353
spec:
@@ -74,8 +74,8 @@ spec:
7474
patches:
7575
- name: lbImageRepository
7676
external:
77-
generateExtension: generate-patches.k8s-upgrade-with-runtimesdk
78-
validateExtension: validate-topology.k8s-upgrade-with-runtimesdk
77+
generatePatchesExtension: generate-patches.k8s-upgrade-with-runtimesdk
78+
validateTopologyExtension: validate-topology.k8s-upgrade-with-runtimesdk
7979
## Call variable discovery for this patch.
8080
discoverVariablesExtension: discover-variables.k8s-upgrade-with-runtimesdk
8181
status:

0 commit comments

Comments
 (0)