Skip to content

Commit caaa744

Browse files
author
Yuvaraj Kakaraparthi
committed
add scale e2e
1 parent 52fd7eb commit caaa744

40 files changed

+1145
-195
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ hack/tools/bin
1212

1313
# E2E test templates
1414
test/e2e/data/infrastructure-docker/**/cluster-template*.yaml
15-
15+
test/e2e/data/infrastructure-inmemory/**/cluster-template*.yaml
1616
# Output of Makefile targets using sed on MacOS systems
1717
*.yaml-e
1818

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ generate-modules: ## Run go mod tidy to ensure modules are up to date
505505
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, v0.4 v1.0 v1.3 v1.4 main) ## Generate cluster templates for all versions
506506

507507
DOCKER_TEMPLATES := test/e2e/data/infrastructure-docker
508+
INMEMORY_TEMPLATES := test/e2e/data/infrastructure-inmemory
508509

509510
.PHONY: generate-e2e-templates-v0.4
510511
generate-e2e-templates-v0.4: $(KUSTOMIZE)
@@ -546,6 +547,8 @@ generate-e2e-templates-main: $(KUSTOMIZE)
546547
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology.yaml
547548
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ignition.yaml
548549

550+
$(KUSTOMIZE) build $(INMEMORY_TEMPLATES)/main/cluster-template --load-restrictor LoadRestrictionsNone > $(INMEMORY_TEMPLATES)/main/cluster-template.yaml
551+
549552
.PHONY: generate-metrics-config
550553
generate-metrics-config: $(ENVSUBST_BIN) ## Generate ./hack/observability/kube-state-metrics/crd-config.yaml
551554
OUTPUT_FILE="${OBSERVABILITY_DIR}/kube-state-metrics/crd-config.yaml"; \

