Skip to content

Commit 705ebf5

Browse files
authored
Merge branch 'stackhpc/2023.1' into feature/2023.1/friendly-interface-names
2 parents c76c1ce + 9d85426 commit 705ebf5

22 files changed

+306
-10
lines changed

.automation

.automation.conf/tempest/tempest-ci-multinode.overrides.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ max_microversion = 3.70
3232
build_timeout = 600
3333

3434
[dashboard]
35-
dashboard_url = http://192.168.39.2
35+
dashboard_url = https://192.168.39.2

doc/source/configuration/vault.rst

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ This document describes how to deploy Hashicorp Vault for
66
internal PKI purposes using the
77
`StackHPC Hashicorp collection <https://galaxy.ansible.com/stackhpc/hashicorp>`_
88

9+
Vault may be used as a Certificate Authority to generate certificates for:
10+
11+
* OpenStack internal API
12+
* OpenStack backend APIs
13+
* RabbitMQ
14+
15+
TLS support is described in the :kolla-ansible-doc:`Kolla Ansible documentation
16+
<admin/tls.html>` and the :kayobe-doc:`Kayobe documentation
17+
<configuration/reference/kolla-ansible.html#tls-encryption-of-apis>`.
18+
19+
Vault may also be used as the secret store for Barbican.
20+
921
Background
1022
==========
1123

@@ -137,6 +149,30 @@ Setup Vault HA on the overcloud hosts
137149
Certificates generation
138150
=======================
139151

152+
Create the external TLS certificates (testing only)
153+
---------------------------------------------------
154+
155+
Typically external API TLS certificates should be generated by a organisation's trusted internal or third-party CA.
156+
For test and development purposes it is possible to use Vault as a CA for the external API.
157+
158+
1. Run the playbook
159+
160+
.. code-block::
161+
162+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/vault-generate-test-external-tls.yml
163+
164+
2. Use ansible-vault to encrypt the PEM bundle in $KAYOBE_CONFIG_PATH/kolla/certificates/haproxy.pem. Commit the PEM bundle to the kayobe configuration.
165+
166+
.. code-block::
167+
168+
ansible-vault encrypt --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/kolla/certificates/haproxy.pem
169+
170+
Or if environments are being used
171+
172+
.. code-block::
173+
174+
ansible-vault encrypt --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/kolla/certificates/haproxy.pem
175+
140176
Create the internal TLS certificates
141177
------------------------------------
142178

@@ -189,14 +225,23 @@ Certificates deployment
189225
Enable the required TLS variables in kayobe and kolla
190226
-----------------------------------------------------
191227

192-
1. Set the following in kayobe-config/etc/kayobe/kolla.yml or if environments are being used etc/kayobe/environments/$KAYOBE_ENVIRONMENT/kolla.yml
228+
1. If using Vault as a CA for the external API, set the following in kayobe-config/etc/kayobe/kolla.yml or if environments are being used etc/kayobe/environments/$KAYOBE_ENVIRONMENT/kolla.yml
229+
230+
.. code-block::
231+
232+
# Whether TLS is enabled for the external API endpoints. Default is 'no'.
233+
kolla_enable_tls_external: yes
234+
235+
See :ref:`tempest-cacert` for information on adding CA certificates to the trust store when running Tempest.
236+
237+
2. Set the following in kayobe-config/etc/kayobe/kolla.yml or if environments are being used etc/kayobe/environments/$KAYOBE_ENVIRONMENT/kolla.yml
193238

194239
.. code-block::
195240
196241
# Whether TLS is enabled for the internal API endpoints. Default is 'no'.
197242
kolla_enable_tls_internal: yes
198243
199-
2. Set the following in etc/kayobe/kolla/globals.yml or if environments are being used etc/kayobe/environments/$KAYOBE_ENVIRONMENT/kolla/globals.yml
244+
3. Set the following in etc/kayobe/kolla/globals.yml or if environments are being used etc/kayobe/environments/$KAYOBE_ENVIRONMENT/kolla/globals.yml
200245

