Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/e2e/config/gcp-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ providers:
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-upgrades.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-md-remediation.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-kcp-remediation.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-topology.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/withclusterclass/cluster-template-ci-topology.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/clusterclass-quick-start.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-with-creds.yaml"
- sourcePath: "${PWD}/test/e2e/data/infrastructure-gcp/cluster-template-ci-gke.yaml"
Expand Down
47 changes: 0 additions & 47 deletions test/e2e/data/infrastructure-gcp/cluster-template-topology.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: quick-start
spec:
controlPlane:
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
name: quick-start-control-plane
machineInfrastructure:
ref:
kind: GCPMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: quick-start-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPClusterTemplate
name: quick-start
workers:
machineDeployments:
- class: default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: quick-start-worker-bootstraptemplate
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPMachineTemplate
name: quick-start-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: quick-start
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: quick-start-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
extraArgs:
cloud-provider: gce
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: quick-start-control-plane
spec:
template:
spec:
instanceType: REPLACEME
image: "${IMAGE_ID}"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPMachineTemplate
metadata:
name: quick-start-worker-machinetemplate
spec:
template:
spec:
instanceType: REPLACEME
image: "${IMAGE_ID}"
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: quick-start-worker-bootstraptemplate
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
name: '{{ ds.meta_data.local_hostname.split(".")[0] }}'
kubeletExtraArgs:
cloud-provider: gce
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: "${CLUSTER_NAME}"
labels:
cni: "${CLUSTER_NAME}-crs-cni"
spec:
clusterNetwork:
pods:
cidrBlocks: ["192.168.0.0/16"]
topology:
class: quick-start
version: "${KUBERNETES_VERSION}"
controlPlane:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: "default-worker"
name: "md-0"
replicas: ${WORKER_MACHINE_COUNT}
variables:
- name: region
value: ${GCP_REGION}
- name: controlPlaneMachineType
value: ${GCP_CONTROL_PLANE_MACHINE_TYPE}
- name: workerMachineType
value: ${GCP_NODE_MACHINE_TYPE}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: "${CLUSTER_NAME}-crs-cni"
data: ${CNI_RESOURCES}
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: "${CLUSTER_NAME}-crs-cni"
spec:
strategy: ApplyOnce
clusterSelector:
matchLabels:
cni: "${CLUSTER_NAME}-crs-cni"
resources:
- name: "${CLUSTER_NAME}-crs-cni"
kind: ConfigMap
24 changes: 24 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,28 @@ var _ = Describe("Workload cluster creation", func() {
}, result)
})
})

Context("Creating a cluster using a cluster class", func() {
It("Should create a cluster class and then a cluster based on it", func() {
By("Creating a cluster from a topology")
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
ClusterProxy: bootstrapClusterProxy,
ConfigCluster: clusterctl.ConfigClusterInput{
LogFolder: clusterctlLogFolder,
ClusterctlConfigPath: clusterctlConfigPath,
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
Flavor: "ci-topology",
Namespace: namespace.Name,
ClusterName: clusterName,
KubernetesVersion: e2eConfig.GetVariable(KubernetesVersion),
ControlPlaneMachineCount: ptr.To[int64](1),
WorkerMachineCount: ptr.To[int64](1),
},
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
}, result)
})
})
})