--- apiVersion: cluster.x-k8s.io/v1beta1 kind: ClusterClass metadata: name: ${CLUSTER_CLASS_NAME} spec: controlPlane: ref: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlaneTemplate name: ${CLUSTER_CLASS_NAME}-control-plane machineInfrastructure: ref: kind: GCPMachineTemplate apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 name: ${CLUSTER_CLASS_NAME}-control-plane infrastructure: ref: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPClusterTemplate name: ${CLUSTER_CLASS_NAME} workers: machineDeployments: - class: default-worker template: bootstrap: ref: apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_CLASS_NAME}-worker-bootstraptemplate infrastructure: ref: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPMachineTemplate name: ${CLUSTER_CLASS_NAME}-worker-machinetemplate variables: - name: region required: true schema: openAPIV3Schema: type: string default: us-west1 - name: controlPlaneMachineType required: true schema: openAPIV3Schema: type: string default: n1-standard-2 - name: workerMachineType required: true schema: openAPIV3Schema: type: string default: n1-standard-2 patches: - name: region definitions: - selector: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPClusterTemplate matchResources: infrastructureCluster: true jsonPatches: - op: add path: /spec/template/spec/region valueFrom: variable: region - name: controlPlaneMachineType definitions: - selector: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPMachineTemplate matchResources: controlPlane: true jsonPatches: - op: replace path: /spec/template/spec/instanceType valueFrom: variable: controlPlaneMachineType - name: workerMachineType definitions: - selector: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPMachineTemplate matchResources: machineDeploymentClass: names: - default-worker jsonPatches: - op: replace path: /spec/template/spec/instanceType valueFrom: variable: workerMachineType --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPClusterTemplate metadata: name: ${CLUSTER_CLASS_NAME} spec: template: spec: project: "${GCP_PROJECT}" region: "${GCP_REGION}" network: name: "${GCP_NETWORK_NAME}" --- apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlaneTemplate metadata: name: ${CLUSTER_CLASS_NAME}-control-plane spec: template: spec: kubeadmConfigSpec: useExperimentalRetryJoin: true initConfiguration: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: cloud-provider: gce clusterConfiguration: apiServer: timeoutForControlPlane: 20m controllerManager: extraArgs: cloud-provider: gce allocate-node-cidrs: "false" joinConfiguration: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: cloud-provider: gce --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPMachineTemplate metadata: name: ${CLUSTER_CLASS_NAME}-control-plane spec: template: spec: instanceType: REPLACEME image: "${IMAGE_ID}" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: GCPMachineTemplate metadata: name: ${CLUSTER_CLASS_NAME}-worker-machinetemplate spec: template: spec: instanceType: REPLACEME image: "${IMAGE_ID}" --- apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: ${CLUSTER_CLASS_NAME}-worker-bootstraptemplate spec: template: spec: joinConfiguration: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: cloud-provider: gce