201246
.. code-block::
202247
@@ -213,7 +258,7 @@ Enable the required TLS variables in kayobe and kolla
213258
# If using RabbitMQ TLS:
214259
rabbitmq_enable_tls: "yes"
215260
216-
3. Deploy backend and internal TLS
261+
4. Deploy OpenStack
217262

218263
.. warning::
219264

doc/source/operations/tempest.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,25 @@ ever contain one host. The seed is usually used as the tempest runner however
251251
it is also common to use the Ansible control host or an infrastructure VM. The
252252
main requirement of the host is that it can reach the OpenStack API.
253253

254+
.. _tempest-cacert:
255+
256+
Tempest CA certificate
257+
----------------------
258+
259+
If your public OpenStack API uses TLS with a Certificate Authority (CA) that is
260+
not trusted by the Python CA trust store, it may be necessary to add a CA
261+
certificate to the trust store in the container that runs Tempest. This can be
262+
done by defining a ``tempest_cacert`` Ansible variable to a path containing the
263+
CA certificate. You may wish to use ``kayobe_config_path`` or
264+
``kayobe_env_config_path`` to be agnostic to the path where kayobe-config is
265+
mounted within the container. For example:
266+
267+
.. code-block:: yaml
268+
:caption: ``etc/kayobe/tempest.yml``
269+
270+
# Add the Vault CA certificate to the rally container when running tempest.
271+
tempest_cacert: "{{ kayobe_env_config_path }}/kolla/certificates/ca/vault.crt"
272+
254273
Running Tempest
255274
===============
256275

etc/kayobe/ansible/fix-houston.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
# When OVS HW offloading is enabled - typically in conjunction with VF-LAG and ASAP^2
3+
# the DMESG log reports frequent errors on the internal OVS Bridge interface:
4+
# "tc mirred to Houston: device bond0-ovs is down".
5+
# This interface is down by default. The errors are mitigated by bringing the interface up.
6+
# For further context, see:
7+
# https://bugs.launchpad.net/charm-neutron-openvswitch/+bug/1899364
8+
# https://patchwork.kernel.org/project/netdevbpf/patch/c2ef23da1d9a4eb62f4e7b7c4540f9bafb553c15.1658420239.git.dcaratti@redhat.com/
9+
# To deploy this playbook, use the following commands:
10+
# kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/fix-houston.yml
11+
# Enable with Kayobe Hooks by running:
12+
# mkdir -p ${KAYOBE_CONFIG_PATH}/hooks/overcloud-service-deploy/post.d
13+
# cd ${KAYOBE_CONFIG_PATH}/hooks/overcloud-service-deploy/post.d
14+
# ln -s ../../../ansible/fix-houston.yml 90-fix-houston.yml
15+
16+
- name: Create Systemd Unit to workaround 'tc mirred to Houston' error
17+
hosts: network,compute
18+
become: yes
19+
20+
tasks:
21+
- name: Include kolla-ansible host vars
22+
include_vars: "{{ kolla_config_path }}/inventory/overcloud/host_vars/{{ inventory_hostname }}"
23+
24+
- name: Create systemd service for -ovs network interface
25+
template:
26+
src: fix-houston-interface.service.j2
27+
dest: "/etc/systemd/system/fix-houston-{{ item }}.service"
28+
loop: "{{ neutron_bridge_name.split(',') }}"
29+
vars:
30+
interface_name: "{{ item }}"
31+
when: neutron_bridge_name | length > 0
32+
notify: reload systemd
33+
34+
- name: Enable and start systemd service for -ovs network interface
35+
systemd:
36+
name: "fix-houston-{{ item }}"
37+
enabled: yes
38+
state: started
39+
when: neutron_bridge_name | length > 0
40+
loop: "{{ neutron_bridge_name.split(',') }}"
41+
42+
handlers:
43+
- name: reload systemd
44+
command: systemctl daemon-reload

