Skip to content

Commit

Permalink
using the staging image for ccm
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato committed Oct 22, 2023
1 parent 7bed424 commit 5493980
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 48 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
1 change: 1 addition & 0 deletions test/e2e/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var _ = Describe("Conformance Tests", func() {
Expect(e2eConfig.Variables).To(HaveKey(KubernetesVersion))
Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.KubernetesVersion))
Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.CNIPath))
Expect(e2eConfig.Variables).To(HaveKey(CCMPath))

clusterName = fmt.Sprintf("capg-conf-%s", util.RandomString(6))

Expand Down
22 changes: 11 additions & 11 deletions test/e2e/data/ccm/gce-cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ spec:
operator: Exists
containers:
- args:
- --allocate-node-cidrs=true
- --cidr-allocator-type=RangeAllocator
- --cluster-cidr=192.168.0.0/16
- --cluster-name=${CLUSTER_NAME}
- --controllers=*
- --leader-elect=true
- --v=4
- --cloud-provider=gce
- --use-service-account-credentials=true
- --cloud-config=/etc/kubernetes/cloud.config
image: registry.k8s.io/cloud-provider-gcp/cloud-controller-manager:v27.1.6@sha256:f057f6c934d6afa73a38f94b71d7da2f99033e9a6e689d59b4ee1e689031ef00
- --allocate-node-cidrs=true
- --cidr-allocator-type=RangeAllocator
- --cluster-cidr=192.168.0.0/16
- --cluster-name=${CLUSTER_NAME}
- --controllers=*
- --leader-elect=true
- --v=4
- --cloud-provider=gce
- --use-service-account-credentials=true
- --cloud-config=/etc/kubernetes/cloud.config
image: gcr.io/k8s-staging-cloud-provider-gcp/cloud-controller-manager:master
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
Expand Down
30 changes: 5 additions & 25 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 @@ -138,22 +137,3 @@ spec:
resources:
- 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
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ spec:
owner: root:root
path: /tmp/kubeadm-bootstrap.sh
permissions: "0744"
- content: |
[Global]
project-id = "${GCP_PROJECT}"
network-name = "${GCP_NETWORK_NAME}"
owner: root:root
path: /etc/kubernetes/cloud.config
permissions: "0744"
joinConfiguration:
nodeRegistration:
name: '{{ ds.meta_data.local_hostname.split(".")[0] }}'
Expand Down
21 changes: 14 additions & 7 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,11 +219,15 @@ 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)
// TODO: remove this when we run tests with ccm for < 1.28. in k8s 1.29+ it is required to use a ccm
if useCIArtifacts {
Expect(e2eConfig.Variables).To(HaveKey(CCMPath))
// 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)
Expand Down

0 comments on commit 5493980

Please sign in to comment.