Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update e2e-test-kind to pull image from quay.io #667

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions hack/run-e2e-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export LOG_LEVEL=${TEST_LOG_LEVEL:-2}
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-"true"}
export CLUSTER_CONTEXT="--name test"
# Using older image due to older version of kubernetes cluster"
export IMAGE_ECHOSERVER="kicbase/echo-server:1.0"
export IMAGE_ECHOSERVER="quay.io/project-codeflare/echo-server:1.0"
export IMAGE_UBUNTU_LATEST="ubuntu:latest"
export IMAGE_UBI_LATEST="registry.access.redhat.com/ubi8/ubi:latest"
export IMAGE_BUSY_BOX_LATEST="k8s.gcr.io/busybox:latest"
Expand All @@ -49,7 +49,7 @@ export KUTTL_TEST_SUITES=("${ROOT_DIR}/test/kuttl-test.yaml" "${ROOT_DIR}/test/k
DUMP_LOGS="true"

function update_test_host {

local arch="$(go env GOARCH)"
if [ -z $arch ]
then
Expand All @@ -67,43 +67,43 @@ function update_test_host {

which kubectl >/dev/null 2>&1
if [ $? -ne 0 ]
then
then
sudo apt-get install -y --allow-unauthenticated kubectl
[ $? -ne 0 ] && echo "Failed to install kubectl" && exit 1
echo "kubectl was sucessfully installed."
fi
[ $? -ne 0 ] && echo "Failed to install kubectl" && exit 1
echo "kubectl was sucessfully installed."
fi

which kind >/dev/null 2>&1
if [ $? -ne 0 ]
if [ $? -ne 0 ]
then
# Download kind binary (0.20.0)
echo "Downloading and installing kind...."
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-linux-${arch} && \
sudo chmod +x /usr/local/bin/kind
[ $? -ne 0 ] && echo "Failed to download kind" && exit 1
echo "Kind was sucessfully installed."
sudo chmod +x /usr/local/bin/kind
[ $? -ne 0 ] && echo "Failed to download kind" && exit 1
echo "Kind was sucessfully installed."
fi

which helm >/dev/null 2>&1
if [ $? -ne 0 ]
then
then
# Installing helm3
echo "Downloading and installing helm..."
curl -fsSL -o ${ROOT_DIR}/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&
curl -fsSL -o ${ROOT_DIR}/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&
chmod 700 ${ROOT_DIR}/get_helm.sh && ${ROOT_DIR}/get_helm.sh
[ $? -ne 0 ] && echo "Failed to download and install helm" && exit 1
echo "Helm was sucessfully installed."
rm -rf ${ROOT_DIR}/get_helm.sh
fi

kubectl kuttl version >/dev/null 2>&1
if [ $? -ne 0 ]
then
if [[ "$arch" == "amd64" ]]
then
then
local kuttl_arch="x86_64"
else
local kuttl_arch=$arch
local kuttl_arch=$arch
fi
# Download kuttl plugin
echo "Downloading and installing kuttl...."
Expand All @@ -119,7 +119,7 @@ function update_test_host {
function check-prerequisites {
echo "checking prerequisites"
which kind >/dev/null 2>&1
if [ $? -ne 0 ]
if [ $? -ne 0 ]
then
echo "kind not installed, exiting."
exit 1
Expand All @@ -133,7 +133,7 @@ function check-prerequisites {
echo "kubectl not installed, exiting."
exit 1
else
echo -n "found kubectl, " && kubectl version
echo -n "found kubectl, " && kubectl version
fi
kubectl kuttl version >/dev/null 2>&1
if [ $? -ne 0 ]
Expand All @@ -143,7 +143,7 @@ function check-prerequisites {
else
echo -n "found kuttl plugin for kubectl, " && kubectl kuttl version
fi

if [[ $IMAGE_REPOSITORY_MCAD == "" ]]
then
echo "No MCAD image was provided."
Expand All @@ -155,25 +155,25 @@ function check-prerequisites {
else
echo "end to end test with ${IMAGE_MCAD}."
fi

which helm >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "helm not installed, exiting."
exit 1
else
echo -n "found helm, " && helm version --short
fi
fi



which helm >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "helm not installed, exiting."
exit 1
else
echo -n "found helm, " && helm version --short
fi
fi

}

Expand All @@ -193,7 +193,7 @@ function kind-up-cluster {
fi
CLUSTER_STARTED="true"

docker pull ${IMAGE_ECHOSERVER}
docker pull ${IMAGE_ECHOSERVER}
if [ $? -ne 0 ]
then
echo "Failed to pull ${IMAGE_ECHOSERVER}"
Expand All @@ -213,14 +213,14 @@ function kind-up-cluster {
echo "Failed to pull ${IMAGE_UBI_LATEST}"
exit 1
fi

docker pull ${IMAGE_BUSY_BOX_LATEST}
if [ $? -ne 0 ]
then
echo "Failed to pull ${IMAGE_BUSY_BOX_LATEST}"
exit 1
fi

if [[ "$MCAD_IMAGE_PULL_POLICY" = "Always" ]]
then
docker pull ${IMAGE_MCAD}
Expand All @@ -245,7 +245,7 @@ function kind-up-cluster {
echo "Failed to load image ${image} in cluster"
exit 1
fi
done
done
}

# clean up
Expand All @@ -256,7 +256,7 @@ function cleanup {
then
echo "Cluster was not started, nothing more to do."
return
fi
fi

if [[ ${DUMP_LOGS} == "true" ]]
then
Expand Down Expand Up @@ -303,15 +303,15 @@ function cleanup {
kubectl logs ${mcad_pod} -n kube-system
fi
fi

rm -f kubeconfig

if [[ $CLEANUP_CLUSTER == "true" ]]
then
kind delete cluster ${CLUSTER_CONTEXT}
else
echo "Cluster requested to stay up, not deleting cluster"
fi
kind delete cluster ${CLUSTER_CONTEXT}
else
echo "Cluster requested to stay up, not deleting cluster"
fi
}

function undeploy_mcad_helm {
Expand Down Expand Up @@ -348,10 +348,10 @@ function mcad-up {
function setup-mcad-env {
echo "Installing Podgroup CRD"
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/scheduler-plugins/277b6bdec18f8a9e9ccd1bfeaf4b66495bfc6f92/config/crd/bases/scheduling.sigs.k8s.io_podgroups.yaml

# Turn off master taints
kubectl taint nodes --all node-role.kubernetes.io/control-plane:NoSchedule-

# This is meant to orchestrate initial cluster configuration such that accounting tests can be consistent
echo "Orchestrate cluster..."
echo "kubectl cordon test-worker"
Expand All @@ -369,7 +369,7 @@ function setup-mcad-env {
echo "Waiting for pod in the kube-system namespace to be ready to become ready"
while [[ $(kubectl get pods -n kube-system -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' | tr ' ' '\n' | sort -u) != "True" ]]
do
echo -n "." && sleep 1;
echo -n "." && sleep 1;
done
}

Expand Down Expand Up @@ -451,15 +451,15 @@ function kuttl-tests {
then
echo "Failed to delete quotasubtrees for test: '${kuttl_test}'"
exit 1
fi
fi
undeploy_mcad_helm
done
rm -f kubeconfig
}

trap cleanup EXIT
update_test_host
check-prerequisites
check-prerequisites
kind-up-cluster
extend-resources
setup-mcad-env
Expand Down