etc/kayobe/ansible/pulp-host-image-promote.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
name: "{{ repository_name }}_{{ promotion_tag }}"
2020
base_path: "{{ base_path }}/{{ promotion_tag }}"
2121
register: distribution_details
22+
until: distribution_details is success
23+
retries: 3
24+
delay: 5
2225

2326
- name: Fail if the image does not exist
2427
fail:
@@ -34,6 +37,10 @@
3437
base_path: "{{ base_path }}/{{ promotion_tag }}"
3538
content_guard: release
3639
state: present
40+
register: content_guard_result
41+
until: content_guard_result is success
42+
retries: 3
43+
delay: 5
3744

3845
- name: Print version tag and os
3946
debug:

etc/kayobe/ansible/pulp-host-image-upload.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
password: "{{ remote_pulp_password }}"
2626
file: "{{ found_files.files[0].path }}"
2727
state: present
28+
register: upload_result
29+
until: upload_result is success
30+
retries: 3
31+
delay: 60
2832

2933
- name: Get sha256 hash
3034
ansible.builtin.stat:
@@ -40,6 +44,10 @@
4044
sha256: "{{ file_stats.stat.checksum }}"
4145
relative_path: "{{ found_files.files[0].path | basename }}"
4246
state: present
47+
register: file_content_result
48+
until: file_content_result is success
49+
retries: 3
50+
delay: 5
4351

4452
- name: Ensure file repo exists
4553
pulp.squeezer.file_repository:
@@ -48,6 +56,10 @@
4856
password: "{{ remote_pulp_password }}"
4957
name: "{{ repository_name }}"
5058
state: present
59+
register: file_repo_result
60+
until: file_repo_result is success
61+
retries: 3
62+
delay: 5
5163

5264
- name: Add content to file repo
5365
pulp.squeezer.file_repository_content:
@@ -58,6 +70,10 @@
5870
present_content:
5971
- relative_path: "{{ found_files.files[0].path | basename }}"
6072
sha256: "{{ file_stats.stat.checksum }}"
73+
register: file_repo_content_result
74+
until: file_repo_content_result is success
75+
retries: 3
76+
delay: 5
6177

6278
- name: Create a new publication to point to this version
6379
pulp.squeezer.file_publication:
@@ -67,6 +83,9 @@
6783
repository: "{{ repository_name }}"
6884
state: present
6985
register: publication_details
86+
until: publication_details is success
87+
retries: 3
88+
delay: 5
7089

7190
- name: Update distribution for latest version
7291
pulp.squeezer.file_distribution:
@@ -79,6 +98,9 @@
7998
content_guard: development
8099
state: present
81100
register: latest_distribution_details
101+
until: latest_distribution_details is success
102+
retries: 3
103+
delay: 5
82104

83105
- name: Create distribution for given version
84106
pulp.squeezer.file_distribution:
@@ -91,6 +113,10 @@
91113
content_guard: development
92114
state: present
93115
when: latest_distribution_details.changed
116+
register: distribution_result
117+
until: distribution_result is success
118+
retries: 3
119+
delay: 5
94120

