From 08d7fbe49381dba3f222222af79cec70231c0d84 Mon Sep 17 00:00:00 2001 From: cpanato Date: Sat, 21 Oct 2023 17:46:11 +0200 Subject: [PATCH] test Signed-off-by: cpanato --- test/e2e/common.go | 5 ---- .../cluster-template-ci.yaml | 29 ++++--------------- test/e2e/suite_test.go | 21 +++++++++----- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/test/e2e/common.go b/test/e2e/common.go index cfdbbd06d5..9039c6391a 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -32,11 +32,6 @@ import ( "sigs.k8s.io/cluster-api/util" ) -const ( - CCMPath = "CCM" - CCMResources = "CCM_RESOURCES" -) - func Byf(format string, a ...interface{}) { By(fmt.Sprintf(format, a...)) } diff --git a/test/e2e/data/infrastructure-gcp/cluster-template-ci.yaml b/test/e2e/data/infrastructure-gcp/cluster-template-ci.yaml index b358d9a4f6..343101423e 100644 --- a/test/e2e/data/infrastructure-gcp/cluster-template-ci.yaml +++ b/test/e2e/data/infrastructure-gcp/cluster-template-ci.yaml @@ -5,7 +5,6 @@ metadata: name: "${CLUSTER_NAME}" labels: cni: "${CLUSTER_NAME}-crs-cni" - ccm: "${CLUSTER_NAME}-crs-ccm" spec: clusterNetwork: pods: @@ -46,22 +45,22 @@ spec: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: - cloud-provider: external + cloud-provider: gce clusterConfiguration: apiServer: timeoutForControlPlane: 20m extraArgs: - cloud-provider: external + cloud-provider: gce controllerManager: extraArgs: - cloud-provider: external + cloud-provider: gce allocate-node-cidrs: "false" kubernetesVersion: "${KUBERNETES_VERSION}" joinConfiguration: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: - cloud-provider: external + cloud-provider: gce version: "${KUBERNETES_VERSION}" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 @@ -118,7 +117,7 @@ spec: nodeRegistration: name: '{{ ds.meta_data.local_hostname.split(".")[0] }}' kubeletExtraArgs: - cloud-provider: external + cloud-provider: gce --- apiVersion: v1 kind: ConfigMap @@ -139,21 +138,3 @@ spec: - name: "${CLUSTER_NAME}-crs-cni" kind: ConfigMap --- -apiVersion: v1 -kind: ConfigMap -metadata: - name: "${CLUSTER_NAME}-crs-ccm" -data: ${CCM_RESOURCES} ---- -apiVersion: addons.cluster.x-k8s.io/v1beta1 -kind: ClusterResourceSet -metadata: - name: "${CLUSTER_NAME}-crs-ccm" -spec: - strategy: ApplyOnce - clusterSelector: - matchLabels: - ccm: "${CLUSTER_NAME}-crs-ccm" - resources: - - name: "${CLUSTER_NAME}-crs-ccm" - kind: ConfigMap diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 1fe2d0c894..73b9ef32e8 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -44,9 +44,12 @@ import ( const ( KubernetesVersion = "KUBERNETES_VERSION" - CNIPath = "CNI" - CNIResources = "CNI_RESOURCES" KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT" + + CNIPath = "CNI" + CNIResources = "CNI_RESOURCES" + CCMPath = "CCM" + CCMResources = "CCM_RESOURCES" ) // Test suite flags. @@ -216,15 +219,17 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol Expect(cniPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", capi_e2e.CNIPath) createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(cniPath, capi_e2e.CNIResources) - // Ensuring a CCM file is defined in the config and register a FileTransformation to inject the referenced file as in place of the CCM_RESOURCES envSubst variable. - Expect(config.Variables).To(HaveKey(CCMPath), "Missing %s variable in the config", CCMPath) - ccmPath := config.GetVariable(CCMPath) - Expect(ccmPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", CCMPath) - createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(ccmPath, CCMResources) - clusterctlConfig := clusterctl.CreateRepository(context.TODO(), createRepositoryInput) Expect(clusterctlConfig).To(BeAnExistingFile(), "The clusterctl config file does not exists in the local repository %s", repositoryFolder) + if useCIArtifacts { + // Ensuring a CCM file is defined in the config and register a FileTransformation to inject the referenced file as in place of the CCM_RESOURCES envSubst variable. + Expect(config.Variables).To(HaveKey(CCMPath), "Missing %s variable in the config", CCMPath) + ccmPath := config.GetVariable(CCMPath) + Expect(ccmPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", CCMPath) + createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(ccmPath, CCMResources) + } + return clusterctlConfig }