Skip to content

Commit fbbf29a

Browse files
committed
Refactor to use Beokay
Beokay is a tool for creating production kayobe environments. It provides a clear source tree with a simple python script. This change primarily moves the source code and python virtual environments into a new ~/deployment directory, and separates each source code directory (Kayobe, Kayobe-Config, Kolla-Ansible, Tenks).
1 parent 2fdda6e commit fbbf29a

File tree

6 files changed

+77
-89
lines changed

6 files changed

+77
-89
lines changed

README.rst

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,19 @@ or ``ssh ubuntu@<ip>``).
106106
# Start at home.
107107
cd
108108
109-
# Clone Kayobe.
110-
git clone https://opendev.org/openstack/kayobe.git -b master
111-
cd kayobe
109+
# Clone Beokay.
110+
git clone https://github.com/stackhpc/beokay.git -b master
112111
113-
# Clone the Tenks repository.
114-
git clone https://opendev.org/openstack/tenks.git
112+
# Use Beokay to bootstrap your control host.
113+
[[ -d deployment ]] || beokay/beokay.py create --base-path ~/deployment --kayobe-repo https://opendev.org/openstack/kayobe.git --kayobe-branch master --kayobe-config-repo https://github.com/stackhpc/a-universe-from-nothing.git --kayobe-config-branch master
115114
116-
# Clone this Kayobe configuration.
117-
mkdir -p config/src
118-
cd config/src/
119-
git clone https://github.com/stackhpc/a-universe-from-nothing.git kayobe-config -b master
115+
# Clone the Tenks repository.
116+
cd ~/deployment/src
117+
[[ -d tenks ]] || git clone https://opendev.org/openstack/tenks.git
118+
cd
120119
121120
# Configure host networking (bridge, routes & firewall)
122-
./kayobe-config/configure-local-networking.sh
123-
124-
# Install kayobe.
125-
cd ~/kayobe
126-
./dev/install-dev.sh
121+
~/deployment/src/kayobe-config/configure-local-networking.sh
127122
128123
Deploying a Seed
129124
----------------
@@ -135,14 +130,9 @@ necessary `Preparation`_.
135130

136131
.. code-block:: console
137132
138-
cd ~/kayobe
139-
140-
# Activate the Kayobe environment, to allow running commands directly.
141-
source ~/kayobe-venv/bin/activate
142-
source config/src/kayobe-config/kayobe-env
143-
144-
# Bootstrap the Ansible control host.
145-
kayobe control host bootstrap
133+
# If you have not done so already, activate the Kayobe environment, to allow
134+
# running commands directly.
135+
source ~/deployment/env-vars.sh
146136
147137
# Configure the seed hypervisor host.
148138
kayobe seed hypervisor host configure
@@ -154,14 +144,14 @@ necessary `Preparation`_.
154144
kayobe seed host configure
155145
156146
# Pull, retag images, then push to our local registry.
157-
./config/src/kayobe-config/pull-retag-push-images.sh
147+
~/deployment/src/kayobe-config/pull-retag-push-images.sh
158148
159149
# Deploy the seed services.
160150
kayobe seed service deploy
161151
162152
# Deploying the seed restarts networking interface,
163153
# run configure-local-networking.sh again to re-add routes.
164-
./config/src/kayobe-config/configure-local-networking.sh
154+
~/deployment/src/kayobe-config/configure-local-networking.sh
165155
166156
# Optional: Shutdown the seed VM if creating a seed snapshot.
167157
sudo virsh shutdown seed
@@ -193,11 +183,8 @@ Otherwise, continue working with the instance from `Deploying a Seed`_.
193183
# Optional: start a new tmux session in case we lose our connection.
194184
tmux
195185
196-
# Set working directory
197-
cd ~/kayobe
198-
199186
# Configure non-persistent networking, if the node has rebooted.
200-
./config/src/kayobe-config/configure-local-networking.sh
187+
~/deployment/src/kayobe-config/configure-local-networking.sh
201188
202189
Make sure that the seed VM (running Bifrost and supporting services)
203190
is present and running.
@@ -216,12 +203,16 @@ our model development environment, alongside the seed VM.
216203

