Skip to content

Commit e7d5a01

Browse files
committed
Add test
1 parent f0a29d1 commit e7d5a01

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

test/e2e/const.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ var (
9090
//go:embed data/cluster-templates/aws-eks-mmp.yaml
9191
CAPIAwsEKSMMP []byte
9292

93+
//go:embed data/cluster-templates/aws-eks-topology.yaml
94+
CAPIAwsEKSTopology []byte
95+
9396
//go:embed data/cluster-templates/aws-ec2-rke2-topology.yaml
9497
CAPIAwsEC2RKE2Topology []byte
9598

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: Cluster
3+
metadata:
4+
name: ${CLUSTER_NAME}
5+
labels:
6+
cluster-api.cattle.io/rancher-auto-import: "true"
7+
spec:
8+
clusterNetwork:
9+
pods:
10+
cidrBlocks:
11+
- 192.168.0.0/16
12+
topology:
13+
class: aws-eks-example
14+
classNamespace: ${TOPOLOGY_NAMESPACE}
15+
version: ${AWS_KUBERNETES_VERSION}
16+
variables:
17+
- name: region
18+
value: ${AWS_REGION}
19+
- name: sshKeyName
20+
value: ${AWS_SSH_KEY_NAME}
21+
- name: instanceType
22+
value: t3.xlarge
23+
workers:
24+
machineDeployments:
25+
- class: default-worker
26+
name: md-0
27+
replicas: ${WORKER_MACHINE_COUNT}

test/e2e/suites/import-gitops/import_gitops_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,64 @@ var _ = Describe("[AWS] [EKS] Create and delete CAPI cluster functionality shoul
286286
})
287287
})
288288

289+
var _ = FDescribe("[AWS] [EKS] Create and delete CAPI cluster from cluster class", Label(e2e.FullTestLabel), func() {
290+
var topologyNamespace string
291+
292+
BeforeEach(func() {
293+
komega.SetClient(bootstrapClusterProxy.GetClient())
294+
komega.SetContext(ctx)
295+
296+
topologyNamespace = "creategitops-aws-eks"
297+
})
298+
299+
specs.CreateMgmtV3UsingGitOpsSpec(ctx, func() specs.CreateMgmtV3UsingGitOpsSpecInput {
300+
testenv.CAPIOperatorDeployProvider(ctx, testenv.CAPIOperatorDeployProviderInput{
301+
BootstrapClusterProxy: bootstrapClusterProxy,
302+
CAPIProvidersSecretsYAML: [][]byte{
303+
e2e.AWSIdentitySecret,
304+
},
305+
CAPIProvidersYAML: [][]byte{
306+
e2e.AWSProvider,
307+
},
308+
WaitForDeployments: []testenv.NamespaceName{
309+
{
310+
Name: "capa-controller-manager",
311+
Namespace: "capa-system",
312+
},
313+
},
314+
})
315+
316+
return specs.CreateMgmtV3UsingGitOpsSpecInput{
317+
E2EConfig: e2e.LoadE2EConfig(),
318+
BootstrapClusterProxy: bootstrapClusterProxy,
319+
ClusterTemplate: e2e.CAPIAwsEKSTopology,
320+
ClusterName: "cluster-eks",
321+
ControlPlaneMachineCount: ptr.To(1),
322+
WorkerMachineCount: ptr.To(1),
323+
LabelNamespace: true,
324+
RancherServerURL: hostName,
325+
CAPIClusterCreateWaitName: "wait-capa-create-cluster",
326+
DeleteClusterWaitName: "wait-eks-delete",
327+
CapiClusterOwnerLabel: e2e.CapiClusterOwnerLabel,
328+
CapiClusterOwnerNamespaceLabel: e2e.CapiClusterOwnerNamespaceLabel,
329+
OwnedLabelName: e2e.OwnedLabelName,
330+
TopologyNamespace: topologyNamespace,
331+
AdditionalTemplateVariables: map[string]string{
332+
e2e.KubernetesVersionVar: e2e.LoadE2EConfig().GetVariableOrEmpty(e2e.AWSKubernetesVersionVar), // override the default k8s version
333+
},
334+
AdditionalFleetGitRepos: []turtlesframework.FleetCreateGitRepoInput{
335+
{
336+
Name: "aws-cluster-classes-eks",
337+
Paths: []string{"examples/clusterclasses/aws/eks"},
338+
ClusterProxy: bootstrapClusterProxy,
339+
TargetNamespace: topologyNamespace,
340+
Branch: "aws-eks-example",
341+
},
342+
},
343+
}
344+
})
345+
})
346+
289347
var _ = Describe("[AWS] [EC2 Kubeadm] Create and delete CAPI cluster functionality should work with namespace auto-import", Label(e2e.FullTestLabel, e2e.KubeadmTestLabel), func() {
290348
var topologyNamespace string
291349

0 commit comments

Comments
 (0)