Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato committed Oct 21, 2023
1 parent fc267d6 commit 08d7fbe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 37 deletions.
5 changes: 0 additions & 5 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...))
}
Expand Down
29 changes: 5 additions & 24 deletions test/e2e/data/infrastructure-gcp/cluster-template-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
name: "${CLUSTER_NAME}"
labels:
cni: "${CLUSTER_NAME}-crs-cni"
ccm: "${CLUSTER_NAME}-crs-ccm"
spec:
clusterNetwork:
pods:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
21 changes: 13 additions & 8 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 08d7fbe

Please sign in to comment.