217204
.. code-block:: console
218205
219-
# NOTE: Make sure to use ./tenks, since just ‘tenks’ will install via PyPI.
220-
export TENKS_CONFIG_PATH=config/src/kayobe-config/tenks.yml
221-
./dev/tenks-deploy-overcloud.sh ./tenks
206+
# Set Environment variables for Kayobe dev scripts
207+
export KAYOBE_CONFIG_SOURCE_PATH=~/deployment/src/kayobe-config
208+
export KAYOBE_VENV_PATH=~/deployment/venvs/kayobe
209+
export TENKS_CONFIG_PATH=~/deployment/src/kayobe-config/tenks.yml
210+
211+
# Use tenks to deploy the overcloud machines
212+
~/deployment/src/kayobe/dev/tenks-deploy-overcloud.sh ~/deployment/src/tenks
222213
223214
# Activate the Kayobe environment, to allow running commands directly.
224-
source dev/environment-setup.sh
215+
source ~/deployment/env-vars.sh
225216
226217
# Inspect and provision the overcloud hardware:
227218
kayobe overcloud inventory discover
@@ -237,7 +228,7 @@ Configure and deploy OpenStack to the control plane
237228
kayobe overcloud host configure
238229
kayobe overcloud container image pull
239230
kayobe overcloud service deploy
240-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
231+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
241232
kayobe overcloud post configure
242233
243234
At this point it should be possible to access the Horizon GUI via the
@@ -251,15 +242,15 @@ VM:
251242

252243
.. code-block:: console
253244
254-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
255-
./config/src/kayobe-config/init-runonce.sh
245+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
246+
~/deployment/src/kayobe-config/init-runonce.sh
256247
257248
Following the instructions displayed by the above script, boot a VM.
258-
You'll need to have activated the `~/os-venv` virtual environment.
249+
You'll need to have activated the `~/deployment/venvs/os-venv` virtual environment.
259250

260251
.. code-block:: console
261252
262-
source ~/os-venv/bin/activate
253+
source ~/deployment/venvs/os-venv/bin/activate
263254
openstack server create --image cirros \
264255
--flavor m1.tiny \
265256
--key-name mykey \
@@ -275,7 +266,7 @@ You'll need to have activated the `~/os-venv` virtual environment.
275266
276267
# If the ssh command above fails you may need to reconfigure the local
277268
networking setup again:
278-
~/kayobe/config/src/kayobe-config/configure-local-networking.sh
269+
~/deployment/src/kayobe-config/configure-local-networking.sh
279270
280271
*Note*: when accessing the VNC console of an instance via Horizon,
281272
you will be sent to the internal IP address of the controller,
@@ -387,7 +378,7 @@ all OpenStack service logging. **Be cautious as OpenSearch will consume a
387378
significant portion of available resources on a standard deployment.**
388379

389380
To enable the service, one flag must be changed in
390-
``~/kayobe/config/src/kayobe-config/etc/kayobe/kolla.yml``:
381+
``~/deployment/src/kayobe-config/etc/kayobe/kolla.yml``:
391382

392383
.. code-block:: diff
393384
@@ -403,7 +394,7 @@ the seed VM. Pull, retag and push the centralised logging images:
403394

404395
.. code-block:: console
405396
406-
~/kayobe/config/src/kayobe-config/pull-retag-push-images.sh ^opensearch
397+
~/deployment/src/kayobe-config/pull-retag-push-images.sh ^opensearch
407398
408399
To deploy the logging stack:
409400

@@ -435,7 +426,7 @@ public interface to the OpenSearch Dashboards service running on our
435426
``controller0`` VM.
436427

437428
The easiest way to do this is to add OpenSearch Dashboards's default port (5601) to our
438-
``configure-local-networking.sh`` script in ``~/kayobe/config/src/kayobe-config/``:
429+
``configure-local-networking.sh`` script in ``~/deployment/src/kayobe-config/``:
439430

440431
.. code-block:: diff
441432
@@ -452,7 +443,7 @@ Then rerun the script to apply the change:
452443

453444
.. code-block:: console
454445
455-
config/src/kayobe-config/configure-local-networking.sh
446+
~/deployment/src/kayobe-config/configure-local-networking.sh
456447
457448
We can now connect to OpenSearch Dashboards using our hypervisor host public IP and port 5601.
458449

@@ -462,7 +453,7 @@ but they are not here).
462453

463454
.. code-block:: console
464455
465-
grep opensearch_dashboards config/src/kayobe-config/etc/kolla/passwords.yml
456+
grep opensearch_dashboards ~/deployment/src/kayobe-config/etc/kolla/passwords.yml
466457
467458
Once you're in, OpenSearch Dashboards needs some further setup which is not automated.
468459
Set the log index to ``flog-*`` and you should be ready to go.
@@ -475,7 +466,7 @@ secret management service. It is an example of a simple service we
475466
can use to illustrate the process of adding new services to our deployment.
476467