test/e2e/autoscaler_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var _ = Describe("When using the autoscaler with Cluster API using ClusterClass
3232
BootstrapClusterProxy: bootstrapClusterProxy,
3333
ArtifactFolder: artifactFolder,
3434
SkipCleanup: skipCleanup,
35+
InfrastructureProvider: pointer.String("docker"),
3536
InfrastructureMachineTemplateKind: "dockermachinetemplates",
3637
Flavor: pointer.String("topology-autoscaler"),
3738
AutoscalerVersion: "v1.26.2",

test/e2e/cluster_upgrade.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ type ClusterUpgradeConformanceSpecInput struct {
4343
SkipConformanceTests bool
4444
ControlPlaneWaiters clusterctl.ControlPlaneWaiters
4545

46+
// InfrastructureProviders specifies the infrastructure to use for clusterctl
47+
// operations (Example: get cluster templates).
48+
// Note: In most cases this need not be specified. It only needs to be specified when
49+
// multiple infrastructure providers (ex: CAPD + in-memory) are installed on the cluster as clusterctl will not be
50+
// able to identify the default.
51+
InfrastructureProvider *string
52+
4653
// ControlPlaneMachineCount is used in `config cluster` to configure the count of the control plane machines used in the test.
4754
// Default is 1.
4855
ControlPlaneMachineCount *int64
@@ -118,13 +125,18 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
118125
It("Should create and upgrade a workload cluster and eventually run kubetest", func() {
119126
By("Creating a workload cluster")
120127

128+
infrastructureProvider := clusterctl.DefaultInfrastructureProvider
129+
if input.InfrastructureProvider != nil {
130+
infrastructureProvider = *input.InfrastructureProvider
131+
}
132+
121133
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
122134
ClusterProxy: input.BootstrapClusterProxy,
123135
ConfigCluster: clusterctl.ConfigClusterInput{
124136
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.BootstrapClusterProxy.GetName()),
125137
ClusterctlConfigPath: input.ClusterctlConfigPath,
126138
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
127-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
139+
InfrastructureProvider: infrastructureProvider,
128140
Flavor: pointer.StringDeref(input.Flavor, "upgrades"),
129141
Namespace: namespace.Name,
130142
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),

test/e2e/cluster_upgrade_runtimesdk.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ type clusterUpgradeWithRuntimeSDKSpecInput struct {
6262
ArtifactFolder string
6363
SkipCleanup bool
6464

65+
// InfrastructureProviders specifies the infrastructure to use for clusterctl
66+
// operations (Example: get cluster templates).
67+
// Note: In most cases this need not be specified. It only needs to be specified when
68+
// multiple infrastructure providers (ex: CAPD + in-memory) are installed on the cluster as clusterctl will not be
69+
// able to identify the default.
70+
InfrastructureProvider *string
71+
6572
// ControlPlaneMachineCount is used in `config cluster` to configure the count of the control plane machines used in the test.
6673
// Default is 1.
6774
ControlPlaneMachineCount *int64
@@ -150,13 +157,18 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl
150157
Namespace: namespace.Name,
151158
}
152159

160+
infrastructureProvider := clusterctl.DefaultInfrastructureProvider
161+
if input.InfrastructureProvider != nil {
162+
infrastructureProvider = *input.InfrastructureProvider
163+
}
164+
153165
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
154166
ClusterProxy: input.BootstrapClusterProxy,
155167
ConfigCluster: clusterctl.ConfigClusterInput{
156168
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.BootstrapClusterProxy.GetName()),
157169
ClusterctlConfigPath: input.ClusterctlConfigPath,
158170
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
159-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
171+
InfrastructureProvider: infrastructureProvider,
160172
Flavor: pointer.StringDeref(input.Flavor, "upgrades"),
161173
Namespace: namespace.Name,
162174
ClusterName: clusterName,

test/e2e/cluster_upgrade_runtimesdk_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ var _ = Describe("When upgrading a workload cluster using ClusterClass with Runt
3535
}
3636

3737
return clusterUpgradeWithRuntimeSDKSpecInput{
38-
E2EConfig: e2eConfig,
39-
ClusterctlConfigPath: clusterctlConfigPath,
40-
BootstrapClusterProxy: bootstrapClusterProxy,
41-
ArtifactFolder: artifactFolder,
42-
SkipCleanup: skipCleanup,
38+
E2EConfig: e2eConfig,
39+
ClusterctlConfigPath: clusterctlConfigPath,
40+
BootstrapClusterProxy: bootstrapClusterProxy,
41+
ArtifactFolder: artifactFolder,
42+
SkipCleanup: skipCleanup,
43+
InfrastructureProvider: pointer.String("docker"),
4344
// "upgrades" is the same as the "topology" flavor but with an additional MachinePool.
4445
Flavor: pointer.String("upgrades-runtimesdk"),
4546
}

test/e2e/cluster_upgrade_test.go

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,27 @@ var _ = Describe("When upgrading a workload cluster using ClusterClass and testi
5252
}
5353

5454
return ClusterUpgradeConformanceSpecInput{
55-
E2EConfig: e2eConfig,
56-
ClusterctlConfigPath: clusterctlConfigPath,
57-
BootstrapClusterProxy: bootstrapClusterProxy,
58-
ArtifactFolder: artifactFolder,
59-
SkipCleanup: skipCleanup,
60-
Flavor: flavor,
55+
E2EConfig: e2eConfig,
56+
ClusterctlConfigPath: clusterctlConfigPath,
57+
BootstrapClusterProxy: bootstrapClusterProxy,
58+
ArtifactFolder: artifactFolder,
59+
SkipCleanup: skipCleanup,
60+
Flavor: flavor,
61+
InfrastructureProvider: pointer.String("docker"),
6162
}
6263
})
6364
})
6465

