Skip to content

Commit

Permalink
Re-add handling of CNI variables in e2e for CAPI suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon committed May 18, 2021
1 parent 430fb0f commit 45d31b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/capi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions test/e2e/config/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 45d31b4

Please sign in to comment.