477468
As with the Logging service above, enable Barbican by modifying the flag in
478-
``~/kayobe/config/src/kayobe-config/etc/kayobe/kolla.yml`` as follows:
469+
``~/deployment/src/kayobe-config/etc/kayobe/kolla.yml`` as follows:
479470

480471
.. code-block:: diff
481472
@@ -487,15 +478,14 @@ containers. Pull down barbican images:
487478

488479
.. code-block:: console
489480
490-
~/kayobe/config/src/kayobe-config/pull-retag-push-images.sh barbican
481+
~/deployment/src/kayobe-config/pull-retag-push-images.sh barbican
491482
492483
To deploy the Barbican service:
493484

494485
.. code-block:: console
495486
496487
# Activate the venv if not already active
497-
cd ~/kayobe
498-
source dev/environment-setup.sh
488+
source ~/deployment/env-vars.sh
499489
500490
kayobe overcloud container image pull
501491
kayobe overcloud service deploy
@@ -510,13 +500,13 @@ OpenStack venv:
510500
deactivate
511501
512502
# Activate the OpenStack venv
513-
. ~/os-venv/bin/activate
503+
~/deployment/venvs/os-venv/bin/activate
514504
515505
# Install barbicanclient
516506
pip install python-barbicanclient -c https://releases.openstack.org/constraints/upper/master
517507
518508
# Source the OpenStack environment variables
519-
source ~/kayobe/config/src/kayobe-config/etc/kolla/public-openrc.sh
509+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
520510
521511
# Store a test secret
522512
openstack secret store --name mysecret --payload foo=bar

a-universe-from-nothing.sh

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,21 @@ echo 'Defaults !fqdn' | sudo tee /etc/sudoers.d/no-fqdn
2828
# Start at home.
2929
cd
3030

31-
# Clone Kayobe.
32-
[[ -d kayobe ]] || git clone https://opendev.org/openstack/kayobe.git -b master
33-
cd kayobe
31+
# Clone Beokay.
32+
[[ -d beokay ]] || git clone https://github.com/stackhpc/beokay.git -b master
33+
34+
# Use Beokay to bootstrap your control host.
35+
[[ -d deployment ]] || beokay/beokay.py create --base-path ~/deployment --kayobe-repo https://opendev.org/openstack/kayobe.git --kayobe-branch master --kayobe-config-repo https://github.com/stackhpc/a-universe-from-nothing.git --kayobe-config-branch master
3436

3537
# Clone the Tenks repository.
38+
cd ~/deployment/src
3639
[[ -d tenks ]] || git clone https://opendev.org/openstack/tenks.git
3740

38-
# Clone this Kayobe configuration.
39-
mkdir -p config/src
40-
cd config/src/
41-
[[ -d kayobe-config ]] || git clone https://github.com/stackhpc/a-universe-from-nothing.git -b master kayobe-config
42-
4341
# Configure host networking (bridge, routes & firewall)
4442
./kayobe-config/configure-local-networking.sh
4543

46-
# Install kayobe.
47-
cd ~/kayobe
48-
./dev/install-dev.sh
49-
50-
# Activate the Kayobe environment, to allow running commands directly.
51-
# NOTE: Virtualenv's activate script references an unbound variable.
52-
set +u
53-
source ~/kayobe-venv/bin/activate
54-
set -u
55-
source config/src/kayobe-config/kayobe-env
56-
57-
# Bootstrap the Ansible control host.
58-
kayobe control host bootstrap
44+
# Use the kayobe virtual environment, and export kayobe environment variables
45+
source ~/deployment/env-vars.sh
5946

6047
# Configure the seed hypervisor host.
6148
kayobe seed hypervisor host configure
@@ -67,18 +54,22 @@ kayobe seed vm provision
6754
kayobe seed host configure
6855

6956
# Pull, retag images, then push to our local registry.
70-
./config/src/kayobe-config/pull-retag-push-images.sh
57+
~/deployment/src/kayobe-config/pull-retag-push-images.sh
7158

7259
# Deploy the seed services.
7360
kayobe seed service deploy
7461

7562
# Deploying the seed restarts networking interface,
7663
# run configure-local-networking.sh again to re-add routes.
77-
./config/src/kayobe-config/configure-local-networking.sh
64+
~/deployment/src/kayobe-config/configure-local-networking.sh
65+
66+
# Set Environment variables for Kayobe dev scripts
67+
export KAYOBE_CONFIG_SOURCE_PATH=~/deployment/src/kayobe-config
68+
export KAYOBE_VENV_PATH=~/deployment/venvs/kayobe
69+
export TENKS_CONFIG_PATH=~/deployment/src/kayobe-config/tenks.yml
7870

