Skip to content

Commit 07631c4

Browse files
authored
Merge pull request #1380 from CecileRobertMichon/fix-capi-e2e
Re-add handling of CNI variables in e2e for CAPI suite
2 parents f06aed2 + 45d31b4 commit 07631c4

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

test/e2e/capi_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333

3434
var _ = Describe("Running the Cluster API E2E tests", func() {
3535
BeforeEach(func() {
36+
Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.CNIPath))
3637
rgName := fmt.Sprintf("capz-e2e-%s", util.RandomString(6))
3738
Expect(os.Setenv(AzureResourceGroup, rgName)).NotTo(HaveOccurred())
3839
Expect(os.Setenv(AzureVNetName, fmt.Sprintf("%s-vnet", rgName))).NotTo(HaveOccurred())

test/e2e/config/azure-dev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ variables:
9191
COREDNS_VERSION_UPGRADE_TO: "1.6.7"
9292
KUBERNETES_VERSION_UPGRADE_TO: "${KUBERNETES_VERSION_UPGRADE_TO:-v1.19.7}"
9393
KUBERNETES_VERSION_UPGRADE_FROM: "${KUBERNETES_VERSION_UPGRADE_FROM:-v1.18.15}"
94+
CNI: "${PWD}/templates/addons/calico.yaml"
9495
REDACT_LOG_SCRIPT: "${PWD}/hack/log/redact.sh"
9596
EXP_AKS: "true"
9697
EXP_MACHINE_POOL: "true"

test/e2e/e2e_suite_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
"k8s.io/apimachinery/pkg/runtime"
4747
"k8s.io/apimachinery/pkg/runtime/schema"
4848
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
49+
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
4950
"sigs.k8s.io/cluster-api/test/framework"
5051
"sigs.k8s.io/cluster-api/test/framework/bootstrap"
5152
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
@@ -345,6 +346,12 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol
345346
RepositoryFolder: repositoryFolder,
346347
}
347348

349+
// 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.
350+
Expect(config.Variables).To(HaveKey(capi_e2e.CNIPath), "Missing %s variable in the config", capi_e2e.CNIPath)
351+
cniPath := config.GetVariable(capi_e2e.CNIPath)
352+
Expect(cniPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", capi_e2e.CNIPath)
353+
createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(cniPath, capi_e2e.CNIResources)
354+
348355
clusterctlConfig := clusterctl.CreateRepository(context.TODO(), createRepositoryInput)
349356
Expect(clusterctlConfig).To(BeAnExistingFile(), "The clusterctl config file does not exists in the local repository %s", repositoryFolder)
350357
return clusterctlConfig

0 commit comments

Comments
 (0)