6566
var _ = Describe("When upgrading a workload cluster using ClusterClass [ClusterClass]", func() {
6667
ClusterUpgradeConformanceSpec(ctx, func() ClusterUpgradeConformanceSpecInput {
6768
return ClusterUpgradeConformanceSpecInput{
68-
E2EConfig: e2eConfig,
69-
ClusterctlConfigPath: clusterctlConfigPath,
70-
BootstrapClusterProxy: bootstrapClusterProxy,
71-
ArtifactFolder: artifactFolder,
72-
SkipCleanup: skipCleanup,
73-
Flavor: pointer.String("topology"),
69+
E2EConfig: e2eConfig,
70+
ClusterctlConfigPath: clusterctlConfigPath,
71+
BootstrapClusterProxy: bootstrapClusterProxy,
72+
ArtifactFolder: artifactFolder,
73+
SkipCleanup: skipCleanup,
74+
InfrastructureProvider: pointer.String("docker"),
75+
Flavor: pointer.String("topology"),
7476
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
7577
// the conformance tests are skipped.
7678
ControlPlaneMachineCount: pointer.Int64(1),
@@ -83,11 +85,12 @@ var _ = Describe("When upgrading a workload cluster using ClusterClass [ClusterC
8385
var _ = Describe("When upgrading a workload cluster using ClusterClass with a HA control plane [ClusterClass]", func() {
8486
ClusterUpgradeConformanceSpec(ctx, func() ClusterUpgradeConformanceSpecInput {
8587
return ClusterUpgradeConformanceSpecInput{
86-
E2EConfig: e2eConfig,
87-
ClusterctlConfigPath: clusterctlConfigPath,
88-
BootstrapClusterProxy: bootstrapClusterProxy,
89-
ArtifactFolder: artifactFolder,
90-
SkipCleanup: skipCleanup,
88+
E2EConfig: e2eConfig,
89+
ClusterctlConfigPath: clusterctlConfigPath,
90+
BootstrapClusterProxy: bootstrapClusterProxy,
91+
ArtifactFolder: artifactFolder,
92+
SkipCleanup: skipCleanup,
93+
InfrastructureProvider: pointer.String("docker"),
9194
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
9295
// the conformance tests are skipped.
9396
SkipConformanceTests: true,
@@ -101,11 +104,12 @@ var _ = Describe("When upgrading a workload cluster using ClusterClass with a HA
101104
var _ = Describe("When upgrading a workload cluster using ClusterClass with a HA control plane using scale-in rollout [ClusterClass]", func() {
102105
ClusterUpgradeConformanceSpec(ctx, func() ClusterUpgradeConformanceSpecInput {
103106
return ClusterUpgradeConformanceSpecInput{
104-
E2EConfig: e2eConfig,
105-
ClusterctlConfigPath: clusterctlConfigPath,
106-
BootstrapClusterProxy: bootstrapClusterProxy,
107-
ArtifactFolder: artifactFolder,
108-
SkipCleanup: skipCleanup,
107+
E2EConfig: e2eConfig,
108+
ClusterctlConfigPath: clusterctlConfigPath,
109+
BootstrapClusterProxy: bootstrapClusterProxy,
110+
ArtifactFolder: artifactFolder,
111+
SkipCleanup: skipCleanup,
112+
InfrastructureProvider: pointer.String("docker"),
109113
// This test is run in CI in parallel with other tests. To keep the test duration reasonable
110114
// the conformance tests are skipped.
111115
SkipConformanceTests: true,

test/e2e/clusterclass_changes.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ type ClusterClassChangesSpecInput struct {
5151
SkipCleanup bool
5252
ControlPlaneWaiters clusterctl.ControlPlaneWaiters
5353

54+
// InfrastructureProviders specifies the infrastructure to use for clusterctl
55+
// operations (Example: get cluster templates).
56+
// Note: In most cases this need not be specified. It only needs to be specified when
57+
// multiple infrastructure providers (ex: CAPD + in-memory) are installed on the cluster as clusterctl will not be
58+
// able to identify the default.
59+
InfrastructureProvider *string
5460
// Flavor is the cluster-template flavor used to create the Cluster for testing.
5561
// NOTE: The template must be using a ClusterClass.
5662
Flavor string
@@ -131,13 +137,17 @@ func ClusterClassChangesSpec(ctx context.Context, inputGetter func() ClusterClas
131137

132138
It("Should successfully rollout the managed topology upon changes to the ClusterClass", func() {
133139
By("Creating a workload cluster")
140+
infrastructureProvider := clusterctl.DefaultInfrastructureProvider
141+
if input.InfrastructureProvider != nil {
142+
infrastructureProvider = *input.InfrastructureProvider
143+
}
134144
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
135145
ClusterProxy: input.BootstrapClusterProxy,
136146
ConfigCluster: clusterctl.ConfigClusterInput{
137147
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.BootstrapClusterProxy.GetName()),
138148
ClusterctlConfigPath: input.ClusterctlConfigPath,
139149
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
140-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
150+
InfrastructureProvider: infrastructureProvider,
141151
Flavor: input.Flavor,
142152
Namespace: namespace.Name,
143153
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),

test/e2e/clusterclass_changes_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ package e2e
2121

2222
import (
2323
. "github.com/onsi/ginkgo/v2"
24+
"k8s.io/utils/pointer"
2425
)
2526

2627
var _ = Describe("When testing ClusterClass changes [ClusterClass]", func() {
2728
ClusterClassChangesSpec(ctx, func() ClusterClassChangesSpecInput {
2829
return ClusterClassChangesSpecInput{
29-
E2EConfig: e2eConfig,
30-
ClusterctlConfigPath: clusterctlConfigPath,
31-
BootstrapClusterProxy: bootstrapClusterProxy,
32-
ArtifactFolder: artifactFolder,
33-
SkipCleanup: skipCleanup,
34-
Flavor: "topology",
30+
E2EConfig: e2eConfig,
31+
ClusterctlConfigPath: clusterctlConfigPath,
32+
BootstrapClusterProxy: bootstrapClusterProxy,
33+
ArtifactFolder: artifactFolder,
34+
SkipCleanup: skipCleanup,
35+
InfrastructureProvider: pointer.String("docker"),
36+
Flavor: "topology",
3537
// ModifyControlPlaneFields are the ControlPlane fields which will be set on the
3638
// ControlPlaneTemplate of the ClusterClass after the initial Cluster creation.
3739
// The test verifies that these fields are rolled out to the ControlPlane.

test/e2e/clusterclass_rollout.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ type ClusterClassRolloutSpecInput struct {
5858
SkipCleanup bool
5959
ControlPlaneWaiters clusterctl.ControlPlaneWaiters
6060

61+
// InfrastructureProviders specifies the infrastructure to use for clusterctl
62+
// operations (Example: get cluster templates).
63+
// Note: In most cases this need not be specified. It only needs to be specified when
64+
// multiple infrastructure providers (ex: CAPD + in-memory) are installed on the cluster as clusterctl will not be
65+
// able to identify the default.
66+
InfrastructureProvider *string
67+
6168
// Flavor is the cluster-template flavor used to create the Cluster for testing.
6269
// NOTE: The template must be using ClusterClass, KCP and CABPK as this test is specifically
6370
// testing ClusterClass and KCP rollout behavior.
@@ -105,13 +112,17 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
105112

106113
It("Should successfully rollout the managed topology upon changes to the ClusterClass", func() {
107114
By("Creating a workload cluster")
115+
infrastructureProvider := clusterctl.DefaultInfrastructureProvider
116+
if input.InfrastructureProvider != nil {
117+
infrastructureProvider = *input.InfrastructureProvider
118+
}
108119
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
109120
ClusterProxy: input.BootstrapClusterProxy,
110121
ConfigCluster: clusterctl.ConfigClusterInput{
111122
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.BootstrapClusterProxy.GetName()),
112123
ClusterctlConfigPath: input.ClusterctlConfigPath,
113124
KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(),
114-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
125+
InfrastructureProvider: infrastructureProvider,
115126
Flavor: input.Flavor,
116127
Namespace: namespace.Name,
117128
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),

0 commit comments

Comments
 (0)