From eb454cb8ae1e29c730f62b65824d2a20b0fcbe39 Mon Sep 17 00:00:00 2001 From: sivchari Date: Tue, 15 Jul 2025 18:06:44 +0900 Subject: [PATCH 1/3] update doc for ClusterClass Signed-off-by: sivchari --- .../src/security/pod-security-standards.md | 6 ++--- .../cluster-class/operate-cluster.md | 16 +++++------ .../cluster-class/write-clusterclass.md | 27 ++++++++----------- .../implement-topology-mutation-hook.md | 2 +- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/docs/book/src/security/pod-security-standards.md b/docs/book/src/security/pod-security-standards.md index c8ab7801a560..4a9fb8512ad2 100644 --- a/docs/book/src/security/pod-security-standards.md +++ b/docs/book/src/security/pod-security-standards.md @@ -12,7 +12,7 @@ By adding the following variables and patches Pod Security Standards can be adde ### Adding the variables to a ClusterClass ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass spec: variables: @@ -62,7 +62,7 @@ Use this patch if the following keys **already exist** inside the `KubeadmContro - `.spec.template.spec.kubeadmConfigSpec.files` ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass spec: ... @@ -128,7 +128,7 @@ Use this patches if the following keys **do not** exist inside the `KubeadmContr > **Attention:** Existing values inside the `KubeadmControlPlaneTemplate` at the mentioned keys will be replaced by this patch. ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass spec: ... diff --git a/docs/book/src/tasks/experimental-features/cluster-class/operate-cluster.md b/docs/book/src/tasks/experimental-features/cluster-class/operate-cluster.md index dd2e4a383f82..b90e4227855d 100644 --- a/docs/book/src/tasks/experimental-features/cluster-class/operate-cluster.md +++ b/docs/book/src/tasks/experimental-features/cluster-class/operate-cluster.md @@ -284,15 +284,15 @@ This means in the following example the Cluster topology controller will always patches for the infrastructure ref, even if the `DockerClusterTemplate` already has a `v1beta2` apiVersion. ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass metadata: name: quick-start namespace: default spec: infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerClusterTemplate ... ``` @@ -307,14 +307,14 @@ apiVersion of the referenced CRD. The following example shows how to upgrade the ClusterClass with the old apiVersion: ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass metadata: name: quick-start spec: infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerClusterTemplate ... patches: @@ -334,13 +334,13 @@ spec: ClusterClass with the new apiVersion: ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass metadata: name: quick-start spec: infrastructure: - ref: + templateRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 # apiVersion updated kind: DockerClusterTemplate ... diff --git a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md index 2eeb416ed1fc..efefe5fb9ad5 100644 --- a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md +++ b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md @@ -36,39 +36,34 @@ metadata: name: docker-clusterclass-v0.1.0 spec: controlPlane: - ref: + templateRef: apiVersion: controlplane.cluster.x-k8s.io/v1beta2 kind: KubeadmControlPlaneTemplate name: docker-clusterclass-v0.1.0 - namespace: default machineInfrastructure: - ref: + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 name: docker-clusterclass-v0.1.0 - namespace: default infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerClusterTemplate name: docker-clusterclass-v0.1.0-control-plane - namespace: default workers: machineDeployments: - class: default-worker template: bootstrap: - ref: + templateRef: apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate name: docker-clusterclass-v0.1.0-default-worker - namespace: default infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachineTemplate name: docker-clusterclass-v0.1.0-default-worker - namespace: default ``` The following example shows a Cluster using this ClusterClass. In this case a `KubeadmControlPlane` @@ -144,13 +139,13 @@ spec: - class: default-worker template: bootstrap: - ref: + templateRef: apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate name: quick-start-default-worker-bootstraptemplate infrastructure: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachinePoolTemplate name: quick-start-default-worker-machinepooltemplate ``` diff --git a/docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md b/docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md index b556632ccd88..e9a0de81da07 100644 --- a/docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md +++ b/docs/book/src/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook.md @@ -47,7 +47,7 @@ External variable definitions are discovered by calling the DiscoverVariables ru Once discovered the variable definitions are validated and stored in ClusterClass status. ```yaml -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: ClusterClass # metadata spec: From 9c9d0751297656304378e1d5957fc20075ae9851 Mon Sep 17 00:00:00 2001 From: sivchari Date: Thu, 31 Jul 2025 17:49:18 +0900 Subject: [PATCH 2/3] update spec Signed-off-by: sivchari --- .../cluster-class/write-clusterclass.md | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md index efefe5fb9ad5..7f3740df941c 100644 --- a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md +++ b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md @@ -53,17 +53,16 @@ spec: workers: machineDeployments: - class: default-worker - template: - bootstrap: - templateRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 - kind: KubeadmConfigTemplate - name: docker-clusterclass-v0.1.0-default-worker - infrastructure: - templateRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: DockerMachineTemplate - name: docker-clusterclass-v0.1.0-default-worker + bootstrap: + templateRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 + kind: KubeadmConfigTemplate + name: docker-clusterclass-v0.1.0-default-worker + infrastructure: + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: DockerMachineTemplate + name: docker-clusterclass-v0.1.0-default-worker ``` The following example shows a Cluster using this ClusterClass. In this case a `KubeadmControlPlane` @@ -137,17 +136,16 @@ spec: workers: machinePools: - class: default-worker - template: - bootstrap: - templateRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 - kind: KubeadmConfigTemplate - name: quick-start-default-worker-bootstraptemplate - infrastructure: - templateRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: DockerMachinePoolTemplate - name: quick-start-default-worker-machinepooltemplate + bootstrap: + templateRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 + kind: KubeadmConfigTemplate + name: quick-start-default-worker-bootstraptemplate + infrastructure: + templateRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: DockerMachinePoolTemplate + name: quick-start-default-worker-machinepooltemplate ``` They can then be similarly defined as workers in the cluster template like so: @@ -186,30 +184,32 @@ metadata: spec: controlPlane: ... - machineHealthCheck: - maxUnhealthy: 33% - nodeStartupTimeout: 15m - unhealthyNodeConditions: - - type: Ready - status: Unknown - timeout: 300s - - type: Ready - status: "False" - timeout: 300s - workers: - machineDeployments: - - class: default-worker - ... - machineHealthCheck: - unhealthyRange: "[0-2]" - nodeStartupTimeout: 10m + healthCheck: + checks: + maxUnhealthy: 33% + nodeStartupTimeoutSeconds: 900 unhealthyNodeConditions: - type: Ready status: Unknown - timeout: 300s + timeoutSeconds: 300 - type: Ready status: "False" - timeout: 300s + timeoutSeconds: 300 + workers: + machineDeployments: + - class: default-worker + ... + healthCheck: + checks: + unhealthyRange: "[0-2]" + nodeStartupTimeoutSeconds: 600 + unhealthyNodeConditions: + - type: Ready + status: Unknown + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 ``` ## ClusterClass with patches @@ -228,7 +228,7 @@ in `KubeadmControlPlane`. Use cases like this can be implemented with ClusterCla The following example shows how variables can be defined in the ClusterClass. A variable definition specifies the name and the schema of a variable and if it is required. The schema defines how a variable is defaulted and validated. It supports -a subset of the schema of CRDs. For more information please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta1#spec-variables-schema-openAPIV3Schema). +a subset of the schema of CRDs. For more information please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta2#spec-variables-schema-openAPIV3Schema). ```yaml apiVersion: cluster.x-k8s.io/v1beta2 @@ -263,7 +263,7 @@ The variable can then be used in a patch to set a field on a template referenced The `selector` specifies on which template the patch should be applied. `jsonPatches` specifies which JSON patches should be applied to that template. In this case we set the `imageRepository` field of the `KubeadmControlPlaneTemplate` to the value of the variable `imageRepository`. For more information -please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta1#spec-patches-definitions). +please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta2#spec-patches-definitions). ```yaml apiVersion: cluster.x-k8s.io/v1beta2 @@ -474,7 +474,7 @@ spec: matchConstraints: resourceRules: - apiGroups: ["cluster.x-k8s.io"] - apiVersions: ["v1beta1"] + apiVersions: ["v1beta2"] operations: ["CREATE", "UPDATE"] resources: ["clusters"] validations: @@ -532,7 +532,7 @@ spec: - name: workerMachineType definitions: - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSMachineTemplate matchResources: machineDeploymentClass: @@ -544,7 +544,7 @@ spec: valueFrom: variable: workerMachineType --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSMachineTemplate metadata: name: aws-clusterclass-v0.1.0-default-worker @@ -657,7 +657,7 @@ spec: description: "Sets the container image that is used for running dockerMachines." definitions: - selector: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachineTemplate matchResources: machineDeploymentClass: From 9931b308da8a41e651fbebe454453bcc587d9070 Mon Sep 17 00:00:00 2001 From: sivchari Date: Fri, 1 Aug 2025 14:03:52 +0900 Subject: [PATCH 3/3] fix link Signed-off-by: sivchari --- .../experimental-features/cluster-class/write-clusterclass.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md index 7f3740df941c..1744a3631714 100644 --- a/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md +++ b/docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md @@ -228,7 +228,7 @@ in `KubeadmControlPlane`. Use cases like this can be implemented with ClusterCla The following example shows how variables can be defined in the ClusterClass. A variable definition specifies the name and the schema of a variable and if it is required. The schema defines how a variable is defaulted and validated. It supports -a subset of the schema of CRDs. For more information please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta2#spec-variables-schema-openAPIV3Schema). +a subset of the schema of CRDs. For more information please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta1#spec-variables-schema-openAPIV3Schema). ```yaml apiVersion: cluster.x-k8s.io/v1beta2 @@ -263,7 +263,7 @@ The variable can then be used in a patch to set a field on a template referenced The `selector` specifies on which template the patch should be applied. `jsonPatches` specifies which JSON patches should be applied to that template. In this case we set the `imageRepository` field of the `KubeadmControlPlaneTemplate` to the value of the variable `imageRepository`. For more information -please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta2#spec-patches-definitions). +please see the [godoc](https://doc.crds.dev/github.com/kubernetes-sigs/cluster-api/cluster.x-k8s.io/ClusterClass/v1beta1#spec-patches-definitions). ```yaml apiVersion: cluster.x-k8s.io/v1beta2