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,89 @@
Test 9-01 - VIC Admin ShowHTML
=======
# Purpose:
To verify that the VIC Administration appliance can display HTML
# Environment:
This test requires that a vSphere environment be running and available
# Test Steps:
1. Deploy VIC appliance to the vSphere server
2. Pull the VICadmin web page and verify that it contains valid HTML
3. Pull the Portlayer log file and verify that it contains valid data
4. Pull the VCH-Init log and verify that it contains valid data
5. Pull the Docker Personality log and verify that it contains valid data
6. Create a container via the appliance
7. Pull the container log bundle from the appliance and verify that it contains the new container's logs
# Expected Outcomes:
* VICadmin should display a web page that at a minimum includes <title>VIC Admin</title>
* VICadmin responds with a log file indicating that the portlayer sever has started
* VICadmin responds with a log file indicating VCH init has begun reaping processes
* VICadmin responds with log file indicating docker personality service has started
* VICadmin responds with a ZIP file containing at a minimum the vmware.log file from the new container
# Unauthenticated Test Cases
## Get Login Page
1. Access the authentication web page
## While Logged Out Fail To Display HTML
1. Required authentication on restricted pages
2. Page requests authentication
## While Logged Out Fail To Get Portlayer Log
1. Portlayer logs are restricted to authenticated users
2. Page requests authentication
## While Logged Out Fail To Get VCH-Init Log
1. VCH_Init logs are restricted to authenticated users
2. Page requests authentication
## While Logged Out Fail To Get Docker Personality Log
1. Personality logs are restricted to authenticated users
2. Page requests authentication
## While Logged Out Fail To Get Container Logs
1. Container logs are restricted to authenticated users
2. Page requests authentication
## While Logged Out Fail To Get VICAdmin Log
1. VICAdmin logs are restricted to authenticated users
2. Page requests authentication
# Authenticated Test Cases
## Display HTML
1. Log in
2. Page displays vic-machine name in title
## Get Portlayer Log
1. Log in
2. Portlayer Log access is allowed and logs are downloaded
## Get VCH-Init Log
1. Log in
2. VCH-Init Log access is allowed and logs are downloaded
## Get Docker Personality Log
1. Log in
2. Docker Personality Log access is allowed and logs are downloaded
## Get Container Logs
1. Log in
2. Container Log access is allowed and logs are downloaded
## Get VICAdmin Log
1. Log in
2. VICAdmin Log access is allowed and logs are downloaded
## Check that VIC logs do not contain sensitive data
1. Log in
2. Fetch all logs in /logs/ path
3. None of the downloaded logs contain the vch or vSphere password
## Wan Routes Through Proxy
1. Start a vch with a proxy defined at a localhost port. The proxy isn't actually running, so all requests will fail. IF the wan requests fail we know they were routed through the proxy.
2. Log in to VICAdmin
3. Verify wan health check is not successful.

View File

