Skip to content

Commit

Permalink
[CI] Make devstack local.conf configurable (kubernetes#1651)
Browse files Browse the repository at this point in the history
* install-devstack now generates local.conf from a template

* test-occm-e2e: specify which devstack services to enable

* tempate expressions must be in quotes

* add enable_services var to defaults/main.yaml

* removed enable_plugin calls where not needed

* local.conf template: move rest of the sections to the bottom of the file
  • Loading branch information
gman0 authored Sep 30, 2021
1 parent a2c3bca commit 2f37a61
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 9 deletions.
9 changes: 8 additions & 1 deletion tests/playbooks/roles/install-devstack/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
user: "stack"
workdir: "/home/{{ user }}/devstack"
branch: "stable/wallaby"
branch: "stable/wallaby"
enable_services:
- nova
- glance
- cinder
- neutron
- octavia
- barbican
19 changes: 12 additions & 7 deletions tests/playbooks/roles/install-devstack/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,21 @@
version: "{{ branch }}"
force: false

- name: Prepare local.conf
- name: Retrieve local IP address
shell:
executable: /bin/bash
cmd: |
set -ex
branch={{ branch }}
curl -sSL https://gist.github.com/lingxiankong/a109303f48e9a74fc8a7c01de4156d71/raw -o {{ workdir }}/local.conf
local_ip=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')
sed -i "s/LOCAL_IP_ADDRESS/$local_ip/g" {{ workdir }}/local.conf
sed -i "s,MYBRANCH,$branch,g" {{ workdir }}/local.conf
ip route get 8.8.8.8 | head -1 | awk '{print $7}'
register: local_ip_output

- set_fact:
local_ip_address: "{{ local_ip_output.stdout }}"

- name: Prepare local.conf
template:
src: local.conf.j2
dest: "{{ workdir }}/local.conf"

- name: Fix localhost
shell:
Expand Down Expand Up @@ -107,4 +112,4 @@
executable: /bin/bash
cmd: |
# To avoid the warning msg: "CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead"
python3 -m pip install cryptography==3.3.2
python3 -m pip install cryptography==3.3.2
119 changes: 119 additions & 0 deletions tests/playbooks/roles/install-devstack/templates/local.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
[[local|localrc]]
RECLONE=False
HOST_IP={{ local_ip_address }}
DEST=/opt/stack
DATA_DIR=${DEST}/data
USE_PYTHON3=True
LOGFILE=$DEST/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=False
LOGDAYS=1
SERVICE_TIMEOUT=300

DATABASE_PASSWORD=password
ADMIN_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
RABBIT_PASSWORD=password

TARGET_BRANCH={{ branch }}

ENABLED_SERVICES=rabbit,mysql,key

{% if "nova" in enable_services %}
# Nova
enable_service n-api
enable_service n-cpu
enable_service n-cond
enable_service n-sch
enable_service n-api-meta

enable_service placement-api
enable_service placement-client
{% endif %}

{% if "glance" in enable_services %}
# Glance
enable_service g-api
enable_service g-reg
{% endif %}

{% if "cinder" in enable_services %}
# Cinder
enable_service cinder
enable_service c-api
enable_service c-vol
enable_service c-sch
{% endif %}

{% if "neutron" in enable_services %}
# Neutron
enable_plugin neutron https://opendev.org/openstack/neutron.git {{ branch }}
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
IP_VERSION=4
IPV4_ADDRS_SAFE_TO_USE=10.1.0.0/26
FIXED_RANGE=10.1.0.0/26
NETWORK_GATEWAY=10.1.0.1
FLOATING_RANGE=172.24.5.0/24
PUBLIC_NETWORK_GATEWAY=172.24.5.1
Q_PLUGIN=ml2
Q_ML2_TENANT_NETWORK_TYPE=vxlan
Q_DVR_MODE=legacy
Q_AGENT=openvswitch
Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch
{% endif %}

{% if "octavia" in enable_services %}
# Octavia
enable_plugin octavia https://opendev.org/openstack/octavia.git {{ branch }}
enable_service octavia
enable_service o-cw
enable_service o-hm
enable_service o-hk
enable_service o-api

LIBS_FROM_GIT+=,python-octaviaclient

OCTAVIA_MGMT_SUBNET=10.51.0.0/16
OCTAVIA_MGMT_SUBNET_START=10.51.0.2
OCTAVIA_MGMT_SUBNET_END=10.51.0.254
{% endif %}

{% if "barbican" in enable_services %}
# Barbican
enable_plugin barbican https://opendev.org/openstack/barbican.git {{ branch }}
enable_service barbican-vault

LIBS_FROM_GIT+=,python-barbicanclient
{% endif %}

{% if "glance" in enable_services %}
[[post-config|$GLANCE_API_CONF]]
[glance_store]
default_store = file
{% endif %}

{% if "neutron" in enable_services %}
[[post-config|$NEUTRON_CONF]]
[DEFAULT]
global_physnet_mtu = 1430
{% endif %}

{% if "octavia" in enable_services %}
[[post-config|$OCTAVIA_CONF]]
[api_settings]
allow_tls_terminated_listeners = True
[controller_worker]
loadbalancer_topology = SINGLE
amp_active_retries = 60
amp_active_wait_sec = 10
[haproxy_amphora]
rest_request_conn_timeout = 300
rest_request_read_timeout = 600
[health_manager]
health_check_interval = 30
{% endif %}
9 changes: 8 additions & 1 deletion tests/playbooks/test-occm-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@
roles:
- role: install-golang
- role: install-devstack
enable_services:
- nova
- glance
- cinder
- neutron
- octavia
- barbican
- role: install-k3s
worker_node_count: 0
k8s_branch: release-1.22
- role: install-docker
- role: install-docker-registry
cert_hosts: ' ["{{ ansible_default_ipv4.address }}"]'
- role: install-cpo-occm
environment: "{{ global_env }}"
environment: "{{ global_env }}"

0 comments on commit 2f37a61

Please sign in to comment.