Skip to content

Commit

Permalink
Merge pull request #1569 from tormath1/tormath1/devstack
Browse files Browse the repository at this point in the history
📖  doc/development: add devstack notes
  • Loading branch information
k8s-ci-robot authored Sep 18, 2023
2 parents 9d43fd6 + 8d37e1e commit 686923c
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions docs/book/src/development/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [Requirements](#requirements)
- [Create E2E test environment](#create-e2e-test-environment)
- [OpenStack](#openstack)
- [DevStack](#devstack)
- [Running E2E tests using rootless podman](#running-e2e-tests-using-rootless-podman)
- [Host configuration](#host-configuration)
- [Running podman system service to emulate docker daemon](#running-podman-system-service-to-emulate-docker-daemon)
Expand Down Expand Up @@ -195,6 +196,111 @@ and create the environment by running:
./hack/ci/create_devstack.sh
```

##### DevStack

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

###### Server side

As a root user, install and configure DevStack:

```
# useradd -s /bin/bash -d /opt/stack -m stack
# chmod +x /opt/stack
# echo "stack ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/stack
# sudo -u stack -i
$ git clone https://opendev.org/openstack/devstack
$ cd devstack
$ cat > local.conf <<EOF
[[local|localrc]]
ADMIN_PASSWORD=!!! CHANGE ME !!!
DATABASE_PASSWORD=\$ADMIN_PASSWORD
RABBIT_PASSWORD=\$ADMIN_PASSWORD
SERVICE_PASSWORD=\$ADMIN_PASSWORD
GIT_BASE=https://opendev.org
# Enable Logging
LOGFILE=$DEST/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
enable_service rabbit
enable_plugin neutron $GIT_BASE/openstack/neutron
# Octavia supports using QoS policies on the VIP port:
enable_service q-qos
enable_service placement-api placement-client
# Octavia services
enable_plugin octavia $GIT_BASE/openstack/octavia master
enable_plugin octavia-dashboard $GIT_BASE/openstack/octavia-dashboard
enable_plugin ovn-octavia-provider $GIT_BASE/openstack/ovn-octavia-provider
enable_plugin octavia-tempest-plugin $GIT_BASE/openstack/octavia-tempest-plugin
enable_service octavia o-api o-cw o-hm o-hk o-da
# Cinder
enable_service c-api c-vol c-sch
EOF
$ ./stack.sh
```

If you want to enable web-download (i.e import images from URL):
```
# /etc/glance/glance-api.conf
show_multiple_locations = True
# ./horizon/openstack_dashboard/defaults.py
IMAGE_ALLOW_LOCATIONS = True
# /etc/glance/glance-image-import.conf
[image_import_opts]
image_import_plugins = ['image_decompression']
$ sudo systemctl restart [email protected] apache2
```

With this dev setup, it might be useful to enable DHCP for the public subnet:
Admin > Network > Networks > `public` > Subnets > `public-subnet` > Edit Subnet > Subnet Details > :ballot_box_with_check: Enable DHCP + Add DNS

###### CAPO side

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)

```diff
diff --git a/test/e2e/data/e2e_conf.yaml b/test/e2e/data/e2e_conf.yaml
index 0d66e1f2..a3b2bd78 100644
--- a/test/e2e/data/e2e_conf.yaml
+++ b/test/e2e/data/e2e_conf.yaml
@@ -136,7 +136,7 @@ variables:
CNI: "../../data/cni/calico.yaml"
CCM: "../../data/ccm/cloud-controller-manager.yaml"
EXP_CLUSTER_RESOURCE_SET: "true"
- OPENSTACK_BASTION_IMAGE_NAME: "cirros-0.6.1-x86_64-disk"
+ OPENSTACK_BASTION_IMAGE_NAME: "cirros-0.5.2-x86_64-disk"
OPENSTACK_BASTION_MACHINE_FLAVOR: "m1.tiny"
OPENSTACK_CLOUD: "capo-e2e"
OPENSTACK_CLOUD_ADMIN: "capo-e2e-admin"
@@ -144,10 +144,10 @@ variables:
OPENSTACK_CLOUD_YAML_FILE: '../../../../clouds.yaml'
OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR: "m1.medium"
OPENSTACK_DNS_NAMESERVERS: "8.8.8.8"
- OPENSTACK_FAILURE_DOMAIN: "testaz1"
- OPENSTACK_FAILURE_DOMAIN_ALT: "testaz2"
+ OPENSTACK_FAILURE_DOMAIN: "nova"
+ OPENSTACK_FAILURE_DOMAIN_ALT: "nova"
OPENSTACK_IMAGE_NAME: "focal-server-cloudimg-amd64"
- OPENSTACK_NODE_MACHINE_FLAVOR: "m1.small"
+ OPENSTACK_NODE_MACHINE_FLAVOR: "m1.medium"
```

Before running a test:
* start `sshuttle` (https://github.com/sshuttle/sshuttle) to setup the network between the host and the devstack instance correctly.
```
sshuttle -r stack@<devstack-server-ip> 172.24.4.0/24 -l 0.0.0.0
```
* import the tested image in DevStack by matching the name defined in `e2e_conf.yaml` (`OPENSTACK_FLATCAR_IMAGE_NAME` or `OPENSTACK_IMAGE_NAME`)
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:
```
ssh -J [email protected] -i ./_artifacts/ssh/cluster-api-provider-openstack-sigs-k8s-io [email protected]
```
## Running E2E tests using rootless podman
You can use unprivileged podman to:
Expand Down

0 comments on commit 686923c

Please sign in to comment.