Add devstack support for multi-node deployment

Enables devstack to deploy worker node only.
Adds sample worker node local.conf.

Closes-Bug: 1706576
Change-Id: I05cd13e59f6cf087a980fda0de2a5c5944fa30b9
This commit is contained in:
Irena Berezovsky 2017-07-31 08:57:50 +03:00
parent 3cba3eb009
commit 8ac1d192c4
2 changed files with 167 additions and 83 deletions

View File

@ -0,0 +1,73 @@
[[local|localrc]]
enable_plugin kuryr-kubernetes \
https://git.openstack.org/openstack/kuryr-kubernetes
RECLONE="no"
# Log settings for better readability
LOGFILE=devstack.log
LOG_COLOR=False
# Credentials
ADMIN_PASSWORD=pass
DATABASE_PASSWORD=pass
RABBIT_PASSWORD=pass
SERVICE_PASSWORD=pass
SERVICE_TOKEN=pass
# Enable Keystone v3
IDENTITY_API_VERSION=3
# In pro of speed and being lightweight, we will be explicit in regards to
# which services we enable
ENABLED_SERVICES=""
SERVICE_HOST=CONTROLLER_IP
MULTI_HOST=1
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
# For Baremetal deployment, enable SDN agent that should run on worker node
# enable_service q-agt
# Docker
# ======
# If you already have docker configured, running and with its socket writable
# by the stack user, you can omit the following line.
enable_plugin devstack-plugin-container https://git.openstack.org/openstack/devstack-plugin-container
# Kubernetes
# ==========
#
# We use hyperkube to run the services. You can select the hyperkube image and/
# or version by uncommenting and setting the following ENV vars different
# to the following defaults:
# KURYR_HYPERKUBE_IMAGE="gcr.io/google_containers/hyperkube-amd64"
# KURYR_HYPERKUBE_VERSION="v1.6.2"
#
# We are reusing an existing deployment on master, you should uncomment and
# set an ENV var so that the Kubelet devstack runs can find the API server:
# KURYR_K8S_API_URL="http (or https, if K8S is SSL/TLS enabled)://k8s_api_ip:k8s_api_port"
#
# Set neutron service subnet id/name
# KURYR_NEUTRON_DEFAULT_SERVICE_SUBNET=k8s-service-subnet
#
# For overcloud deployment uncomment this line
# KURYR_CONFIGURE_BAREMETAL_KUBELET_IFACE=False
# Kubelet
# =======
#
# Kubelet should almost invariably be run by devstack
enable_service kubelet
# You can specify a different location for the hyperkube binary that will be
# extracted from the hyperkube container into the Host filesystem:
# KURYR_HYPERKUBE_BINARY=/usr/local/bin/hyperkube
#
# NOTE: KURYR_HYPERKUBE_IMAGE, KURYR_HYPERKUBE_VERSION also affect which
# the selected binary for the Kubelet.

View File

@ -341,7 +341,7 @@ function run_k8s_scheduler {
function prepare_kubeconfig {
$KURYR_HYPERKUBE_BINARY kubectl config set-cluster devstack-cluster \
--server=http://localhost:8080
--server="${KURYR_K8S_API_URL}"
$KURYR_HYPERKUBE_BINARY kubectl config set-context devstack \
--cluster=devstack-cluster
$KURYR_HYPERKUBE_BINARY kubectl config use-context devstack
@ -433,7 +433,6 @@ function run_kuryr_kubernetes {
source $DEST/kuryr-kubernetes/devstack/lib/kuryr_kubernetes
# main loop
if is_service_enabled kuryr-kubernetes; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
setup_develop "$KURYR_HOME"
if is_service_enabled kubelet; then
@ -441,15 +440,19 @@ if is_service_enabled kuryr-kubernetes; then
fi
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
if is_service_enabled kuryr-kubernetes; then
create_kuryr_account
fi
configure_kuryr
fi
if [[ "$1" == "stack" && "$2" == "extra" ]]; then
if is_service_enabled kuryr-kubernetes; then
KURYR_CONFIGURE_NEUTRON_DEFAULTS=$(trueorfalse True KURYR_CONFIGURE_NEUTRON_DEFAULTS)
if [ "$KURYR_CONFIGURE_NEUTRON_DEFAULTS" == "True" ]; then
configure_neutron_defaults
fi
fi
# FIXME(limao): When Kuryr start up, it need to detect if neutron
# support tag plugin.
#
@ -477,9 +480,11 @@ if is_service_enabled kuryr-kubernetes; then
if is_service_enabled kubernetes-api; then
run_k8s_api
fi
if is_service_enabled kubernetes-controller-manager; then
run_k8s_controller_manager
fi
if is_service_enabled kubernetes-scheduler; then
run_k8s_scheduler
fi
@ -493,20 +498,29 @@ if is_service_enabled kuryr-kubernetes; then
if [[ "$KURYR_CONFIGURE_BAREMETAL_KUBELET_IFACE" == "True" ]]; then
ovs_bind_for_kubelet "$KURYR_NEUTRON_DEFAULT_PROJECT"
fi
fi
if is_service_enabled tempest; then
copy_tempest_kubeconfig
fi
if is_service_enabled kuryr-kubernetes; then
run_kuryr_kubernetes
fi
run_kuryr_kubernetes
elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
if is_service_enabled kuryr-kubernetes; then
create_k8s_router_fake_service
create_k8s_api_service
fi
fi
if [[ "$1" == "unstack" ]]; then
if is_service_enabled kuryr-kubernetes; then
stop_process kuryr-kubernetes
elif is_service_enabled kubelet; then
$KURYR_HYPERKUBE_BINARY kubectl delete nodes ${HOSTNAME}
fi
docker kill devstack-k8s-setup-files
docker rm devstack-k8s-setup-files
@ -525,8 +539,6 @@ if is_service_enabled kuryr-kubernetes; then
if is_service_enabled legacy_etcd; then
stop_container etcd
fi
stop_docker
fi
if [[ "$1" == "clean" ]]; then
@ -535,4 +547,3 @@ if is_service_enabled kuryr-kubernetes; then
sudo rm -rf "$KURYR_ETCD_DATA_DIR"
fi
fi
fi