* Add Virtual Kubelet provider for VIC Initial virtual kubelet provider for VMware VIC. This provider currently handles creating and starting of a pod VM via the VIC portlayer and persona server. Image store handling via the VIC persona server. This provider currently requires the feature/wolfpack branch of VIC. * Added pod stop and delete. Also added node capacity. Added the ability to stop and delete pod VMs via VIC. Also retrieve node capacity information from the VCH. * Cleanup and readme file Some file clean up and added a Readme.md markdown file for the VIC provider. * Cleaned up errors, added function comments, moved operation code 1. Cleaned up error handling. Set standard for creating errors. 2. Added method prototype comments for all interface functions. 3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder. * Add mocking code and unit tests for podcache, podcreator, and podstarter Used the unit test framework used in VIC to handle assertions in the provider's unit test. Mocking code generated using OSS project mockery, which is compatible with the testify assertion framework. * Vendored packages for the VIC provider Requires feature/wolfpack branch of VIC and a few specific commit sha of projects used within VIC. * Implementation of POD Stopper and Deleter unit tests (#4) * Updated files for initial PR
129 lines
3.9 KiB
Bash
Executable File
129 lines
3.9 KiB
Bash
Executable File
# Copyright 2017-2018 VMware, Inc. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
while getopts ":d:s:h:" opt; do
|
|
case $opt in
|
|
s)
|
|
syslogAddress=$OPTARG
|
|
;;
|
|
h)
|
|
harborVersion=$OPTARG
|
|
;;
|
|
d)
|
|
debugLevel=$OPTARG
|
|
;;
|
|
\?)
|
|
echo "Usage: $0 [-d <debug level>] [-s <syslog endpoint>] [-h <harbor version>] target-cluster"
|
|
exit 1
|
|
;;
|
|
:)
|
|
echo "Usage: $0 [-d <debug level>] [-s <syslog endpoint>] [-h <harbor version>] target-cluster"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: $0 [-s <syslog endpoint>] [-h <harbor version>] target-cluster"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ $1 != "6.0" && $1 != "6.5" ]]; then
|
|
echo "Please specify a target cluster. One of: 6.0, 6.5"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! $(grep dns /etc/docker/daemon.json) ]]; then
|
|
echo "NOTE: /etc/docker/daemon.json should contain
|
|
{
|
|
\"dns\": [\"10.118.81.1\", \"10.16.188.210\"]
|
|
}
|
|
|
|
in order for this script to function behind VMW's firewall.
|
|
|
|
If the file does not exist, create it & restart the docker daemon before
|
|
attempting to run this script
|
|
"
|
|
exit 1
|
|
fi
|
|
|
|
target="$1"
|
|
|
|
# set an output directory
|
|
odir=$PWD"-longevity-test-output-$(date -Iminute | sed 's/:/_/g')"
|
|
|
|
|
|
# set up harbor if necessary
|
|
if [[ $(docker ps | grep harbor) == "" ]]; then
|
|
if [[ ${harborVersion} != "" ]]; then
|
|
hversion=${harborVersion}
|
|
else
|
|
hversion="1.2.0"
|
|
echo "No Harbor version specified. Using default $hversion"
|
|
fi
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
$DIR/get-and-start-harbor.bash $hversion
|
|
fi
|
|
|
|
echo "Building container images...."
|
|
pushd tests/longevity-tests
|
|
docker build -q -t longevity-base -f Dockerfile.foundation .
|
|
docker build -q -t tests-"$target" -f Dockerfile."${target}" .
|
|
popd
|
|
|
|
if [[ ${debugLevel} != "" ]]; then
|
|
debugVchLevel="${debugLevel}"
|
|
else
|
|
debugVchLevel="1"
|
|
fi
|
|
|
|
if [[ ${syslogAddress} != "" ]]; then
|
|
syslogVchOption="--syslog-address ${syslogAddress}"
|
|
fi
|
|
|
|
input=$(gsutil ls -l gs://vic-engine-builds/vic_* | grep -v TOTAL | sort -k2 -r | head -n1 | xargs | cut -d ' ' -f 3 | cut -d '/' -f 4)
|
|
echo "Downloading VIC build $input..."
|
|
rm -rf bin
|
|
mkdir -p bin
|
|
wget -P bin https://storage.googleapis.com/vic-engine-builds/$input -qO - | tar xz -C bin
|
|
mv bin/vic/* bin
|
|
rmdir bin/vic
|
|
|
|
echo "Creating container..."
|
|
testsContainer=$(docker create --rm -it\
|
|
-w /go/src/github.com/vmware/vic/ \
|
|
-v "$odir":/tmp/ -e SYSLOG_VCH_OPTION="${syslogVchOption}" -e DEBUG_VCH_LEVEL="${debugVchLevel}" \
|
|
tests-"$target" \
|
|
bash -c \
|
|
". secrets && pybot -d /tmp/ /go/src/github.com/vmware/vic/tests/manual-test-cases/Group14-Longevity/14-1-Longevity.robot; rc=$?;\
|
|
mv *-container-logs.zip /tmp/ 2>/dev/null; \
|
|
mv VCH-*-vmware.log /tmp/ 2>/dev/null; \
|
|
mv vic-machine.log /tmp/ 2>/dev/null; \
|
|
mv index.html* /tmp/ 2>/dev/null; \
|
|
mv VCH-* /tmp/ 2>/dev/null; \
|
|
exit $rc")
|
|
|
|
echo "Copying code and binaries into container...."
|
|
cd ..
|
|
docker cp vic $testsContainer:/go/src/github.com/vmware/
|
|
|
|
echo "Running tests.."
|
|
echo "Run docker attach $testsContainer to interact with the container or use docker logs -f to simply view test output as the tests run"
|
|
docker start $testsContainer
|
|
|
|
echo "Output can be found in $odir"
|