diff --git a/local.conf b/local.conf index d001ed4..9c4d8d1 100644 --- a/local.conf +++ b/local.conf @@ -1,7 +1,8 @@ [[local|localrc]] enable_plugin barbican https://review.openstack.org/openstack/barbican $BARBICAN_PATCH enable_plugin octavia https://review.openstack.org/openstack/octavia $OCTAVIA_PATCH -LIBS_FROM_GIT+=python-octaviaclient +LIBS_FROM_GIT+=python-octaviaclient,octavia-lib +OCTAVIA_LIB_REPO=https://review.opendev.org/openstack/octavia-lib HOST_IP=127.0.0.1 diff --git a/profile b/profile index ea3a09c..e071173 100644 --- a/profile +++ b/profile @@ -12,8 +12,10 @@ export BARBICAN_ENDPOINT="http://localhost:9311" # Set some utility variables PROJECT_ID=$(openstack token issue | awk '/ project_id / {print $4}') export PROJECT_ID="${PROJECT_ID:0:8}-${PROJECT_ID:8:4}-${PROJECT_ID:12:4}-${PROJECT_ID:16:4}-${PROJECT_ID:20}" -export DEFAULT_NETWORK=$(openstack subnet list | awk '/ private-subnet / {print $2}') -export DEFAULT_NETWORK_IPV6=$(openstack subnet list | awk '/ ipv6-private-subnet / {print $2}') +export PRIVATE_SUBNET=$(openstack subnet list | awk '/ private-subnet / {print $2}') +export PRIVATE_SUBNET_IPV6=$(openstack subnet list | awk '/ ipv6-private-subnet / {print $2}') +export PUBLIC_SUBNET=$(openstack subnet list | awk '/ public-subnet / {print $2}') +export PUBLIC_SUBNET_IPV6=$(openstack subnet list | awk '/ ipv6-public-subnet / {print $2}') # Make pretty-printing json easy alias json="python -mjson.tool" @@ -21,6 +23,14 @@ alias json="python -mjson.tool" # Make sshing to amps easy alias ossh="ssh -i /etc/octavia/.ssh/octavia_ssh_key -l ubuntu" +# Other aliases for quality of life +alias oslb='openstack loadbalancer' +alias oss='openstack server' +alias gs='git status' +alias gd='git diff' +alias gp='git pull' +alias gl='git log --stat' + # Run this to generate nova VMs as a test backend function gen_backend() { ssh-keygen -f /opt/stack/.ssh/id_rsa -t rsa -N '' -q @@ -33,8 +43,8 @@ function gen_backend() { openstack security group rule create --protocol tcp --dst-port 22 --ethertype IPv6 --remote-ip ::/0 member openstack security group rule create --protocol tcp --dst-port 80 --ethertype IPv6 --remote-ip ::/0 member PRIVATE_NETWORK=$(openstack network list | awk '/ private / {print $2}') - openstack server create --image cirros-0.3.5-x86_64-disk --flavor 2 --nic net-id=$PRIVATE_NETWORK member1 --security-group member --key-name default - openstack server create --image cirros-0.3.5-x86_64-disk --flavor 2 --nic net-id=$PRIVATE_NETWORK member2 --security-group member --key-name default --wait + openstack server create --image cirros-0.4.0-x86_64-disk --flavor m1.tiny --nic net-id=$PRIVATE_NETWORK member1 --security-group member --key-name default + openstack server create --image cirros-0.4.0-x86_64-disk --flavor m1.tiny --nic net-id=$PRIVATE_NETWORK member2 --security-group member --key-name default --wait sleep 15 if [ -z "$MEMBER1_IP" ]; then export MEMBER1_IP=$(openstack server show member1 | awk '/ addresses / {a = substr($4, 9, length($4)-9); if (a ~ "\\.") print a; else print $5}') @@ -68,17 +78,24 @@ function wait_for_status() { # Create a LB with Octavia function create_lb() { - openstack loadbalancer create --name lb1 --vip-subnet $DEFAULT_NETWORK + openstack loadbalancer create --name lb1 --vip-subnet $PUBLIC_SUBNET wait_for_status openstack loadbalancer show lb1 } function create_lb_ipv6() { - openstack loadbalancer create --name lb1 --vip-subnet $DEFAULT_NETWORK_IPV6 + openstack loadbalancer create --name lb1 --vip-subnet $PUBLIC_SUBNET_IPV6 wait_for_status openstack loadbalancer show lb1 } +function create_lb_addvip() { + TOKEN=$(openstack token issue -f value -c id) + OCTAVIA_BASE_URL=$(openstack endpoint list --service octavia --interface public -c URL -f value) + curl -s -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -d "{\"loadbalancer\": {\"vip_subnet_id\": \"${PUBLIC_SUBNET}\", \"name\": \"lb1\", \"additional_vips\": [{\"subnet_id\": \"${PUBLIC_SUBNET_IPV6}\"}]}}" ${OCTAVIA_BASE_URL}/v2.0/lbaas/loadbalancers | jq + wait_for_status +} + # Create a Listener with Octavia function create_listener() { openstack loadbalancer listener create --protocol TERMINATED_HTTPS --protocol-port 443 --name listener1 --default-tls-container-ref $DEFAULT_TLS_CONTAINER lb1 @@ -130,3 +147,4 @@ function create_full() { echo "Done!" } +source ~/.bashrc diff --git a/stackme.sh b/stackme.sh index 54f6dd9..fece86f 100755 --- a/stackme.sh +++ b/stackme.sh @@ -1,20 +1,16 @@ #!/bin/bash -OCTAVIA_PATCH="" -OCTAVIA_CLIENT_PATCH="" +OCTAVIA_PATCH="refs/changes/39/660239/46" +OCTAVIA_LIB_PATCH="refs/changes/10/664510/2" +OCTAVIA_CLIENT_PATCH="refs/changes/73/664473/4" BARBICAN_PATCH="" # Quick sanity check (should be run on Ubuntu 16.04 and MUST be run as root directly) -if [ `lsb_release -rs` != "16.04" ] +if [ `lsb_release -rs` != "18.04" ] then - echo -n "Warning: This script is only tested against Ubuntu xenial. Press to continue at your own risk... " + echo -n "Warning: This script is only tested against Ubuntu bionic. Press to continue at your own risk... " read fi -if [ `whoami` != "root" -o -n "$SUDO_COMMAND" ] -then - echo "This script must be run as root, and not using 'sudo'!" - exit 1 -fi # Set up the packages we need apt-get update @@ -28,9 +24,6 @@ wget -O - https://raw.githubusercontent.com/rm-you/devstack_deploy/master/local. # Create the stack user /tmp/devstack/tools/create-stack-user.sh -# Apparently the group for libvirt changed to libvirtd in parallels? -usermod -a -G libvirtd stack - # Move everything into place mv /tmp/devstack /opt/stack/ chown -R stack:stack /opt/stack/devstack/ @@ -40,8 +33,9 @@ cat >>/opt/stack/.profile <