Merge ~hypothetical-lemon/stsstack-bundles:octavia-ipv4 into stsstack-bundles:master

Proposed by Heather Lemon
Status: Merged
Merged at revision: 9ee6fb094b6104e1f963db09477732709d1baf92
Proposed branch: ~hypothetical-lemon/stsstack-bundles:octavia-ipv4
Merge into: stsstack-bundles:master
Diff against target: 109 lines (+63/-5)
4 files modified
openstack/pipeline/00setup (+2/-0)
openstack/pipeline/02configure (+20/-5)
openstack/tools/create_ipv4_octavia.sh (+37/-0)
overlays/octavia-ipv4.yaml (+4/-0)
Reviewer Review Type Date Requested Status
Edward Hope-Morley Approve
Review via email: mp+392056@code.launchpad.net

Description of the change

Add script with IPv4 support for Octavia

Currently, by default Octavia deploys with IPv6 network.
This script sets up Openstack with Octavia running with IPv4.
Wait for services to start, creates a novarc.services file.
Pulls out the password from the Octavia container.
Sources the octavia credentials to create the IPv4 network from
Octavia and not Admin credentials. Creates network, routers, subnet,
and security groups for Octavia network. Runs various tools for preperation
of deploying a loadbalancer. Deploys a loadbalancer to a private subnet
with create_octavia_lb.sh

Add new overlay option to deployment bundles: --octavia-ipv4
Used in conjunction with --octavia overlay option. Example openstack bundle option:
./generate-bundle.sh --octavia --octavia-ipv4 --create-model --name octavia --series focal --use-stable-charms --run

Turns off the create network option in octavia.yaml before deployment of bundle

To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote :

Hi Heather thanks for this really useful contribution. I am going to give it a test run for myself and have a few initial comment for you inline.

review: Needs Fixing
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Ok sounds good. Thanks

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Hi Heather, looks way better. I had to rebase your branch off master to get it to work as the MOD_MSG parsing wasn't in your branch. Can you please do 'git rebase -i master' to rebase and squash into a single commit. Couple of inline comments too. Thanks!

review: Needs Fixing
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

> Hi Heather, looks way better. I had to rebase your branch off master to get it
> to work as the MOD_MSG parsing wasn't in your branch. Can you please do 'git
> rebase -i master' to rebase and squash into a single commit. Couple of inline
> comments too. Thanks!

Yeah sure no worries. I wasn't sure if I had to do anything else for everyone to see my updated changes or not.

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Fixed spaces, addressed comments, rebased from master

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Thank Heather few more things. When you rebase master make sure to update your master branch first.

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Ok so moved all output messages under --octavia option.

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

this command works with proper post op commands to follow
./generate-bundle.sh --octavia-ipv4 --create-model --name octavia --series focal --use-stable-charms

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

add common command ./sec_groups.sh
combined message for octavia and octavia-ipv4

Revision history for this message
Edward Hope-Morley (hopem) wrote :

