zun/devstack/plugin.sh
Hongbin Lu 3438316954 Implement the sandbox proposal - Part 2
This commit extends the existing Docker driver to leverage Nova
to provision sandbox. In other words, there are two drivers:
1. docker.driver.DockerDriver (default)
2. docker.driver.NovaDockerDriver
Users can choose which driver they want to use. The major
difference is the second driver integrate with Neutron, Neutron
is used to provide networking for container.

The files under nova/* were copied from nova-docker with minor
modification (mainly for fixing bugs and removing unused codes).
In particular, nova/virt/docker/driver.py contains a DockerDriver
for Nova. It implements the Nova virt driver interface using docker.
This custom virt driver is used to create/delete/manage sandbox
containers.

At this commit, we hardcoded the flavor to m1.small and nics to
'auto' when creating sandbox instances. We might make them as
parameters and specified by end-users. The flavor will decide the
resource constraints of the container and nics will decide how the
networking of the container being configured. The docker image
kubernetes/pause is chosen to be the image of the sandbox container,
since its size is small and statisfies what we want (an empty
container that keeps running).

When creating the sandbox, we haven't specify the security group yet
so the default security group is used. Users need to open ports in
that security groups to access container from outside. Later, we
could create a custom security group for each container, and
automatically open ports that are exposed by the container.

For more details of the design, please refer:
https://review.openstack.org/#/c/365754/

Implements: blueprint neutron-integration
Depends-On: Ib8f193ea1edf1f148e9ba505205495170ebf6d67
Change-Id: I1543f386b6439d305b308d6c6ebe073225223c25
2016-11-21 20:48:36 -06:00

56 lines
1.2 KiB
Bash
Executable File

# zun - Devstack extras script to install zun
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set -o xtrace
echo_summary "zun's plugin.sh was called..."
source $DEST/zun/devstack/lib/zun
source $DEST/zun/devstack/lib/nova
(set -o posix; set)
if is_service_enabled zun-api zun-compute; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing zun"
install_docker
install_zun
LIBS_FROM_GIT="${LIBS_FROM_GIT},python-zunclient"
install_zunclient
cleanup_zun
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring zun"
configure_zun
if is_service_enabled key; then
create_zun_accounts
fi
if [[ ${ZUN_DRIVER} == "nova-docker" ]]; then
configure_nova_docker
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize zun
init_zun
# Start the zun API and zun compute
echo_summary "Starting zun"
start_zun
upload_sandbox_image
fi
if [[ "$1" == "unstack" ]]; then
stop_zun
fi
if [[ "$1" == "clean" ]]; then
cleanup_zun
fi
fi
# Restore xtrace
$XTRACE