Permalink
Browse files

Added VIRTLET_DEMO_BRANCH

Use VIRTLET_DEMO_BRANCH to select branch in demo.sh
Use VIRTLET_DEMO_RELEASE to select virtlet release in demo.sh
  • Loading branch information...
pigmej committed Sep 29, 2017
1 parent 7f5ff37 commit ca5401e9d85fac24f1a572cb6fcdeb6411ebead4
Showing with 28 additions and 8 deletions.
  1. +1 −2 .circleci/config.yml
  2. +25 −4 deploy/demo.sh
  3. +2 −2 test.sh
@@ -136,12 +136,11 @@ e2e: &e2e
export CNI_PLUGIN=calico
echo >&2 "*** Using Calico CNI"
fi
VIRTLET_DEMO_RELEASE=master \
SKIP_SNAPSHOT=1 \
NONINTERACTIVE=1 \
NO_VM_CONSOLE=1 \
INJECT_LOCAL_IMAGE=1 \
VIRTLET_DEMO_RELEASE=master \
VIRTLET_DEMO_BRANCH=master \
BASE_LOCATION="$PWD" \
deploy/demo.sh
- run:
@@ -13,6 +13,7 @@ kubectl="${HOME}/.kubeadm-dind-cluster/kubectl"
BASE_LOCATION="${BASE_LOCATION:-https://raw.githubusercontent.com/Mirantis/virtlet/master/}"
RELEASE_LOCATION="${RELEASE_LOCATION:-https://github.com/Mirantis/virtlet/releases/download/}"
VIRTLET_DEMO_RELEASE="${VIRTLET_DEMO_RELEASE:-}"
VIRTLET_DEMO_BRANCH="${VIRTLET_DEMO_BRANCH:-}"
VIRTLET_ON_MASTER="${VIRTLET_ON_MASTER:-}"
IMAGE_REGEXP_TRANSLATION="${IMAGE_REGEXP_TRANSLATION:-1}"
# Convenience setting for local testing:
@@ -256,10 +257,18 @@ function demo::get-correct-virtlet-release {
function demo::start-virtlet {
local -a virtlet_config=(--from-literal=download_protocol=http --from-literal=image_regexp_translation="$IMAGE_REGEXP_TRANSLATION")
local ds_location
if [[ ${VIRTLET_DEMO_RELEASE} = "master" ]]; then
local replace_image_in_ds
if [[ ${VIRTLET_DEMO_BRANCH} ]]; then
if [[ ${VIRTLET_DEMO_BRANCH} = "master" ]]; then
virtlet_release="master"
virtlet_docker_tag="latest"
ds_location="${BASE_LOCATION}/deploy/virtlet-ds.yaml"
else
virtlet_release="${VIRTLET_DEMO_BRANCH}"
virtlet_docker_tag=$(echo $VIRTLET_DEMO_BRANCH | sed -e "s/\//_/g")
BASE_LOCATION="https://raw.githubusercontent.com/Mirantis/virtlet/${virtlet_release}/"
fi
ds_location="${BASE_LOCATION}/deploy/virtlet-ds.yaml"
replace_image_in_ds=1
else
if [[ ${VIRTLET_DEMO_RELEASE} ]]; then
virtlet_release="${VIRTLET_DEMO_RELEASE}"
@@ -270,6 +279,7 @@ function demo::start-virtlet {
virtlet_docker_tag="${virtlet_release}"
ds_location="${RELEASE_LOCATION}/${virtlet_release}/virtlet-ds.yaml"
BASE_LOCATION="https://raw.githubusercontent.com/Mirantis/virtlet/${virtlet_release}/"
replace_image_in_ds=0
fi
echo "Will run demo using Virtlet:${virtlet_release} for demo and ${virtlet_docker_tag} as docker tag"
if demo::kvm-ok; then
@@ -278,6 +288,7 @@ function demo::start-virtlet {
demo::step "Setting up Virtlet configuration *without* KVM support"
virtlet_config+=(--from-literal=disable_kvm=y)
fi

"${kubectl}" create configmap -n kube-system virtlet-config "${virtlet_config[@]}"
# new functionality added post 0.8.2
# that logic could be removed later
@@ -293,8 +304,18 @@ function demo::start-virtlet {
"${kubectl}" create configmap -n kube-system virtlet-image-translations --from-file "${BASE_LOCATION}/deploy/images.yaml"
fi
fi
demo::step "Deploying Virtlet DaemonSet from ${ds_location}"
"${kubectl}" create -f "${ds_location}"

if [[ "${replace_image_in_ds}" == 1 ]]; then
demo::step "Deploying Virtlet DaemonSet from ${ds_location} and will set correct docker tag: ${virtlet_docker_tag}"
if [[ ${BASE_LOCATION} == https://* ]]; then
curl --silent "${ds_location}" | sed "s/image: mirantis\/virtlet/image: mirantis\/virtlet:${virtlet_docker_tag}/g" | "${kubectl}" create -f -
else
sed "s/image: mirantis\/virtlet/image: mirantis\/virtlet:${virtlet_docker_tag}/g" "${ds_location}" | "${kubectl}" create -f -
fi
else
demo::step "Deploying Virtlet DaemonSet from ${ds_location}"
"${kubectl}" create -f "${ds_location}"
fi
demo::wait-for "Virtlet DaemonSet" demo::pods-ready runtime=virtlet
}

@@ -21,5 +21,5 @@ fi

docker build -t mirantis/virtlet .

VIRTLET_DEMO_RELEASE=master NONINTERACTIVE=1 NO_VM_CONSOLE=1 INJECT_LOCAL_IMAGE=1 BASE_LOCATION="${SCRIPT_DIR}" deploy/demo.sh
./_output/virtlet-e2e-tests -test.v
VIRTLET_DEMO_BRANCH=master NONINTERACTIVE=1 NO_VM_CONSOLE=1 INJECT_LOCAL_IMAGE=1 BASE_LOCATION="${SCRIPT_DIR}" deploy/demo.sh
# ./_output/virtlet-e2e-tests -test.v

0 comments on commit ca5401e

Please sign in to comment.