-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: Add scripts to handler ovn-k cluster
Signed-off-by: Enrique Llorente <[email protected]>
- Loading branch information
Showing
3 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ go.work | |
*.swp | ||
*.swo | ||
*~ | ||
|
||
.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
|
||
OUTPUT_DIR=${OUTPUT_DIR:-${SCRIPT_DIR}/../.output} | ||
|
||
OVN_KUBERNETES_REPO="${OVN_KUBERNETES_REPO:-https://github.com/ovn-org/ovn-kubernetes}" | ||
OVN_KUBERNETES_BRANCH="${OVN_KUBERNETES_BRANCH:-master}" | ||
OVN_KUBERNETES_DIR=${OUTPUT_DIR}/ovn-kubernetes | ||
|
||
# from https://github.com/kubernetes-sigs/kind/releases | ||
KIND_BIN=${OUTPUT_DIR}/kind | ||
|
||
export KUBECONFIG=${OUTPUT_DIR}/kubeconfig | ||
|
||
cluster_name=kubevirt-ipamclaims | ||
op=$1 | ||
shift | ||
|
||
function ensure_ovn_kubernetes() { | ||
if [ -d "${OVN_KUBERNETES_DIR}" ]; then | ||
return 0 | ||
fi | ||
( | ||
cd ${OUTPUT_DIR} | ||
git clone --single-branch ${OVN_KUBERNETES_REPO} -b ${OVN_KUBERNETES_BRANCH} | ||
) | ||
} | ||
|
||
function ensure_kind() { | ||
if [ -f ${KIND_BIN} ]; then | ||
return 0 | ||
fi | ||
local kind_version=v0.20.0 | ||
local arch="" | ||
case $(uname -m) in | ||
x86_64) arch="amd64";; | ||
aarch64) arch="arm64" ;; | ||
esac | ||
local kind_url=https://kind.sigs.k8s.io/dl/$kind_version/kind-linux-${arch} | ||
curl --retry 5 -Lo ${KIND_BIN} ${kind_url} | ||
chmod +x ${KIND_BIN} | ||
} | ||
|
||
function up() { | ||
mkdir -p ${OUTPUT_DIR} | ||
ensure_ovn_kubernetes | ||
ensure_kind | ||
kind delete cluster --name $cluster_name | ||
( | ||
cd ${OVN_KUBERNETES_DIR} | ||
./contrib/kind.sh --local-kind-registry -ic -ikv -i6 -mne -cn ${cluster_name} | ||
) | ||
} | ||
|
||
function down() { | ||
ensure_kind | ||
${KIND_BIN} delete cluster --name ${cluster_name} | ||
echo "down" | ||
} | ||
|
||
function sync() { | ||
local img=localhost:5000/kubevirt-ipam-controller | ||
local tag=latest | ||
IMG=$img:$tag make \ | ||
build \ | ||
docker-build \ | ||
docker-push | ||
|
||
# Generate the manifest with the "sha256" to force kubernetes to reload the image | ||
sha=$(skopeo inspect --tls-verify=false docker://$img:$tag |jq -r .Digest) | ||
INSTALLER_PATH=${OUTPUT_DIR}/installer.yaml IMG=$img@$sha make build-installer | ||
kubectl apply -f ${OUTPUT_DIR}/install.yaml | ||
} | ||
|
||
|
||
|
||
$op $@ |