diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 41261bf3b..65090c5e5 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -83,6 +83,22 @@ function configure_kuryr { fi } +function configure_neutron_defaults { + local project_id=$(get_or_create_project \ + "$KURYR_NEUTRON_DEFAULT_PROJECT" default) + local pod_subnet_id=$(neutron subnet-show -c id -f value \ + "$KURYR_NEUTRON_DEFAULT_POD_SUBNET") + local sg_ids=$(echo $(neutron security-group-list \ + --project-id "$project_id" -c id -f value) | tr ' ' ',') + + iniset "$KURYR_CONFIG" neutron_defaults project "$project_id" + iniset "$KURYR_CONFIG" neutron_defaults pod_subnet "$pod_subnet_id" + iniset "$KURYR_CONFIG" neutron_defaults pod_security_groups "$sg_ids" + if [ -n "$OVS_BRIDGE" ]; then + iniset "$KURYR_CONFIG" neutron_defaults ovs_bridge "$OVS_BRIDGE" + fi +} + function check_docker { if is_ubuntu; then dpkg -s docker-engine > /dev/null 2>&1 @@ -345,6 +361,7 @@ if is_service_enabled kuryr-kubernetes; then fi if [[ "$1" == "stack" && "$2" == "extra" ]]; then + configure_neutron_defaults # FIXME(limao): When Kuryr start up, it need to detect if neutron # support tag plugin. # diff --git a/devstack/settings b/devstack/settings index 2b5b5e344..e776ef2da 100644 --- a/devstack/settings +++ b/devstack/settings @@ -12,6 +12,10 @@ KURYR_POOL_PREFIX_LEN=${KURYR_POOL_PREFIX_LEN:-24} KURYR_DOCKER_ENGINE_PORT=${KURYR_DOCKER_ENGINE_PORT:-2375} KURYR_DOCKER_ENGINE_SOCKET_FILE=${KURYR_DOCKER_ENGINE_SOCKET_FILE:-/var/run/docker.sock} +# Neutron defaults +KURYR_NEUTRON_DEFAULT_PROJECT=demo +KURYR_NEUTRON_DEFAULT_POD_SUBNET=${PRIVATE_SUBNET_NAME} + # Etcd KURYR_ETCD_IMAGE=${KURYR_ETCD_IMAGE:-quay.io/coreos/etcd} KURYR_ETCD_VERSION=${KURYR_ETCD_VERSION:-v3.0.8}