79-
# NOTE: Make sure to use ./tenks, since just ‘tenks’ will install via PyPI.
80-
export TENKS_CONFIG_PATH=config/src/kayobe-config/tenks.yml
81-
./dev/tenks-deploy-overcloud.sh ./tenks
71+
# Deploy overcloud using Tenks
72+
~/deployment/src/kayobe/dev/tenks-deploy-overcloud.sh ~/deployment/src/tenks
8273

8374
# Inspect and provision the overcloud hardware:
8475
kayobe overcloud inventory discover
@@ -88,7 +79,7 @@ kayobe overcloud provision
8879
kayobe overcloud host configure
8980
kayobe overcloud container image pull
9081
kayobe overcloud service deploy
91-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
82+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
9283
kayobe overcloud post configure
93-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
94-
./config/src/kayobe-config/init-runonce.sh
84+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
85+
~/deployment/src/kayobe-config/init-runonce.sh

etc/kayobe/ansible/pull-retag-push.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
- import_playbook: ../../../../../../ansible/kolla-build.yml
2+
- name: Run the Kayobe kolla-build.yml playbook
3+
import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/kolla-build.yml"
34

45
- name: Pull, retag, and push images
56
hosts: container-image-builders

etc/kayobe/kolla/config/bifrost/bifrost.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ create_ipa_image: false
44
download_ipa: true
55

66
# Use a locally hosted cloud image.
7-
use_cirros: true
7+
download_custom_deploy_image: true
88
{% if os_distribution == 'centos' %}
9-
cirros_deploy_image_upstream_url: "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20221206.0.x86_64.qcow2"
9+
custom_deploy_image_upstream_url: "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20221206.0.x86_64.qcow2"
10+
custom_deploy_image_checksum_url: "https://cloud.centos.org/centos/9-stream/x86_64/images/CHECKSUM"
11+
custom_deploy_image_checksum_algorithm: "sha256"
1012
{% elif os_distribution == 'rocky' %}
1113
# NOTE(priteau): Temporarily using Rocky Linux 9.3 because 9.4 images fail to
1214
# boot (https://bugs.rockylinux.org/view.php?id=6832)
13-
cirros_deploy_image_upstream_url: "https://dl.rockylinux.org/vault/rocky/9.3/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2"
15+
custom_deploy_image_upstream_url: "https://dl.rockylinux.org/vault/rocky/9.3/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2"
16+
custom_deploy_image_checksum_url: "https://dl.rockylinux.org/vault/rocky/9.3/images/x86_64/CHECKSUM"
17+
custom_deploy_image_checksum_algorithm: "sha256"
1418
{% else %}
15-
cirros_deploy_image_upstream_url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
19+
custom_deploy_image_upstream_url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
20+
custom_deploy_image_checksum_url: "https://cloud-images.ubuntu.com/jammy/current/SHA256SUMS"
21+
custom_deploy_image_checksum_algorithm: "sha256"
1622
{% endif %}

init-runonce.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
set -e
44

5-
if [[ ! -d ~/os-venv ]]; then
6-
/usr/bin/python3 -m venv ~/os-venv
5+
if [[ ! -d ~/deployment/venvs/os-venv ]]; then
6+
/usr/bin/python3 -m venv ~/deployment/venvs/os-venv
77
fi
8-
~/os-venv/bin/pip install -U pip
9-
~/os-venv/bin/pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/master
8+
~/deployment/venvs/os-venv/bin/pip install -U pip
9+
~/deployment/venvs/os-venv/bin/pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/master
1010

1111
parent="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1212
init_runonce=$parent/../kolla-ansible/tools/init-runonce
@@ -15,5 +15,5 @@ if [[ ! -f $init_runonce ]]; then
1515
exit 1
1616
fi
1717

18-
source ~/os-venv/bin/activate
18+
source ~/deployment/venvs/os-venv/bin/activate
1919
$init_runonce

pull-retag-push-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ fi
1515
shift $#
1616

1717
cd ${KAYOBE_PATH}
18-
source dev/environment-setup.sh
18+
source ~/deployment/env-vars.sh
1919
kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/pull-retag-push.yml ${KAYOBE_EXTRA_ARGS:+"$KAYOBE_EXTRA_ARGS"}

0 commit comments

Comments
 (0)