Skip to content

Commit 50607dd

Browse files
committed
doc/development: add devstack notes
this is notes from my setup, it can be useful for folks who want to develop CAPO with a single devstack instance. Signed-off-by: Mathieu Tortuyaux <[email protected]>
1 parent 295b75b commit 50607dd

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

docs/book/src/development/development.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Requirements](#requirements)
1515
- [Create E2E test environment](#create-e2e-test-environment)
1616
- [OpenStack](#openstack)
17+
- [DevStack](#devstack)
1718
- [Running E2E tests using rootless podman](#running-e2e-tests-using-rootless-podman)
1819
- [Host configuration](#host-configuration)
1920
- [Running podman system service to emulate docker daemon](#running-podman-system-service-to-emulate-docker-daemon)
@@ -195,6 +196,113 @@ and create the environment by running:
195196
./hack/ci/create_devstack.sh
196197
```
197198

199+
##### DevStack
200+
201+
Here's a few notes to setup a DevStack environment and debug ressources (tested on `m3.small` from Equinix Metal: https://deploy.equinix.com/product/servers/m3-small/)
202+
203+
###### Server side
204+
205+
As a root user, install and configure DevStack:
206+
207+
```
208+
# useradd -s /bin/bash -d /opt/stack -m stack
209+
# chmod +x /opt/stack
210+
# echo "stack ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/stack
211+
# sudo -u stack -i
212+
$ git clone https://opendev.org/openstack/devstack
213+
$ cd devstack
214+
$ cat > local.conf <<EOF
215+
[[local|localrc]]
216+
ADMIN_PASSWORD=!!! CHANGE ME !!!
217+
DATABASE_PASSWORD=\$ADMIN_PASSWORD
218+
RABBIT_PASSWORD=\$ADMIN_PASSWORD
219+
SERVICE_PASSWORD=\$ADMIN_PASSWORD
220+
221+
GIT_BASE=https://opendev.org
222+
# Enable Logging
223+
LOGFILE=$DEST/logs/stack.sh.log
224+
VERBOSE=True
225+
LOG_COLOR=True
226+
enable_service rabbit
227+
enable_plugin neutron $GIT_BASE/openstack/neutron
228+
# Octavia supports using QoS policies on the VIP port:
229+
enable_service q-qos
230+
enable_service placement-api placement-client
231+
# Octavia services
232+
enable_plugin octavia $GIT_BASE/openstack/octavia master
233+
enable_plugin octavia-dashboard $GIT_BASE/openstack/octavia-dashboard
234+
enable_plugin ovn-octavia-provider $GIT_BASE/openstack/ovn-octavia-provider
235+
enable_plugin octavia-tempest-plugin $GIT_BASE/openstack/octavia-tempest-plugin
236+
enable_service octavia o-api o-cw o-hm o-hk o-da
237+
# Cinder
238+
enable_service c-api c-vol c-sch
239+
# Tempest
240+
enable_service tempest
241+
EOF
242+
$ ./stack.sh
243+
```
244+
245+
If you want to enable web-download (i.e import images from URL):
246+
```
247+
# /etc/glance/glance-api.conf
248+
show_multiple_locations = True
249+
250+
# ./horizon/openstack_dashboard/defaults.py
251+
IMAGE_ALLOW_LOCATIONS = True
252+
253+
# /etc/glance/glance-image-import.conf
254+
[image_import_opts]
255+
image_import_plugins = ['image_decompression']
256+
257+
$ sudo systemctl restart [email protected] apache2
258+
```
259+
260+
With this dev setup, it might be useful to enable DHCP for the public subnet:
261+
Admin > Network > Networks > `public` > Subnets > `public-subnet` > Edit Subnet > Subnet Details > :ballot_box_with_check: Enable DHCP + Add DNS
262+
263+
###### CAPO side
264+
265+
To work with this setup, it takes an update of the `test/e2e/data/e2e_conf.yaml` file. (NOTE: You can decide to update the m1.small flavor to avoid changing it)
266+
267+
```diff
268+
diff --git a/test/e2e/data/e2e_conf.yaml b/test/e2e/data/e2e_conf.yaml
269+
index 0d66e1f2..a3b2bd78 100644
270+
--- a/test/e2e/data/e2e_conf.yaml
271+
+++ b/test/e2e/data/e2e_conf.yaml
272+
@@ -136,7 +136,7 @@ variables:
273+
CNI: "../../data/cni/calico.yaml"
274+
CCM: "../../data/ccm/cloud-controller-manager.yaml"
275+
EXP_CLUSTER_RESOURCE_SET: "true"
276+
- OPENSTACK_BASTION_IMAGE_NAME: "cirros-0.6.1-x86_64-disk"
277+
+ OPENSTACK_BASTION_IMAGE_NAME: "cirros-0.5.2-x86_64-disk"
278+
OPENSTACK_BASTION_MACHINE_FLAVOR: "m1.tiny"
279+
OPENSTACK_CLOUD: "capo-e2e"
280+
OPENSTACK_CLOUD_ADMIN: "capo-e2e-admin"
281+
@@ -144,10 +144,10 @@ variables:
282+
OPENSTACK_CLOUD_YAML_FILE: '../../../../clouds.yaml'
283+
OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR: "m1.medium"
284+
OPENSTACK_DNS_NAMESERVERS: "8.8.8.8"
285+
- OPENSTACK_FAILURE_DOMAIN: "testaz1"
286+
- OPENSTACK_FAILURE_DOMAIN_ALT: "testaz2"
287+
+ OPENSTACK_FAILURE_DOMAIN: "nova"
288+
+ OPENSTACK_FAILURE_DOMAIN_ALT: "nova"
289+
OPENSTACK_IMAGE_NAME: "focal-server-cloudimg-amd64"
290+
- OPENSTACK_NODE_MACHINE_FLAVOR: "m1.small"
291+
+ OPENSTACK_NODE_MACHINE_FLAVOR: "m1.medium"
292+
```
293+
294+
Before running a test:
295+
* start `sshuttle` (https://github.com/sshuttle/sshuttle) to setup the network between the host and the devstack instance correctly.
296+
```
297+
sshuttle -r stack@<devstack-server-ip> 172.24.4.0/24 -l 0.0.0.0
298+
```
299+
* import the tested image in DevStack by matching the name defined in `e2e_conf.yaml` (`OPENSTACK_FLATCAR_IMAGE_NAME` or `OPENSTACK_IMAGE_NAME`)
300+
301+
To run a specific test, it's possible to fill this variable `E2E_GINKGO_FOCUS`, if you want to SSH into an instance to debug it, it's possible to proxy jump via the bastion and to use the SSH key generated by Nova, for example with Flatcar:
302+
```
303+
ssh -J [email protected] -i ./_artifacts/ssh/cluster-api-provider-openstack-sigs-k8s-io [email protected]
304+
```
305+
198306
## Running E2E tests using rootless podman
199307
200308
You can use unprivileged podman to:

0 commit comments

Comments
 (0)