95121
- name: Update new images file with versioned path
96122
lineinfile:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[Unit]
2+
# This service addresses a specific issue when OVS HW offloading is enabled
3+
# typically in conjunction with VF-LAG and ASAP^2
4+
# the DMESG log reports frequent errors on the internal OVS Bridge interface:
5+
# "tc mirred to Houston: device bond0-ovs is down".
6+
# This interface is down by default. The errors are mitigated by bringing the interface up.
7+
# For further context, see:
8+
# https://bugs.launchpad.net/charm-neutron-openvswitch/+bug/1899364
9+
# https://patchwork.kernel.org/project/netdevbpf/patch/c2ef23da1d9a4eb62f4e7b7c4540f9bafb553c15.1658420239.git.dcaratti@redhat.com/
10+
Description=Bring up {{ interface_name }} interface
11+
After=kolla-openvswitch_vswitchd-container.service
12+
13+
[Service]
14+
Type=oneshot
15+
ExecStartPre=/usr/bin/timeout 60s /bin/bash -c 'until ip link show {{ interface_name }}; do sleep 1; done'
16+
ExecStart=/sbin/ip link set {{ interface_name }} up
17+
RemainAfterExit=yes
18+
19+
[Install]
20+
WantedBy=multi-user.target
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
- name: Generate external API certificate (for testing only)
3+
hosts: controllers
4+
run_once: true
5+
vars:
6+
vault_api_addr: "https://{{ kolla_internal_fqdn }}:8200"
7+
# NOTE: Using the same CA as internal TLS.
8+
vault_intermediate_ca_name: "OS-TLS-INT"
9+
tasks:
10+
- name: Include Vault keys
11+
include_vars:
12+
file: "{{ kayobe_env_config_path }}/vault/overcloud-vault-keys.json"
13+
name: vault_keys
14+
15+
- name: Issue a certificate for external TLS
16+
hashivault_pki_cert_issue:
17+
url: "{{ vault_api_addr }}"
18+
ca_cert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if ansible_facts.os_family == 'RedHat' else '/usr/local/share/ca-certificates/OS-TLS-ROOT.crt' }}"
19+
token: "{{ vault_keys.root_token }}"
20+
mount_point: "{{ vault_intermediate_ca_name }}"
21+
role: "{{ overcloud_vault_pki_external_tls_role_name }}"
22+
common_name: "{% if kolla_external_fqdn != kolla_external_vip_address %}{{ kolla_external_fqdn }}{% endif %}"
23+
extra_params:
24+
ip_sans: "{{ kolla_external_vip_address }}"
25+
register: external_cert
26+
27+
- name: Ensure certificates directory exists
28+
file:
29+
path: "{{ kayobe_env_config_path }}/kolla/certificates"
30+
state: directory
31+
delegate_to: localhost
32+
33+
- name: Ensure CA certificates directory exists
34+
file:
35+
path: "{{ kayobe_env_config_path }}/kolla/certificates/ca"
36+
state: directory
37+
delegate_to: localhost
38+
39+
- name: Copy external API PEM bundle
40+
no_log: true
41+
copy:
42+
dest: "{{ kayobe_env_config_path }}/kolla/certificates/haproxy.pem"
43+
content: |
44+
{{ external_cert.data.certificate }}
45+
{{ external_cert.data.issuing_ca }}
46+
{{ external_cert.data.private_key }}
47+
mode: 0600
48+
delegate_to: localhost
49+
50+
- name: Copy root CA
51+
copy:
52+
src: "{{ kayobe_env_config_path }}/vault/OS-TLS-ROOT.pem"
53+
dest: "{{ kayobe_env_config_path }}/kolla/certificates/ca/vault.crt"
54+
mode: 0600
55+
delegate_to: localhost

etc/kayobe/environments/ci-multinode/kolla.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ kolla_enable_designate: true
88
kolla_enable_redis: true
99
kolla_enable_barbican: true
1010

11-
# The multinode environment supports Backend and internal TLS , but it must be
12-
# enabled in the correct order. See
11+
# The multinode environment supports backend, external and internal TLS , but
12+
# it must be enabled in the correct order. See
1313
# https://stackhpc-kayobe-config.readthedocs.io/en/stackhpc-yoga/configuration/vault.html
1414
# for details.
15+
# kolla_enable_tls_external: true
1516
# kolla_enable_tls_internal: true
1617

18+
kolla_public_openrc_cacert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if os_distribution in ['centos', 'rocky'] else '/etc/ssl/certs/ca-certificates.crt' }}"
19+
kolla_admin_openrc_cacert: "{{ kolla_public_openrc_cacert }}"
20+
1721
# The multinode environment supports Manila but it is not enabled by default.
1822
# kolla_enable_manila: true
1923
# kolla_enable_manila_backend_cephfs_native: true

0 commit comments

Comments
 (0)