Switch to devstack-plugin-container

Change-Id: Ib59e665dfb9a1fb69216e49ff9020e18c3ab92c3
This commit is contained in:
Hongbin Lu 2017-04-17 17:11:20 -04:00
parent 80864fb96d
commit 73ead98af1
5 changed files with 6 additions and 55 deletions

View File

@ -74,7 +74,6 @@ else
ZUN_BIN_DIR=$(get_python_exec_prefix) ZUN_BIN_DIR=$(get_python_exec_prefix)
fi fi
DOCKER_GROUP=${DOCKER_GROUP:-docker}
DOCKER_REMOTE_API_PORT=2375 DOCKER_REMOTE_API_PORT=2375
ZUN_DRIVER=${ZUN_DRIVER:-docker} ZUN_DRIVER=${ZUN_DRIVER:-docker}
ZUN_DB_TYPE=${ZUN_DB_TYPE:-sql} ZUN_DB_TYPE=${ZUN_DB_TYPE:-sql}
@ -117,56 +116,6 @@ function _config_zun_apache_wsgi {
" -i $zun_apache_conf " -i $zun_apache_conf
} }
function check_docker {
if is_ubuntu; then
dpkg -s docker-engine > /dev/null 2>&1 || dpkg -s docker-ce > /dev/null 2>&1
else
rpm -q docker-engine > /dev/null 2>&1 || rpm -q docker > /dev/null 2>&1 || rpm -q docker-ce > /dev/null 2>&1
fi
}
function install_docker {
check_docker || curl -fsSL https://get.docker.com/ | sudo sh
echo "Adding ${STACK_USER} to ${docker_group}..."
add_user_to_group $STACK_USER $DOCKER_GROUP
echo "Adding $(whoami) to ${DOCKER_GROUP}..."
add_user_to_group $(whoami) $DOCKER_GROUP
if is_fedora; then
install_package socat dnsmasq
fi
if is_ubuntu && [ $UBUNTU_RELEASE_BASE_NUM -le 14 ]; then
sudo sed -i '/^#DOCKER_OPTS/cDOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:'$(echo $DOCKER_REMOTE_API_PORT)'"' /etc/default/docker
sudo service docker restart || true
else
if is_ubuntu; then
sudo sed -i '/^ExecStart=/cExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:'$(echo $DOCKER_REMOTE_API_PORT)'' /lib/systemd/system/docker.service
else
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo sh -c "cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:$DOCKER_REMOTE_API_PORT
EOF"
fi
sudo systemctl daemon-reload
sudo systemctl restart docker
fi
# We put the stack user as owner of the socket so we do not need to
# run the Docker commands with sudo when developing.
local docker_socket_file=/var/run/docker.sock
echo -n "Waiting for Docker to create its socket file"
while [ ! -e "$docker_socket_file" ]; do
echo -n "."
sleep 1
done
echo ""
sudo chown "$STACK_USER":docker "$docker_socket_file"
}
# Test if any zun services are enabled # Test if any zun services are enabled
# is_zun_enabled # is_zun_enabled
function is_zun_enabled { function is_zun_enabled {
@ -214,8 +163,8 @@ function configure_zun {
# upload_sandbox_image() - Upload sandbox image to glance # upload_sandbox_image() - Upload sandbox image to glance
function upload_sandbox_image { function upload_sandbox_image {
if [[ ${ZUN_DRIVER} == "docker" || ${ZUN_DRIVER} == "nova-docker" ]]; then if [[ ${ZUN_DRIVER} == "docker" || ${ZUN_DRIVER} == "nova-docker" ]]; then
sg docker "docker pull kubernetes/pause" sudo docker pull kubernetes/pause
sg docker "docker save kubernetes/pause" | openstack image create kubernetes/pause --public --container-format docker --disk-format raw sudo docker save kubernetes/pause | openstack image create kubernetes/pause --public --container-format docker --disk-format raw
fi fi
} }
@ -439,7 +388,7 @@ function start_zun_api {
function start_zun_compute { function start_zun_compute {
echo "Start zun compute..." echo "Start zun compute..."
if [[ ${ZUN_DRIVER} == "docker" || ${ZUN_DRIVER} == "nova-docker" ]]; then if [[ ${ZUN_DRIVER} == "docker" || ${ZUN_DRIVER} == "nova-docker" ]]; then
run_process zun-compute "$ZUN_BIN_DIR/zun-compute" ${DOCKER_GROUP} run_process zun-compute "$ZUN_BIN_DIR/zun-compute"
else else
run_process zun-compute "$ZUN_BIN_DIR/zun-compute" run_process zun-compute "$ZUN_BIN_DIR/zun-compute"
fi fi

View File

@ -5,6 +5,7 @@ SERVICE_TOKEN=password
SERVICE_PASSWORD=password SERVICE_PASSWORD=password
ADMIN_PASSWORD=password ADMIN_PASSWORD=password
enable_plugin zun https://git.openstack.org/openstack/zun enable_plugin zun https://git.openstack.org/openstack/zun
enable_plugin devstack-plugin-container https://git.openstack.org/openstack/devstack-plugin-container
KURYR_ETCD_PORT=2379 KURYR_ETCD_PORT=2379
enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork

View File

@ -12,7 +12,6 @@ source $DEST/zun/devstack/lib/nova
if is_service_enabled zun-api zun-compute; then if is_service_enabled zun-api zun-compute; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing zun" echo_summary "Installing zun"
install_docker
install_zun install_zun
LIBS_FROM_GIT="${LIBS_FROM_GIT},python-zunclient" LIBS_FROM_GIT="${LIBS_FROM_GIT},python-zunclient"

View File

@ -36,6 +36,7 @@ required OpenStack services::
SERVICE_TOKEN=password SERVICE_TOKEN=password
SERVICE_PASSWORD=password SERVICE_PASSWORD=password
ADMIN_PASSWORD=password ADMIN_PASSWORD=password
enable_plugin devstack-plugin-container https://git.openstack.org/openstack/devstack-plugin-container
enable_plugin zun https://git.openstack.org/openstack/zun enable_plugin zun https://git.openstack.org/openstack/zun
enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork

View File

@ -22,6 +22,7 @@ driver=$1
db=$2 db=$2
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork" export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin kuryr-libnetwork https://git.openstack.org/openstack/kuryr-libnetwork"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin devstack-plugin-container https://git.openstack.org/openstack/devstack-plugin-container"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"ZUN_USE_MOD_WSGI=True" export DEVSTACK_LOCAL_CONFIG+=$'\n'"ZUN_USE_MOD_WSGI=True"
if [ "$driver" = "docker" ]; then if [ "$driver" = "docker" ]; then