@@ -0,0 +1,134 @@
# Copyright 2016-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
*** Settings ***
Documentation Test 9-01 - VICAdmin ShowHTML
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server certs=${false}
Suite Teardown Cleanup VIC Appliance On Test Server
Default Tags
*** Keywords ***
Login And Save Cookies
[Tags] secret
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/authentication -XPOST -F username=%{TEST_USERNAME} -F password=%{TEST_PASSWORD} -D /tmp/cookies-%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
*** Test Cases ***
Get Login Page
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/authentication
Should contain ${output} <title>VCH Admin</title>
While Logged Out Fail To Display HTML
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}
Should not contain ${output} <title>VIC: %{VCH-NAME}</title>
Should Contain ${output} <a href="/authentication">See Other</a>.
While Logged Out Fail To Get Portlayer Log
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/port-layer.log
Should Not Contain ${output} Launching portlayer server
Should Contain ${output} <a href="/authentication">See Other</a>.
While Logged Out Fail To Get VCH-Init Log
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/init.log
Should not contain ${output} reaping child processes
Should Contain ${output} <a href="/authentication">See Other</a>.
While Logged Out Fail To Get Docker Personality Log
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/docker-personality.log
Should not contain ${output} docker personality
Should Contain ${output} <a href="/authentication">See Other</a>.
While Logged Out Fail To Get Container Logs
${rc} ${output}= Run And Return Rc and Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${container}= Run And Return Rc and Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${container} Error
${rc} ${output}= Run And Return Rc and Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/container-logs.tar.gz | tar tvzf -
Should not Be Equal As Integers ${rc} 0
Should Contain ${output} gzip: stdin: not in gzip format
Log ${output}
Should not Contain ${output} ${container}/vmware.log
Should not Contain ${output} ${container}/tether.debug
While Logged Out Fail To Get VICAdmin Log
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/vicadmin.log
Log ${output}
Should not contain ${output} Launching vicadmin pprof server
Should Contain ${output} <a href="/authentication">See Other</a>.
Display HTML
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN} -b /tmp/cookies-%{VCH-NAME}
Should contain ${output} <title>VIC: %{VCH-NAME}</title>
Get Portlayer Log
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/port-layer.log -b /tmp/cookies-%{VCH-NAME}
Should contain ${output} Launching portlayer server
Get VCH-Init Log
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/init.log -b /tmp/cookies-%{VCH-NAME}
Should contain ${output} reaping child processes
Get Docker Personality Log
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/docker-personality.log -b /tmp/cookies-%{VCH-NAME}
Should contain ${output} docker personality
Get Container Logs
Login And Save Cookies
${rc} ${output}= Run And Return Rc and Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${container}= Run And Return Rc and Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${container} Error
${rc} ${output}= Run And Return Rc and Output docker %{VCH-PARAMS} start ${container}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${vmName}= Get VM Display Name ${container}
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/container-logs.tar.gz -b /tmp/cookies-%{VCH-NAME} | (cd /tmp; tar xvzf - ${vmName}/tether.debug ${vmName}/vmware.log)
Log ${output}
${rc} ${output}= Run And Return Rc and Output ls -l /tmp/${vmName}/vmware.log
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc and Output ls -l /tmp/${vmName}/tether.debug
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc and Output grep 'prepping for switch to container filesystem' /tmp/${vmName}/tether.debug
Should Be Equal As Integers ${rc} 0
Run rm -f /tmp/${vmName}/tether.debug /tmp/${vmName}/vmware.log
Get VICAdmin Log
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN}/logs/vicadmin.log -b /tmp/cookies-%{VCH-NAME}
Log ${output}
Should contain ${output} Launching vicadmin pprof server
Check that VIC logs do not contain sensitive data
Scrape Logs For The Password
Wan Routes Through Proxy
Cleanup VIC Appliance On Test Server
Install VIC Appliance To Test Server certs=${false} additional-args=--http-proxy=http://0.0.0.0:12345
Login And Save Cookies
${rc} ${output}= Run And Return Rc And Output curl -sk %{VIC-ADMIN} -b /tmp/cookies-%{VCH-NAME}
Should contain ${output} <div class="sixty">Registry and Internet Connectivity<span class="error-message">

View File

