Skip to content

Commit

Permalink
Skip installation of CCM for e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Kovacs committed Apr 26, 2024
1 parent ba26737 commit 41876ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
9 changes: 5 additions & 4 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ test-cluster: kind ctlptl kind clean-cluster
./test/scripts/create_management_cluster.sh $(K8S_VERSION)

clean-cluster: ctlptl
$(CTLPTL) delete cluster kind-management --ignore-not-found
$(CTLPTL) delete cluster kind-ccm-management --ignore-not-found
rm -rf $(MANAGEMENT_KUBECONFIG)

reuse-and-test: SUITE_ARGS='--reuse'

test reuse-and-test: clusterctl ginkgo check-token test-cluster
test reuse-and-test: clusterctl check-token test-cluster _test
$(MAKE) clean-cluster

_test: ginkgo
go list -m; \
MANAGEMENT_KUBECONFIG=$(ROOT_DIR)/e2e/$(MANAGEMENT_KUBECONFIG) $(GINKGO) -r --vv --trace $(TEST_ARGS) -- --image=${IMG} --k8s_version=${K8S_VERSION} $(SUITE_ARGS)

$(MAKE) clean-cluster

clean: check-token
cd test; \
./scripts/delete_cluster.sh ccm-linode-for-reuse
Expand Down
9 changes: 2 additions & 7 deletions e2e/test/scripts/create_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi

(cd ${ROOT_DIR}/deploy ; set +x ; ./generate-manifest.sh ${LINODE_TOKEN} ${LINODE_REGION})

kubectl create ns ${CLUSTER_NAME}
kubectl create ns ${CLUSTER_NAME} ||:
(cd $(realpath "$(dirname "$0")"); clusterctl generate cluster ${CLUSTER_NAME} \
--target-namespace ${CLUSTER_NAME} \
--flavor clusterclass-kubeadm \
Expand All @@ -37,9 +37,7 @@ until kubectl get secret -n ${CLUSTER_NAME} ${CLUSTER_NAME}-kubeconfig; do
sleep $(((c--)))
done

kubectl get secret -n ${CLUSTER_NAME} ${CLUSTER_NAME}-kubeconfig -o jsonpath="{.data.value}" \
| base64 --decode \
> "$(pwd)/${CLUSTER_NAME}.conf"
clusterctl get kubeconfig -n ${CLUSTER_NAME} ${CLUSTER_NAME} > "$(pwd)/${CLUSTER_NAME}.conf"

export KUBECONFIG="$(pwd)/${CLUSTER_NAME}.conf"

Expand All @@ -48,9 +46,6 @@ until kubectl version; do
sleep $(((c--)))
done

# Skip if it's failing because of CCM is already exists.
kubectl apply -f ${ROOT_DIR}/deploy/ccm-linode.yaml || kubectl get clusterrole ccm-linode-clusterrole

c=24
until [[ $(kubectl get no --no-headers | grep Ready | wc -l) == 3 ]]; do
sleep $(((c--)))
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/scripts/create_management_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export HELM_VERSION="v0.2.1"
export KUBECONFIG="$(realpath "$(dirname "$0")/../kind-management.conf")"

ctlptl create cluster kind \
--name kind-management \
--name kind-ccm-management \
--kubernetes-version ${KUBERNETES_VERSION}

prepare_images() {
local images="$(echo "$1" | grep -e "^[[:space:]]*image:[?[:space:]]" | awk '{print $2}')"

echo "${images//[\'\"]}" | xargs -I {} sh -c 'docker pull '{}' ; kind -n management load docker-image '{}
echo "${images//[\'\"]}" | xargs -I {} sh -c 'docker pull '{}' ; kind -n ccm-management load docker-image '{}
}

(set +x; prepare_images "$(curl -sfL $(cat $(realpath "$(dirname "$0")/clusterctl.yaml") | grep cluster-api-provider-linode | awk '{print $2}'))")
Expand Down

0 comments on commit 41876ff

Please sign in to comment.