VMware vSphere Integrated Containers provider (#206)

* 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
This commit is contained in:
Loc Nguyen
2018-06-04 15:41:32 -07:00
committed by Ria Bhatia
parent 98a111e8b7
commit 513cebe7b7
6296 changed files with 1123685 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
# 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
FROM longevity-base
ENV GOVC_URL=bart.eng.vmware.com
ENV TEST_URL_ARRAY=bart.eng.vmware.com
ENV STATIC_VCH_OPTIONS="--insecure-registry=vic-executor1.vcna.io --public-network-ip 10.17.109.6/24 --public-network-gateway 10.17.109.253 --dns-server 10.118.81.1"

View File

@@ -0,0 +1,23 @@
# 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
FROM longevity-base
ENV GOVC_URL=10.133.146.15
ENV TEST_URL_ARRAY=10.133.146.15
ENV GOVC_DATASTORE=CPBU_2TB_01
ENV TEST_DATASTORE=CPBU_2TB_01
ENV BRIDGE_NETWORK=vxw-dvs-3444-virtualwire-1-sid-5000-VCH-LS-1
ENV PUBLIC_NETWORK=DPortGroup
ENV TEST_DATACENTER=/Datacenter
ENV STATIC_VCH_OPTIONS="--insecure-registry=vic-executor1.vcna.io --public-network-ip 10.197.37.210/23 --public-network-gateway 10.197.37.253 --dns-server 10.142.7.21"

View File

@@ -0,0 +1,25 @@
# 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
FROM gcr.io/eminent-nation-87317/vic-integration-test:1.44
RUN mkdir -p /go/src/github.com/vmware/vic
COPY secrets /go/src/github.com/vmware/vic
ENV LONGEVITY=1
ENV GOVC_INSECURE=1
ENV GOVC_USERNAME=administrator@vsphere.local
ENV TEST_USERNAME=administrator@vsphere.local
ENV TEST_TIMEOUT=3m
ENV TEST_RESOURCE=Cluster
ENV DOMAIN=
ENV DOCKER_API_VERSION=1.23

View File

@@ -0,0 +1,44 @@
# 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
if [ $# -ne 1 ]; then
echo "Usage: $0 harbor-version"
exit 1
fi
version=$1
[ -e harbor ] \
&& echo "harbor exists. Delete it if you want to install a newer version and re-run $0" \
&& pushd harbor && docker-compose start && popd && exit 0
echo "Pulling down version ${version} of Harbor..."
wget https://github.com/vmware/harbor/releases/download/v${version}/harbor-online-installer-v${version}.tgz -qO - | tar xz
echo "Configuring Harbor"
sed -i 's/hostname = reg.mydomain.com/hostname = vic-executor1.vcna.io/g' harbor/harbor.cfg
echo "Installing & starting Harbor"
sudo ./harbor/install.sh
echo "Preparing Harbor..."
echo "Logging in..."
docker login vic-executor1.vcna.io --username=admin --password="Harbor12345"
echo "Pulling some images to put in Harbor and putting them in Harbor.."
pushd tests/resources
for image in $(python -c "vars=__import__('dynamic-vars'); print(\" \".join(vars.images))"); do
docker pull $image
docker tag $image vic-executor1.vcna.io/library/${image}
docker push vic-executor1.vcna.io/library/${image}
done
popd

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Copyright 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.
cd ~/vic
git clean -fd
git fetch https://github.com/vmware/vic master
git pull
cp ~/secrets .
tests/longevity-tests/run-longevity.bash $1
id=`docker ps -lq`
echo $id
docker logs -f $id
docker cp $id:/tmp $id
tar -cvzf $id.tar.gz $id
gsutil cp $id.tar.gz gs://vic-longevity-results/
echo $id
rc=`docker inspect --format='{{.State.ExitCode}}' $id`
exit $rc

View File

@@ -0,0 +1,128 @@
# 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"

View File

@@ -0,0 +1,20 @@
# Copyright 2017 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
export DRONE_TOKEN=
export GITHUB_AUTOMATION_API_KEY=
export SLACK_URL=
export TEST_PASSWORD=
export GOVC_PASSWORD=