@@ -0,0 +1,91 @@
# Copyright 2016-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
*** Settings ***
Documentation Test 9-02 - VICAdmin CertAuth
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server certs=${true}
Suite Teardown Cleanup VIC Appliance On Test Server
Default Tags
*** Keywords ***
Skip Execution If Certs Not Available
${status}= Run Keyword And Return Status Environment Variable Should Not Be Set DOCKER_CERT_PATH
Pass Execution If ${status} This test is only applicable if using TLS with certs
Curl
[Arguments] ${path}
${output}= Run curl -sk --cert %{DOCKER_CERT_PATH}/cert.pem --key %{DOCKER_CERT_PATH}/key.pem %{VIC-ADMIN}${path}
Should Not Be Equal As Strings '' ${output}
[Return] ${output}
*** Test Cases ***
Display HTML
Skip Execution If Certs Not Available
${output}= Wait Until Keyword Succeeds 10x 10s Curl ${EMPTY}
Should contain ${output} <title>VIC: %{VCH-NAME}</title>
Get Portlayer Log
Skip Execution If Certs Not Available
${output}= Wait Until Keyword Succeeds 10x 10s Curl /logs/port-layer.log
Should contain ${output} Launching portlayer server
Get VCH-Init Log
Skip Execution If Certs Not Available
${output}= Wait Until Keyword Succeeds 10x 10s Curl /logs/init.log
Should contain ${output} reaping child processes
Get Docker Personality Log
Skip Execution If Certs Not Available
${output}= Wait Until Keyword Succeeds 10x 10s Curl /logs/docker-personality.log
Should contain ${output} docker personality
Get VICAdmin Log
Skip Execution If Certs Not Available
${output}= Wait Until Keyword Succeeds 10x 10s Curl /logs/vicadmin.log
Log ${output}
Should contain ${output} Launching vicadmin pprof server
Fail to Get VICAdmin Log without cert
Skip Execution If Certs Not Available
${output}= Run curl -sk %{VIC-ADMIN}/logs/vicadmin.log
Log ${output}
Should Not contain ${output} Launching vicadmin pprof server
Fail to Display HTML without cert
Skip Execution If Certs Not Available
${output}= Run curl -sk %{VIC-ADMIN}
Log ${output}
Should Not contain ${output} <title>VCH %{VCH-NAME}</title>
Fail to get Portlayer Log without cert
Skip Execution If Certs Not Available
${output}= Run curl -sk %{VIC-ADMIN}/logs/port-layer.log
Log ${output}
Should Not contain ${output} Launching portlayer server
Fail to get Docker Personality Log without cert
Skip Execution If Certs Not Available
${output}= Run curl -sk %{VIC-ADMIN}/logs/docker-personality.log
Log ${output}
Should Not contain ${output} docker personality
Fail to get VCH init logs without cert
Skip Execution If Certs Not Available
${output}= Run curl -sk %{VIC-ADMIN}/logs/init.log
Log ${output}
Should Not contain ${output} reaping child processes
Check that VIC logs do not contain sensitive data
Scrape Logs For The Password

View File

@@ -0,0 +1,53 @@
# Copyright 2016-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
*** Settings ***
Documentation Test 9-03 - VICAdmin Log Failed Attempts
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Verify Unable To Verify
${out}= Run wget --tries=3 --connect-timeout=10 %{VIC-ADMIN}/logs/vicadmin.log -O failure.log
Should Contain ${out} ERROR: cannot verify
Should Contain ${out} certificate, issued by
Should Contain ${out} Unable to locally verify the issuer's authority.
Verify Temporary Redirect
${out}= Run wget --tries=3 --connect-timeout=10 --no-check-certificate %{VIC-ADMIN}/logs/vicadmin.log -O failure.log
Should Contain ${out} HTTP request sent, awaiting response... 303 See Other
Verify Failed Log Attempts
${status}= Run Keyword And Return Status Environment Variable Should Not Be Set DOCKER_CERT_PATH
Pass Execution If ${status} This test is only applicable if using TLS with certs
#Save the first appliance certs and cleanup the first appliance
#${old-certs}= Set Variable %{DOCKER_CERT_PATH}
Run cp -r %{DOCKER_CERT_PATH} old-certs
Cleanup VIC Appliance On Test Server
#Install a second appliance
Install VIC Appliance To Test Server
OperatingSystem.File Should Exist old-certs/cert.pem
OperatingSystem.File Should Exist old-certs/key.pem
${out}= Run wget -v --tries=3 --connect-timeout=10 --certificate=old-certs/cert.pem --private-key=old-certs/key.pem --no-check-certificate %{VIC-ADMIN}/logs/vicadmin.log -O failure.log
Log ${out}
${out}= Run wget -v --tries=3 --connect-timeout=10 --certificate=%{DOCKER_CERT_PATH}/cert.pem --private-key=%{DOCKER_CERT_PATH}/key.pem --no-check-certificate %{VIC-ADMIN}/logs/vicadmin.log -O success.log
Log ${out}
${out}= Run cat success.log
Log ${out}
${out}= Run grep -i fail success.log
Should Contain ${out} tls: failed to verify client's certificate: x509: certificate signed by unknown authority
Run rm -r old-certs

View File

@@ -0,0 +1,5 @@
Group 9 - VIC Admin
=======
[Test 9-01 - VICAdmin ShowHTML](9-01-VICAdmin-ShowHTML.md)