diff --git a/test/e2e/Makefile b/test/e2e/Makefile index 79becf5ad069..db70a5d1c694 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -83,6 +83,7 @@ cluster-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1beta $(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-upgrades --load_restrictor none > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml $(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in --load_restrictor none > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml $(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-ipv6 --load_restrictor none > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-ipv6.yaml + $(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-topology --load_restrictor none > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-topology.yaml ## -------------------------------------- ## Testing diff --git a/test/e2e/config/docker.yaml b/test/e2e/config/docker.yaml index 9efa9d158b87..d2da38c8618d 100644 --- a/test/e2e/config/docker.yaml +++ b/test/e2e/config/docker.yaml @@ -152,6 +152,8 @@ providers: - sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-upgrades.yaml" - sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-kcp-scale-in.yaml" - sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-ipv6.yaml" + - sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-topology.yaml" + - sourcePath: "../data/infrastructure-docker/v1beta1/clusterclass-quick-start.yaml" - sourcePath: "../data/shared/v1beta1/metadata.yaml" variables: @@ -174,6 +176,7 @@ variables: EXP_MACHINE_POOL: "true" KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml" NODE_DRAIN_TIMEOUT: "60s" + CLUSTER_TOPOLOGY: "true" # NOTE: INIT_WITH_BINARY and INIT_WITH_KUBERNETES_VERSION are only used by the clusterctl upgrade test to initialize # the management cluster to be upgraded. INIT_WITH_BINARY: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.4/clusterctl-{OS}-{ARCH}" diff --git a/test/e2e/data/infrastructure-docker/v1beta1/bases/cluster-with-topology.yaml b/test/e2e/data/infrastructure-docker/v1beta1/bases/cluster-with-topology.yaml new file mode 100644 index 000000000000..cf98d7f09dd6 --- /dev/null +++ b/test/e2e/data/infrastructure-docker/v1beta1/bases/cluster-with-topology.yaml @@ -0,0 +1,25 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + name: '${CLUSTER_NAME}' + namespace: default + labels: + cni: "${CLUSTER_NAME}-crs-0" +spec: + clusterNetwork: + services: + cidrBlocks: ["10.128.0.0/12"] + pods: + cidrBlocks: ["192.168.0.0/16"] + serviceDomain: "cluster.local" + topology: + class: "quick-start" + version: "${KUBERNETES_VERSION}" + controlPlane: + metadata: {} + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + workers: + machineDeployments: + - class: "default-worker" + name: "md-0" + replicas: ${WORKER_MACHINE_COUNT} diff --git a/test/e2e/data/infrastructure-docker/v1beta1/cluster-template-topology/kustomization.yaml b/test/e2e/data/infrastructure-docker/v1beta1/cluster-template-topology/kustomization.yaml new file mode 100644 index 000000000000..273bed112640 --- /dev/null +++ b/test/e2e/data/infrastructure-docker/v1beta1/cluster-template-topology/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - ../bases/crs.yaml + - ../bases/cluster-with-topology.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-docker/v1beta1/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/v1beta1/clusterclass-quick-start.yaml new file mode 100644 index 000000000000..005c1fcee850 --- /dev/null +++ b/test/e2e/data/infrastructure-docker/v1beta1/clusterclass-quick-start.yaml @@ -0,0 +1,122 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: ClusterClass +metadata: + name: quick-start + namespace: default +spec: + controlPlane: + ref: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + name: quick-start-control-plane + machineInfrastructure: + ref: + kind: DockerMachineTemplate + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + name: quick-start-control-plane + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerClusterTemplate + name: quick-start-my-cluster + workers: + machineDeployments: + - class: "default-worker" + template: + bootstrap: + ref: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + name: quick-start-docker-worker-bootstraptemplate + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachineTemplate + name: quick-start-docker-worker-machinetemplate +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: DockerClusterTemplate +metadata: + name: quick-start-my-cluster + namespace: default +--- +kind: KubeadmControlPlaneTemplate +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +metadata: + name: quick-start-control-plane + namespace: default +spec: + template: + spec: + replicas: 1 + machineTemplate: + nodeDrainTimeout: 1s + infrastructureRef: + kind: DockerMachineTemplate + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + name: "control-plane" + kubeadmConfigSpec: + clusterConfiguration: + controllerManager: + extraArgs: { enable-hostpath-provisioner: 'true' } + apiServer: + certSANs: [ localhost, 127.0.0.1 ] + initConfiguration: + nodeRegistration: + criSocket: /var/run/containerd/containerd.sock + kubeletExtraArgs: + # We have to pin the cgroupDriver to cgroupfs as kubeadm >=1.21 defaults to systemd + # kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726 + cgroup-driver: cgroupfs + eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' + joinConfiguration: + nodeRegistration: + criSocket: /var/run/containerd/containerd.sock + kubeletExtraArgs: + # We have to pin the cgroupDriver to cgroupfs as kubeadm >=1.21 defaults to systemd + # kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726 + cgroup-driver: cgroupfs + eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' + version: v1.21.2 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: DockerMachineTemplate +metadata: + name: quick-start-control-plane + namespace: default +spec: + template: + spec: + preLoadImages: + - kindest/kindnetd:0.5.4 + extraMounts: + - containerPath: "/var/run/docker.sock" + hostPath: "/var/run/docker.sock" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: DockerMachineTemplate +metadata: + name: quick-start-docker-worker-machinetemplate + namespace: default +spec: + template: + spec: + preLoadImages: + - kindest/kindnetd:0.5.4 +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + name: "quick-start-docker-worker-bootstraptemplate" + namespace: default +spec: + template: + spec: + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + # We have to pin the cgroupDriver to cgroupfs as kubeadm >=1.21 defaults to systemd + # kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726 + cgroup-driver: cgroupfs + eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' + diff --git a/test/e2e/quick_start_test.go b/test/e2e/quick_start_test.go index ddb85c82f5d1..cf133de08935 100644 --- a/test/e2e/quick_start_test.go +++ b/test/e2e/quick_start_test.go @@ -20,6 +20,7 @@ package e2e import ( . "github.com/onsi/ginkgo" + "k8s.io/utils/pointer" ) var _ = Describe("When following the Cluster API quick-start [PR-Blocking]", func() { @@ -35,3 +36,18 @@ var _ = Describe("When following the Cluster API quick-start [PR-Blocking]", fun }) }) + +var _ = Describe("When following the Cluster API quick-start with ClusterClass", func() { + + QuickStartSpec(ctx, func() QuickStartSpecInput { + return QuickStartSpecInput{ + E2EConfig: e2eConfig, + ClusterctlConfigPath: clusterctlConfigPath, + BootstrapClusterProxy: bootstrapClusterProxy, + ArtifactFolder: artifactFolder, + SkipCleanup: skipCleanup, + Flavor: pointer.String("with-managed-topology"), + } + }) + +})