Skip to content

Commit

Permalink
E2E: test quickstart flow using managed topology cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ykakarap committed Oct 21, 2021
1 parent 61f13e1 commit 3d2fd1b
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/Makefile
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/config/docker.yaml
Expand Up @@ -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:
Expand All @@ -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}"
Expand Down
@@ -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}
@@ -0,0 +1,3 @@
resources:
- ../bases/crs.yaml
- ../bases/cluster-with-topology.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%'

17 changes: 17 additions & 0 deletions test/e2e/quick_start_test.go
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

/*
Expand All @@ -20,6 +21,7 @@ package e2e

import (
. "github.com/onsi/ginkgo"
"k8s.io/utils/pointer"
)

var _ = Describe("When following the Cluster API quick-start [PR-Blocking]", func() {
Expand All @@ -35,3 +37,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("topology"),
}
})

})

0 comments on commit 3d2fd1b

Please sign in to comment.