Skip to content

Commit 157a52e

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 7189aa4 commit 157a52e

File tree

5 files changed

+67
-85
lines changed

5 files changed

+67
-85
lines changed

README.rst

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,19 @@ already logged in (e.g. ``ssh rocky@<ip>``, or ``ssh ubuntu@<ip>``).
105105
# Start at home.
106106
cd
107107
108-
# Clone Kayobe.
109-
git clone https://opendev.org/openstack/kayobe.git -b stable/2023.1
110-
cd kayobe
108+
# Clone Beokay.
109+
git clone https://github.com/stackhpc/beokay.git -b master
111110
112-
# Clone the Tenks repository.
113-
git clone https://opendev.org/openstack/tenks.git
111+
# Use Beokay to bootstrap your control host.
112+
[[ -d deployment ]] || beokay/beokay.py create --base-path ~/deployment --kayobe-repo https://opendev.org/openstack/kayobe.git --kayobe-branch stable/2023.1 --kayobe-config-repo https://github.com/stackhpc/a-universe-from-nothing.git --kayobe-config-branch stable/2023.1
114113
115-
# Clone this Kayobe configuration.
116-
mkdir -p config/src
117-
cd config/src/
118-
git clone https://github.com/stackhpc/a-universe-from-nothing.git kayobe-config -b stable/2023.1
114+
# Clone the Tenks repository.
115+
cd ~/deployment/src
116+
[[ -d tenks ]] || git clone https://opendev.org/openstack/tenks.git
117+
cd
119118
120119
# Configure host networking (bridge, routes & firewall)
121-
./kayobe-config/configure-local-networking.sh
122-
123-
# Install kayobe.
124-
cd ~/kayobe
125-
./dev/install-dev.sh
120+
~/deployment/src/kayobe-config/configure-local-networking.sh
126121
127122
Deploying a Seed
128123
----------------
@@ -134,14 +129,9 @@ performed the necessary `Preparation`_.
134129

135130
.. code-block:: console
136131
137-
cd ~/kayobe
138-
139-
# Activate the Kayobe environment, to allow running commands directly.
140-
source ~/kayobe-venv/bin/activate
141-
source config/src/kayobe-config/kayobe-env
142-
143-
# Bootstrap the Ansible control host.
144-
kayobe control host bootstrap
132+
# If you have not done so already, activate the Kayobe environment, to allow
133+
# running commands directly.
134+
source ~/deployment/env-vars.sh
145135
146136
# Configure the seed hypervisor host.
147137
kayobe seed hypervisor host configure
@@ -153,14 +143,14 @@ performed the necessary `Preparation`_.
153143
kayobe seed host configure
154144
155145
# Pull, retag images, then push to our local registry.
156-
./config/src/kayobe-config/pull-retag-push-images.sh
146+
~/deployment/src/kayobe-config/pull-retag-push-images.sh
157147
158148
# Deploy the seed services.
159149
kayobe seed service deploy
160150
161151
# Deploying the seed restarts networking interface,
162152
# run configure-local-networking.sh again to re-add routes.
163-
./config/src/kayobe-config/configure-local-networking.sh
153+
~/deployment/src/kayobe-config/configure-local-networking.sh
164154
165155
# Optional: Shutdown the seed VM if creating a seed snapshot.
166156
sudo virsh shutdown seed
@@ -192,11 +182,8 @@ Otherwise, continue working with the instance from `Deploying a Seed`_.
192182
# Optional: start a new tmux session in case we lose our connection.
193183
tmux
194184
195-
# Set working directory
196-
cd ~/kayobe
197-
198185
# Configure non-persistent networking, if the node has rebooted.
199-
./config/src/kayobe-config/configure-local-networking.sh
186+
~/deployment/src/kayobe-config/configure-local-networking.sh
200187
201188
Make sure that the seed VM (running Bifrost and supporting services)
202189
is present and running.
@@ -215,12 +202,16 @@ our model development environment, alongside the seed VM.
215202

216203
.. code-block:: console
217204
218-
# NOTE: Make sure to use ./tenks, since just ‘tenks’ will install via PyPI.
219-
export TENKS_CONFIG_PATH=config/src/kayobe-config/tenks.yml
220-
./dev/tenks-deploy-overcloud.sh ./tenks
205+
# Set Environment variables for Kayobe dev scripts
206+
export KAYOBE_CONFIG_SOURCE_PATH=~/deployment/src/kayobe-config
207+
export KAYOBE_VENV_PATH=~/deployment/venvs/kayobe
208+
export TENKS_CONFIG_PATH=~/deployment/src/kayobe-config/tenks.yml
209+
210+
# Use tenks to deploy the overcloud machines
211+
~/deployment/src/kayobe/dev/tenks-deploy-overcloud.sh ~/deployment/src/tenks
221212
222213
# Activate the Kayobe environment, to allow running commands directly.
223-
source dev/environment-setup.sh
214+
source ~/deployment/env-vars.sh
224215
225216
# Inspect and provision the overcloud hardware:
226217
kayobe overcloud inventory discover
@@ -236,7 +227,7 @@ Configure and deploy OpenStack to the control plane
236227
kayobe overcloud host configure
237228
kayobe overcloud container image pull
238229
kayobe overcloud service deploy
239-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
230+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
240231
kayobe overcloud post configure
241232
242233
At this point it should be possible to access the Horizon GUI via the
@@ -250,15 +241,15 @@ VM:
250241

