Merge ~freyes/stsstack-bundles:add-magnum into stsstack-bundles:master

Proposed by Felipe Reyes
Status: Rejected
Rejected by: Edward Hope-Morley
Proposed branch: ~freyes/stsstack-bundles:add-magnum
Merge into: stsstack-bundles:master
Diff against target: 175 lines (+83/-5)
7 files modified
openstack/pipeline/02configure (+14/-0)
openstack/profiles/common (+8/-3)
openstack/profiles/default (+16/-1)
openstack/tools/create_magnum_k8s.sh (+16/-0)
overlays/barbican.yaml (+1/-1)
overlays/magnum-ha.yaml (+10/-0)
overlays/magnum.yaml (+18/-0)
Reviewer Review Type Date Requested Status
Jolly Bundlers Pending
Review via email: mp+403649@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote :

aiui we no longer intend to support magnum so ill close this. if we want to add it in the future it will need to be targeted at github.com/canonical/stsstack-bundles/

Unmerged commits

40af299... by Felipe Reyes

Add magnum overlay.

Magnum offers container orchestration, it allows tenants to deploy
Kubernetes, Docker Swarm and Apache Mesos. It was released as tech
preview as part of the 21.04 charms release.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/openstack/pipeline/02configure b/openstack/pipeline/02configure
2index f9a8cb8..71979bb 100644
3--- a/openstack/pipeline/02configure
4+++ b/openstack/pipeline/02configure
5@@ -268,6 +268,20 @@ do
6 fi
7 MOD_MSGS[keystone-saml.0]="run ./tools/enable_samltestid.sh"
8 ;;
9+ --magnum)
10+ assert_min_release ussuri "magnum"
11+ MOD_OVERLAYS+=( "magnum.yaml" )
12+ set -- $@ --barbican && cache $@
13+ set -- $@ --heat && cache $@
14+ ;;
15+ --magnum-ha)
16+ assert_min_release ussuri "magnum-ha"
17+ get_units $1 __NUM_MAGNUM_UNITS__ 3
18+ MOD_OVERLAYS+=( "magnum-ha.yaml" )
19+ set -- $@ --magnum && cache $@
20+ set -- $@ --barbican-ha && cache $@
21+ set -- $@ --heat-ha && cache $@
22+ ;;
23 --manila)
24 assert_min_release rocky "manila"
25 MOD_OVERLAYS+=( "manila.yaml" )
26diff --git a/openstack/profiles/common b/openstack/profiles/common
27index 95486ec..9e87cc0 100644
28--- a/openstack/profiles/common
29+++ b/openstack/profiles/common
30@@ -8,14 +8,19 @@ function upload_image {
31 image_arch=${5:-"x86_64"}
32
33 case "$src" in
34- swift) http_root="http://$SWIFT_IP:80/swift/v1/images";;
35- cloudimages) http_root="http://cloud-images.ubuntu.com/${image_name}/current";;
36+ swift) http_location="http://$SWIFT_IP:80/swift/v1/images/${image_file}";;
37+ cloudimages) http_location="http://cloud-images.ubuntu.com/${image_name}/current/${image_file}";;
38+ fedora-coreos) http_location=$(curl https://builds.coreos.fedoraproject.org/streams/stable.json | jq -r '.architectures|.x86_64|.artifacts|.openstack|.formats|."qcow2.xz"|.disk|.location');;
39 esac
40
41 mkdir -vp ~/images
42
43 [ -f ~/images/$image_file ] || {
44- wget -O ~/images/$image_file ${http_root}/${image_file}
45+ wget -O ~/images/$image_file ${http_location}
46+ if [ "${http_location##*.}" == "xz" ]; then
47+ mv ~/images/$image_file ~/images/$image_file.xz
48+ unxz ~/images/$image_file.xz
49+ fi
50 }
51
52 # Downloaded images are in qcow2 format already, so we
53diff --git a/openstack/profiles/default b/openstack/profiles/default
54index a67e289..1cf5676 100755
55--- a/openstack/profiles/default
56+++ b/openstack/profiles/default
57@@ -48,6 +48,10 @@ if ((`juju status ceilometer --format=json 2>/dev/null| jq '.machines| length'`)
58 juju run-action --wait ceilometer/leader ceilometer-upgrade
59 fi
60
61+if ((`juju status magnum --format=json 2>/dev/null| jq '.machines| length'`)); then
62+ juju run-action --wait magnum/leader domain-setup
63+fi
64+
65 # Configure neutron networking on overcloud
66 source novarc
67
68@@ -76,7 +80,7 @@ set_img_properties ()
69 [version_name]="$ts"
70 [product_name]="com.ubuntu.cloud:server:${img_version}:amd64"
71 )
72- for p in ${!props[@]}; do
73+ for p in ${!props[@]}; do
74 openstack image set --property $p=${props[$p]} $img_name &
75 done
76 wait
77@@ -86,12 +90,23 @@ set_img_properties ()
78 mkdir -vp ~/images
79 upload_image cloudimages bionic bionic-server-cloudimg-amd64.img &
80 upload_image cloudimages focal focal-server-cloudimg-amd64.img &
81+
82+# magnum uses fedora-coreos to launch k8s clusters, at the moment the ubuntu
83+# image is used for Apache Mesos
84+# https://docs.openstack.org/magnum/latest/user/#clustertemplate
85+if ((`juju status magnum --format=json 2>/dev/null| jq '.machines| length'`)); then
86+ upload_image fedora-coreos fedora-coreos-latest fedora-coreos-latest-x86_64.img &
87+fi
88+
89 ${BARE_METAL:-false} || upload_image swift cirros cirros-0.4.0-x86_64-disk.img &
90 ${BARE_METAL:-false} || upload_image swift cirros2 cirros-0.3.5-x86_64-disk.img &
91 wait
92 # Set properties needed by octavia-disk-image-retrofit (See LP: #1842430)
93 set_img_properties bionic 18.04 bionic-server-cloudimg-amd64.img &
94 set_img_properties focal 20.04 focal-server-cloudimg-amd64.img &
95+if ((`juju status magnum --format=json 2>/dev/null| jq '.machines| length'`)); then
96+ openstack image set --property os_distro=fedora-coreos fedora-coreos-latest &
97+fi
98 wait
99
100 # TODO: remove fallbacks once we move to queens (they are there for clients still on ocata)
101diff --git a/openstack/tools/create_magnum_k8s.sh b/openstack/tools/create_magnum_k8s.sh
102new file mode 100644
103index 0000000..d2229a0
104--- /dev/null
105+++ b/openstack/tools/create_magnum_k8s.sh
106@@ -0,0 +1,16 @@
107+#!/bin/bash -eux
108+
109+openstack coe cluster template create k8s-cluster-template \
110+ --image fedora-coreos-latest \
111+ --keypair testkey \
112+ --external-network ext_net \
113+ --dns-nameserver 8.8.8.8 \
114+ --flavor m1.small \
115+ --docker-volume-size 5 \
116+ --network-driver flannel \
117+ --coe kubernetes
118+
119+openstack coe cluster create k8s-cluster \
120+ --cluster-template k8s-cluster-template \
121+ --master-count 1 \
122+ --node-count 2
123diff --git a/overlays/barbican.yaml b/overlays/barbican.yaml
124index 561b33a..24ecca9 100644
125--- a/overlays/barbican.yaml
126+++ b/overlays/barbican.yaml
127@@ -6,7 +6,7 @@ openstack_origin: &openstack_origin __OS_ORIGIN__
128 applications:
129 barbican:
130 charm: cs:~openstack-charmers-next/barbican
131- num_units: __NUM_BARBICAN_UNITS__
132+ num_units: __NUM_BARBICAN_UNITS__
133 constraints: mem=1G
134 options:
135 debug: *debug
136diff --git a/overlays/magnum-ha.yaml b/overlays/magnum-ha.yaml
137new file mode 100644
138index 0000000..80c8634
139--- /dev/null
140+++ b/overlays/magnum-ha.yaml
141@@ -0,0 +1,10 @@
142+applications:
143+ magnum:
144+ options:
145+ vip: __VIP__
146+ magnum-hacluster:
147+ charm: cs:~openstack-charmers-next/hacluster
148+ options:
149+ cluster_count: __NUM_MAGNUM_UNITS__
150+relations:
151+ - [ magnum, magnum-hacluster ]
152diff --git a/overlays/magnum.yaml b/overlays/magnum.yaml
153new file mode 100644
154index 0000000..239abea
155--- /dev/null
156+++ b/overlays/magnum.yaml
157@@ -0,0 +1,18 @@
158+# Variables
159+debug: &debug True
160+verbose: &verbose True
161+openstack_origin: &openstack_origin __OS_ORIGIN__
162+
163+applications:
164+ magnum:
165+ charm: cs:~openstack-charmers-next/magnum
166+ num_units: 1
167+ constraints: mem=1G
168+ options:
169+ debug: *debug
170+ openstack-origin: *openstack_origin
171+relations:
172+ - [ magnum:amqp, rabbitmq-server:amqp ]
173+ - [ magnum:shared-db, __MYSQL_INTERFACE__ ]
174+ - [ magnum:identity-service, keystone:identity-service ]
175+ - [ magnum:certificates, vault:certificates ]

Subscribers

People subscribed via source and target branches