Skip to content

Commit 7c62eb2

Browse files
authored
🌱 test: use cluster without worker definition for kcp only test (#11212)
* test: use cluster without worker definition for kcp only test * add additional quick-start test for covering zero replicas * Rewrite quick-start test * comment fix * fix kcp-only clusterclass
1 parent d495b4e commit 7c62eb2

File tree

14 files changed

+83
-5
lines changed

14 files changed

+83
-5
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ hack/tools/bin
1212

1313
# E2E test templates
1414
test/e2e/data/infrastructure-docker/**/cluster-template*.yaml
15+
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start.yaml
16+
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk.yaml
17+
test/e2e/data/infrastructure-docker/**/clusterclass-*.yaml
1518
test/e2e/data/infrastructure-inmemory/**/cluster-template*.yaml
1619

1720
# Output of Makefile targets using sed on MacOS systems

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,12 @@ generate-e2e-templates-main: $(KUSTOMIZE)
611611
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ipv6 --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ipv6.yaml
612612
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-dualstack-ipv6-primary --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-dualstack-ipv6-primary.yaml
613613
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-dualstack-ipv4-primary --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-dualstack-ipv4-primary.yaml
614-
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-single-node-cluster --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-single-node-cluster.yaml
614+
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-no-workers --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-no-workers.yaml
615+
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-kcp-only --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-kcp-only.yaml
615616
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-autoscaler --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-autoscaler.yaml
616617
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology.yaml
617618
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ignition.yaml
619+
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/clusterclass-quick-start-kcp-only --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/clusterclass-quick-start-kcp-only.yaml
618620

619621
$(KUSTOMIZE) build $(INMEMORY_TEMPLATES)/main/cluster-template --load-restrictor LoadRestrictionsNone > $(INMEMORY_TEMPLATES)/main/cluster-template.yaml
620622

test/e2e/config/docker.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,13 @@ providers:
354354
- sourcePath: "../data/infrastructure-docker/main/cluster-template-ipv6.yaml"
355355
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-dualstack-ipv6-primary.yaml"
356356
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-dualstack-ipv4-primary.yaml"
357-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-single-node-cluster.yaml"
357+
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-no-workers.yaml"
358+
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-kcp-only.yaml"
358359
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology-autoscaler.yaml"
359360
- sourcePath: "../data/infrastructure-docker/main/cluster-template-topology.yaml"
360361
- sourcePath: "../data/infrastructure-docker/main/cluster-template-ignition.yaml"
361362
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start.yaml"
363+
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-kcp-only.yaml"
362364
- sourcePath: "../data/infrastructure-docker/main/clusterclass-quick-start-runtimesdk.yaml"
363365
- sourcePath: "../data/shared/main/metadata.yaml"
364366

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- op: add
2+
path: /spec/topology/class
3+
value: "quick-start-kcp-only"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resources:
2+
- ../cluster-template-topology-no-workers
3+
4+
patches:
5+
- path: cluster-topology-class.yaml
6+
target:
7+
group: cluster.x-k8s.io
8+
version: v1beta1
9+
kind: Cluster
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ patches:
88
group: cluster.x-k8s.io
99
version: v1beta1
1010
kind: Cluster
11-
11+
- path: remove-topology-workers.yaml
12+
target:
13+
group: cluster.x-k8s.io
14+
version: v1beta1
15+
kind: Cluster
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- op: remove
2+
path: /spec/topology/workers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- op: replace
2+
path: /metadata/name
3+
value: quick-start-kcp-only
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resources:
2+
- ../clusterclass-quick-start.yaml
3+
4+
patches:
5+
- path: remove-workers.yaml
6+
target:
7+
group: cluster.x-k8s.io
8+
version: v1beta1
9+
kind: ClusterClass
10+
- path: clusterclass-name.yaml
11+
target:
12+
group: cluster.x-k8s.io
13+
version: v1beta1
14+
kind: ClusterClass
15+
- path: remove-worker-patches.yaml
16+
target:
17+
group: cluster.x-k8s.io
18+
version: v1beta1
19+
kind: ClusterClass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- op: remove
2+
path: /spec/patches/14
3+
- op: remove
4+
path: /spec/patches/9
5+
- op: remove
6+
path: /spec/patches/5
7+
- op: remove
8+
path: /spec/patches/4/definitions/0/selector/matchResources/machineDeploymentClass
9+
- op: remove
10+
path: /spec/patches/3/definitions/2
11+
- op: remove
12+
path: /spec/patches/3/definitions/0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- op: remove
2+
path: /spec/workers

test/e2e/quick_start_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,19 @@ var _ = Describe("When following the Cluster API quick-start with dualstack and
206206
}
207207
})
208208
})
209+
210+
var _ = Describe("When following the Cluster API quick-start with ClusterClass without any worker definitions [ClusterClass]", func() {
211+
QuickStartSpec(ctx, func() QuickStartSpecInput {
212+
return QuickStartSpecInput{
213+
E2EConfig: e2eConfig,
214+
ClusterctlConfigPath: clusterctlConfigPath,
215+
BootstrapClusterProxy: bootstrapClusterProxy,
216+
ArtifactFolder: artifactFolder,
217+
SkipCleanup: skipCleanup,
218+
Flavor: ptr.To("topology-kcp-only"),
219+
InfrastructureProvider: ptr.To("docker"),
220+
// Note: the used template is not using the corresponding variable
221+
WorkerMachineCount: ptr.To[int64](0),
222+
}
223+
})
224+
})

test/e2e/self_hosted_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ var _ = Describe("When testing Cluster API working on single-node self-hosted cl
6464
BootstrapClusterProxy: bootstrapClusterProxy,
6565
ArtifactFolder: artifactFolder,
6666
SkipCleanup: skipCleanup,
67-
Flavor: "topology-single-node-cluster",
67+
Flavor: "topology-no-workers",
6868
InfrastructureProvider: ptr.To("docker"),
6969
ControlPlaneMachineCount: ptr.To[int64](1),
70-
WorkerMachineCount: ptr.To[int64](0),
70+
// Note: the used template is not using the corresponding variable.
71+
WorkerMachineCount: ptr.To[int64](0),
7172
}
7273
})
7374
})

0 commit comments

Comments
 (0)