diff --git a/test/e2e/capi_test.go b/test/e2e/capi_test.go index c498b45a623..296820e0ccf 100644 --- a/test/e2e/capi_test.go +++ b/test/e2e/capi_test.go @@ -33,6 +33,7 @@ import ( var _ = Describe("Running the Cluster API E2E tests", func() { BeforeEach(func() { + Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.CNIPath)) rgName := fmt.Sprintf("capz-e2e-%s", util.RandomString(6)) Expect(os.Setenv(AzureResourceGroup, rgName)).NotTo(HaveOccurred()) Expect(os.Setenv(AzureVNetName, fmt.Sprintf("%s-vnet", rgName))).NotTo(HaveOccurred()) diff --git a/test/e2e/config/azure-dev.yaml b/test/e2e/config/azure-dev.yaml index 4824069ec3e..7a2bc9796a2 100644 --- a/test/e2e/config/azure-dev.yaml +++ b/test/e2e/config/azure-dev.yaml @@ -91,6 +91,7 @@ variables: COREDNS_VERSION_UPGRADE_TO: "1.6.7" KUBERNETES_VERSION_UPGRADE_TO: "${KUBERNETES_VERSION_UPGRADE_TO:-v1.19.7}" KUBERNETES_VERSION_UPGRADE_FROM: "${KUBERNETES_VERSION_UPGRADE_FROM:-v1.18.15}" + CNI: "${PWD}/templates/addons/calico.yaml" REDACT_LOG_SCRIPT: "${PWD}/hack/log/redact.sh" EXP_AKS: "true" EXP_MACHINE_POOL: "true" diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 94a8935b41c..3776ff7dae9 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -46,6 +46,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" + capi_e2e "sigs.k8s.io/cluster-api/test/e2e" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/bootstrap" "sigs.k8s.io/cluster-api/test/framework/clusterctl" @@ -345,6 +346,12 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol RepositoryFolder: repositoryFolder, } + // Ensuring a CNI file is defined in the config and register a FileTransformation to inject the referenced file as in place of the CNI_RESOURCES envSubst variable. + Expect(config.Variables).To(HaveKey(capi_e2e.CNIPath), "Missing %s variable in the config", capi_e2e.CNIPath) + cniPath := config.GetVariable(capi_e2e.CNIPath) + Expect(cniPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", capi_e2e.CNIPath) + createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(cniPath, capi_e2e.CNIResources) + clusterctlConfig := clusterctl.CreateRepository(context.TODO(), createRepositoryInput) Expect(clusterctlConfig).To(BeAnExistingFile(), "The clusterctl config file does not exists in the local repository %s", repositoryFolder) return clusterctlConfig