lgtm thanks Heather!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/openstack/pipeline/00setup b/openstack/pipeline/00setup
2index 807a275..12138b3 100644
3--- a/openstack/pipeline/00setup
4+++ b/openstack/pipeline/00setup
5@@ -14,6 +14,8 @@ export -a MOD_PASSTHROUGH_OPTS=()
6 export -A MOD_MSGS=()
7 # Use order 0 to ensure this is first displayed
8 MOD_MSGS[0_common.0]="run ./configure to initialise your deployment"
9+MOD_MSGS[0_common.1]="source novarc"
10+MOD_MSGS[0_common.2]="add rules to default security group: ./tools/sec_groups.sh"
11
12 # Array list of overlays to use with this deployment.
13 export -a MOD_OVERLAYS=()
14diff --git a/openstack/pipeline/02configure b/openstack/pipeline/02configure
15index 338cd5e..a10fd12 100644
16--- a/openstack/pipeline/02configure
17+++ b/openstack/pipeline/02configure
18@@ -332,18 +332,33 @@ do
19 if ! has_opt --octavia-diskimage-retrofit-glance-simplestreams; then
20 MOD_OVERLAYS+=( "octavia-diskimage-retrofit-glance.yaml" )
21 fi
22- MOD_MSGS[octavia.0]="you need to to create an amphora image before you can use Octavia"
23- MOD_MSGS[octavia.1]="this can be done in one of two ways:"
24- MOD_MSGS[octavia.2]="run ./tools/upload_octavia_amphora_image.sh to use a pre-created image (recommended)"
25- MOD_MSGS[octavia.3]="create a new image with 'juju run-action octavia-diskimage-retrofit/0 --wait retrofit-image source-image=<uuid>' with id of image in Glance to use as base"
26- MOD_MSGS[octavia.4]="then run tools/configure_octavia.sh to finish setting up octavia"
27 fi
28+ MOD_MSGS[octavia.0]="you need to to create an amphora image before you can use Octavia"
29+ MOD_MSGS[octavia.1]="this can be done in one of two ways:"
30+ MOD_MSGS[octavia.2]="run ./tools/upload_octavia_amphora_image.sh --release $release to use a pre-created image (recommended)"
31+ MOD_MSGS[octavia.3]="create a new image with 'juju run-action octavia-diskimage-retrofit/0 --wait retrofit-image source-image=<uuid>' with id of image in Glance to use as base"
32+ if has_opt --octavia-ipv4; then
33+ MOD_MSGS[octavia.4]="run tools/create_ipv4_octavia.sh"
34+ fi
35+ MOD_MSGS[octavia.5]="then run tools/configure_octavia.sh to finish setting up octavia"
36+ MOD_MSGS[octavia.6]="create vm for testing"
37+ MOD_MSGS[octavia.7]="./tools/instance_launch.sh 1 bionic"
38+ MOD_MSGS[octavia.8]="add floating ip to vm with ./tools/float_all.sh "
39+ MOD_MSGS[octavia.9]="go and install e.g. apache2 on vm so that port 80 is open"
40+ MOD_MSGS[octavia.10]="create loadbalancer from script"
41+ MOD_MSGS[octavia.11]="./tools/create_octavia_lb.sh"
42+ MOD_MSGS[octavia.12]="alternatively manually create loadbalancer"
43+ MOD_MSGS[octavia.13]="openstack loadbalancer create --name lb2 --vip-network-id lb-mgmt"
44 ;;
45 --octavia-ha*)
46 get_units $1 __NUM_OCTAVIA_UNITS__ 3
47 MOD_OVERLAYS+=( "octavia-ha.yaml" )
48 set -- $@ --octavia && cache $@
49 ;;
50+ --octavia-ipv4)
51+ MOD_OVERLAYS+=( "octavia-ipv4.yaml" )
52+ set -- $@ --octavia && cache $@
53+ ;;
54 --octavia-diskimage-retrofit-glance-simplestreams)
55 conflicts_with $1 --no-octavia-diskimage-retrofit
56 set -- $@ --glance-simplestreams && cache $@
57diff --git a/openstack/tools/create_ipv4_octavia.sh b/openstack/tools/create_ipv4_octavia.sh
58new file mode 100755
59index 0000000..c151abd
60--- /dev/null
61+++ b/openstack/tools/create_ipv4_octavia.sh
62@@ -0,0 +1,37 @@
63+#!/bin/bash
64+
65+# wait for services start
66+while true; do
67+ [[ `juju status keystone --format json | jq -r '.applications.keystone.units."keystone/0"."workload-status".current'` = active ]] \
68+ && break
69+ if [[ `juju status keystone --format json | jq -r '.applications.keystone.units."keystone/0"."workload-status".current'` = error ]]
70+ then
71+ echo "ERROR: Octavia deployment failed"
72+ break
73+ fi
74+done
75+
76+echo INFO: create temp novarc.services and extract octavia password
77+touch /tmp/novarc.services
78+
79+cat << EOF > /tmp/novarc.services
80+OS_PROJECT_DOMAIN_NAME=service_domain
81+OS_USERNAME=octavia
82+OS_PROJECT_NAME=services
83+OS_USER_DOMAIN_NAME=service_domain
84+OS_PASSWORD=$(juju run --unit octavia/0 "grep -v "auth" /etc/octavia/octavia.conf | grep password" | awk '{print $3}')
85+EOF
86+source /tmp/novarc.services
87+
88+echo INFO: create octavia network, subnet, router, add subnet to router
89+openstack network create lb-mgmt-net --tag charm-octavia
90+openstack subnet create --tag charm-octavia --subnet-range 21.0.0.0/29 --dhcp --ip-version 4 --network lb-mgmt-net lb-mgmt-subnet
91+openstack router create lb-mgmt --tag charm-octavia
92+openstack router add subnet lb-mgmt lb-mgmt-subnet
93+
94+echo INFO: add security rules
95+openstack security group create lb-mgmt-sec-grp --tag charm-octavia
96+openstack security group create lb-health-mgr-sec-grp --tag charm-octavia-health
97+openstack security group rule create lb-mgmt-sec-grp --protocol icmp
98+openstack security group rule create lb-mgmt-sec-grp --protocol tcp --protocol tcp --dst-port 22
99+openstack security group rule create lb-mgmt-sec-grp --protocol tcp --dst-port 9443
100diff --git a/overlays/octavia-ipv4.yaml b/overlays/octavia-ipv4.yaml
101new file mode 100644
102index 0000000..655107f
103--- /dev/null
104+++ b/overlays/octavia-ipv4.yaml
105@@ -0,0 +1,4 @@
106+applications:
107+ octavia:
108+ options:
109+ create-mgmt-network: false

Subscribers

People subscribed via source and target branches