251242
.. code-block:: console
252243
253-
source config/src/kayobe-config/etc/kolla/public-openrc.sh
254-
./config/src/kayobe-config/init-runonce.sh
244+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
245+
~/deployment/src/kayobe-config/init-runonce.sh
255246
256247
Following the instructions displayed by the above script, boot a VM.
257-
You'll need to have activated the `~/os-venv` virtual environment.
248+
You'll need to have activated the `~/deployment/venvs/os-venv` virtual environment.
258249

259250
.. code-block:: console
260251
261-
source ~/os-venv/bin/activate
252+
source ~/deployment/venvs/os-venv/bin/activate
262253
openstack server create --image cirros \
263254
--flavor m1.tiny \
264255
--key-name mykey \
@@ -274,7 +265,7 @@ You'll need to have activated the `~/os-venv` virtual environment.
274265
275266
# If the ssh command above fails you may need to reconfigure the local
276267
networking setup again:
277-
~/kayobe/config/src/kayobe-config/configure-local-networking.sh
268+
~/deployment/src/kayobe-config/configure-local-networking.sh
278269
279270
*Note*: when accessing the VNC console of an instance via Horizon,
280271
you will be sent to the internal IP address of the controller,
@@ -386,7 +377,7 @@ all OpenStack service logging. **Be cautious as OpenSearch will consume a
386377
significant portion of available resources on a standard deployment.**
387378

388379
To enable the service, one flag must be changed in
389-
``~/kayobe/config/src/kayobe-config/etc/kayobe/kolla.yml``:
380+
``~/deployment/src/kayobe-config/etc/kayobe/kolla.yml``:
390381

391382
.. code-block:: diff
392383
@@ -402,7 +393,7 @@ the seed VM. Pull, retag and push the centralised logging images:
402393

403394
.. code-block:: console
404395
405-
~/kayobe/config/src/kayobe-config/pull-retag-push-images.sh ^opensearch
396+
~/deployment/src/kayobe-config/pull-retag-push-images.sh ^opensearch
406397
407398
To deploy the logging stack:
408399

@@ -434,7 +425,7 @@ public interface to the OpenSearch Dashboards service running on our
434425
``controller0`` VM.
435426

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

439430
.. code-block:: diff
440431
@@ -451,7 +442,7 @@ Then rerun the script to apply the change:
451442

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

@@ -461,7 +452,7 @@ but they are not here).
461452

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

476467
As with the Logging service above, enable Barbican by modifying the flag in
477-
``~/kayobe/config/src/kayobe-config/etc/kayobe/kolla.yml`` as follows:
468+
``~/deployment/src/kayobe-config/etc/kayobe/kolla.yml`` as follows:
478469

479470
.. code-block:: diff
480471
@@ -486,15 +477,14 @@ containers. Pull down barbican images:
486477

487478
.. code-block:: console
488479
489-
~/kayobe/config/src/kayobe-config/pull-retag-push-images.sh barbican
480+
~/deployment/src/kayobe-config/pull-retag-push-images.sh barbican
490481
491482
To deploy the Barbican service:
492483

493484
.. code-block:: console
494485
495486
# Activate the venv if not already active
496-
cd ~/kayobe
497-
source dev/environment-setup.sh
487+
source ~/deployment/env-vars.sh
498488
499489
kayobe overcloud container image pull
500490
kayobe overcloud service deploy
@@ -509,13 +499,13 @@ OpenStack venv:
509499
deactivate
510500
511501
# Activate the OpenStack venv
512-
. ~/os-venv/bin/activate
502+
~/deployment/venvs/os-venv/bin/activate
513503
514504
# Install barbicanclient
515505
pip install python-barbicanclient -c https://releases.openstack.org/constraints/upper/2023.1
516506
517507
# Source the OpenStack environment variables
518-
source ~/kayobe/config/src/kayobe-config/etc/kolla/public-openrc.sh
508+
source ~/deployment/src/kayobe-config/etc/kolla/public-openrc.sh
519509
520510
# Store a test secret
521511
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 stable/2023.1 --kayobe-config-repo https://github.com/stackhpc/a-universe-from-nothing.git --kayobe-config-branch stable/2023.1
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

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/2023.1
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)