Skip to content

Commit

Permalink
Add selection for CNI used
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Mar 21, 2024
1 parent ac9c0f0 commit bc77c31
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GINKGO_ARGS ?=
SKIP_RESOURCE_CLEANUP ?= false
USE_EXISTING_CLUSTER ?= false
ISOLATED_MODE ?= false
CNI ?= calico # alternatively: kindnet
GINKGO_NOCOLOR ?= false
GINKGO_LABEL_FILTER ?= short || full
GINKGO_TESTS ?= $(ROOT_DIR)/$(TEST_DIR)/e2e/suites/...
Expand Down Expand Up @@ -522,7 +523,8 @@ test-e2e: $(GINKGO) $(HELM) $(CLUSTERCTL) kubectl e2e-image ## Run the end-to-en
-e2e.chart-path=$(ROOT_DIR)/$(CHART_RELEASE_DIR) \
-e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) \
-e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) \
-e2e.isolated-mode=$(ISOLATED_MODE)
-e2e.isolated-mode=$(ISOLATED_MODE) \
-e2e.cni=$(CNI)

.PHONY: e2e-image
e2e-image: ## Build the image for e2e tests
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type FlagValues struct {

// ClusterctlBinaryPath is the path to the clusterctl binary to use.
ClusterctlBinaryPath string

// CNI for the cluster to use. Values include calico or kindnet.
CNI string
}

// InitFlags is used to specify the standard flags for the e2e tests.
Expand All @@ -62,4 +65,5 @@ func InitFlags(values *FlagValues) {
flag.StringVar(&values.ClusterctlBinaryPath, "e2e.clusterctl-binary-path", "helm", "path to the clusterctl binary")
flag.StringVar(&values.ChartPath, "e2e.chart-path", "", "path to the operator chart")
flag.BoolVar(&values.IsolatedMode, "e2e.isolated-mode", false, "if true, the test will run without ngrok and exposing the cluster to the internet. This setup will only work with CAPD or other providers that run in the same network as the bootstrap cluster.")
flag.StringVar(&values.CNI, "e2e.cni", "calico", "specify CNI solution for the cluster. Allowed values: calico, kindnet")
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ var _ = Describe("[Docker] [Kubeadm] Create and delete CAPI cluster functionalit
})

specs.CreateUsingGitOpsSpec(ctx, func() specs.CreateUsingGitOpsSpecInput {
cni := e2e.KindnetCNI
if flagVals.CNI == "calico" {
cni = e2e.CalicoCNI
}
return specs.CreateUsingGitOpsSpecInput{
E2EConfig: e2eConfig,
BootstrapClusterProxy: setupClusterResult.BootstrapClusterProxy,
Expand All @@ -45,7 +49,7 @@ var _ = Describe("[Docker] [Kubeadm] Create and delete CAPI cluster functionalit
ArtifactFolder: flagVals.ArtifactFolder,
ClusterTemplate: e2e.CAPIDockerKubeadm,
ClusterName: "highlander-e2e-cluster1",
CNITemplate: e2e.CalicoCNI,
CNITemplate: cni,
ControlPlaneMachineCount: ptr.To[int](1),
WorkerMachineCount: ptr.To[int](1),
GitAddr: giteaResult.GitAddress,
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/suites/import-gitops/import_gitops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ var _ = Describe("[Docker] [Kubeadm] Create and delete CAPI cluster functionalit
})

specs.CreateUsingGitOpsSpec(ctx, func() specs.CreateUsingGitOpsSpecInput {
cni := e2e.KindnetCNI
if flagVals.CNI == "calico" {
cni = e2e.CalicoCNI
}
return specs.CreateUsingGitOpsSpecInput{
E2EConfig: e2eConfig,
BootstrapClusterProxy: setupClusterResult.BootstrapClusterProxy,
Expand All @@ -47,7 +51,7 @@ var _ = Describe("[Docker] [Kubeadm] Create and delete CAPI cluster functionalit
ArtifactFolder: flagVals.ArtifactFolder,
ClusterTemplate: e2e.CAPIDockerKubeadm,
ClusterName: "highlander-e2e-cluster1",
CNITemplate: e2e.CalicoCNI,
CNITemplate: cni,
ControlPlaneMachineCount: ptr.To[int](1),
WorkerMachineCount: ptr.To[int](1),
GitAddr: giteaResult.GitAddress,
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/suites/managementv3/managementv3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var _ = Describe("[Docker] [Kubeadm] - [management.cattle.io/v3] Create and dele
})

specs.CreateMgmtV3UsingGitOpsSpec(ctx, func() specs.CreateMgmtV3UsingGitOpsSpecInput {
cni := e2e.KindnetCNI
if flagVals.CNI == "calico" {
cni = e2e.CalicoCNI
}
return specs.CreateMgmtV3UsingGitOpsSpecInput{
E2EConfig: e2eConfig,
BootstrapClusterProxy: setupClusterResult.BootstrapClusterProxy,
Expand All @@ -44,7 +48,7 @@ var _ = Describe("[Docker] [Kubeadm] - [management.cattle.io/v3] Create and dele
ArtifactFolder: flagVals.ArtifactFolder,
ClusterTemplate: e2e.CAPIDockerKubeadm,
ClusterName: "highlander-e2e-clusterv3-1",
CNITemplate: e2e.CalicoCNI,
CNITemplate: cni,
ControlPlaneMachineCount: ptr.To[int](1),
WorkerMachineCount: ptr.To[int](1),
GitAddr: giteaResult.GitAddress,
Expand Down

0 comments on commit bc77c31

Please sign in to comment.