Skip to content

Commit 381f3bb

Browse files
committed
Merge branch 'stackhpc/yoga' into zed-yoga-merge
2 parents 88cedda + a9e87f6 commit 381f3bb

File tree

9 files changed

+62
-47
lines changed

9 files changed

+62
-47
lines changed

doc/source/configuration/monitoring.rst

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -141,58 +141,41 @@ OpenStack Capacity
141141
==================
142142

143143
OpenStack Capacity allows you to see how much space you have available
144-
in your cloud. StackHPC Kayobe Config includes a playbook for manual
145-
deployment, and it's necessary that some variables are set before
146-
running this playbook.
144+
in your cloud. StackHPC Kayobe Config will deploy OpenStack Capacity
145+
by default on a service deploy, this can be disabled by setting
146+
``stackhpc_enable_os_capacity`` to false.
147147

148-
To successfully deploy OpenStack Capacity, you are required to specify
149-
the OpenStack application credentials in ``kayobe/secrets.yml`` as:
148+
OpenStack Capacity is deployed automatically using a service deploy hook
149+
with the generated kolla-ansible admin credentials, you can override these
150+
by setting the authentication url, username, password, project name and
151+
project domain name in ``stackhpc-monitoring.yml``:
150152

151153
.. code-block:: yaml
152154
153-
secrets_os_capacity_credential_id: <some_credential_id>
154-
secrets_os_capacity_credential_secret: <some_credential_secret>
155+
stackhpc_os_capacity_auth_url: <keystone_auth_url>
156+
stackhpc_os_capacity_username: <openstack_username>
157+
stackhpc_os_capacity_password: <openstack_password_encrypted_with_vault>
158+
stackhpc_os_capacity_project_name: <openstack_project_name>
159+
stackhpc_os_capacity_domain_name: <openstack_project_domain_name>
160+
stackhpc_os_capacity_openstack_region_name: <openstack_region_name>
155161
156-
The Keystone authentication URL and OpenStack region can be changed
157-
from their defaults in ``stackhpc-monitoring.yml`` should you need to
158-
set a different OpenStack region for your cloud. The authentication
159-
URL is set to use ``kolla_internal_fqdn`` by default:
160-
161-
.. code-block:: yaml
162-
163-
stackhpc_os_capacity_auth_url: <some_authentication_url>
164-
stackhpc_os_capacity_openstack_region_name: <some_openstack_region>
165-
166-
Additionally, you are required to enable a conditional flag to allow
167-
HAProxy and Prometheus configuration to be templated during deployment.
168-
169-
.. code-block:: yaml
170-
171-
stackhpc_enable_os_capacity: true
172-
173-
If you are deploying in a cloud with internal TLS, you may be required
162+
Additionally, you should ensure these credentials have the correct permissions
163+
for the exporter. If you are deploying in a cloud with internal TLS, you may be required
174164
to disable certificate verification for the OpenStack Capacity exporter
175165
if your certificate is not signed by a trusted CA.
176166

177167
.. code-block:: yaml
178168
179169
stackhpc_os_capacity_openstack_verify: false
180170
181-
After defining your credentials, you may deploy OpenStack Capacity
182-
using the ``ansible/deploy-os-capacity-exporter.yml`` Ansible playbook
171+
If you've modified your credentials, you will need to re-deploy OpenStack Capacity
172+
using the ``deploy-os-capacity-exporter.yml`` Ansible playbook
183173
via Kayobe.
184174

185175
.. code-block:: console
186176
187177
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/deploy-os-capacity-exporter.yml
188178
189-
It is required that you re-configure the Prometheus, Grafana and HAProxy
190-
services following deployment, to do this run the following Kayobe command.
191-
192-
.. code-block:: console
193-
194-
kayobe overcloud service reconfigure -kt grafana,prometheus,loadbalancer
195-
196179
If you notice ``HaproxyServerDown`` or ``HaproxyBackendDown`` prometheus
197180
alerts after deployment it's likely the os_exporter secrets have not been
198181
set correctly, double check you have entered the correct authentication

etc/kayobe/ansible/deploy-os-capacity-exporter.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,33 @@
1717
ansible.builtin.file:
1818
path: /opt/kayobe/os-capacity/
1919
state: directory
20+
when: stackhpc_enable_os_capacity
21+
22+
- name: Read admin-openrc credential file
23+
ansible.builtin.command:
24+
cmd: "cat {{ lookup('ansible.builtin.env', 'KOLLA_CONFIG_PATH') }}/admin-openrc.sh"
25+
delegate_to: localhost
26+
register: credential
27+
when: stackhpc_enable_os_capacity
28+
29+
- name: Set facts for admin credentials
30+
ansible.builtin.set_fact:
31+
stackhpc_os_capacity_auth_url: "{{ credential.stdout_lines | select('match', '.*OS_AUTH_URL*.') | first | split('=') | last | replace(\"'\",'') }}"
32+
stackhpc_os_capacity_project_name: "{{ credential.stdout_lines | select('match', '.*OS_PROJECT_NAME*.') | first | split('=') | last | replace(\"'\",'') }}"
33+
stackhpc_os_capacity_domain_name: "{{ credential.stdout_lines | select('match', '.*OS_PROJECT_DOMAIN_NAME*.') | first | split('=') | last | replace(\"'\",'') }}"
34+
stackhpc_os_capacity_openstack_region_name: "{{ credential.stdout_lines | select('match', '.*OS_REGION_NAME*.') | first | split('=') | last | replace(\"'\",'') }}"
35+
stackhpc_os_capacity_username: "{{ credential.stdout_lines | select('match', '.*OS_USERNAME*.') | first | split('=') | last | replace(\"'\",'') }}"
36+
stackhpc_os_capacity_password: "{{ credential.stdout_lines | select('match', '.*OS_PASSWORD*.') | first | split('=') | last | replace(\"'\",'') }}"
37+
when: stackhpc_enable_os_capacity
2038

2139
- name: Template clouds.yml
2240
ansible.builtin.template:
2341
src: templates/os_capacity-clouds.yml.j2
2442
dest: /opt/kayobe/os-capacity/clouds.yaml
43+
when: stackhpc_enable_os_capacity
2544

2645
- name: Ensure os_capacity container is running
27-
docker_container:
46+
community.docker.docker_container:
2847
name: os_capacity
2948
image: ghcr.io/stackhpc/os-capacity:master
3049
env:
@@ -37,3 +56,4 @@
3756
network_mode: host
3857
restart_policy: unless-stopped
3958
become: true
59+
when: stackhpc_enable_os_capacity

etc/kayobe/ansible/hotfix-containers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
- name: Set fact for containers list
3232
set_fact:
33-
containers_list: host_containers.stdout
33+
containers_list: "{{ host_containers.stdout }}"
3434

3535
- name: Fail if no containers match given regex
3636
vars:
3737
hotfix_containers: "{{ containers_list | split('\n') | regex_search(container_hotfix_container_regex) }}"
3838
fail:
39-
msg: "No containers matched. Please check your regex. Containers running on host: {{ host_containers | split('\n') }}"
39+
msg: "No containers matched. Please check your regex. Containers running on host: {{ host_containers.stdout_lines }}"
4040
when: hotfix_containers == ""
4141

4242
- name: Ensure hotfix-files directory exists on the remote host

etc/kayobe/ansible/run-container-hotfix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020

2121
- name: Run container_hotfix_command
2222
command: "{{ kolla_container_engine | default('docker')}} exec {{ '-u 0' if container_hotfix_become else '' }} {{ hotfix_container }} {{ container_hotfix_command }}"
23+
when: container_hotfix_command

etc/kayobe/ansible/templates/os_capacity-clouds.yml.j2

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ clouds:
22
openstack:
33
auth:
44
auth_url: "{{ stackhpc_os_capacity_auth_url }}"
5-
application_credential_id: "{{ secrets_os_capacity_credential_id }}"
6-
application_credential_secret: "{{ secrets_os_capacity_credential_secret }}"
5+
project_name: "{{ stackhpc_os_capacity_project_name }}"
6+
domain_name: "{{ stackhpc_os_capacity_domain_name }}"
7+
username: "{{ stackhpc_os_capacity_username }}"
8+
password: "{{ stackhpc_os_capacity_password }}"
79
region_name: "{{ stackhpc_os_capacity_openstack_region_name }}"
810
interface: "internal"
911
identity_api_version: 3
10-
auth_type: "v3applicationcredential"
12+
auth_type: "password"
1113
{% if not stackhpc_os_capacity_openstack_verify | bool %}
1214
verify: False
1315
{% endif %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../ansible/deploy-os-capacity-exporter.yml

etc/kayobe/kolla/kolla-build.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ base_tag = jammy-20231004
99
base_tag = 9.{{ stackhpc_pulp_repo_rocky_9_minor_version }}
1010
{% endif %}
1111
build_args = {{ kolla_build_args.items() | map('join', ':') | join(',') }}
12+
13+
[openstack-base]
14+
type = git
15+
location = https://github.com/stackhpc/requirements
16+
reference = stackhpc/{{ openstack_release }}

etc/kayobe/stackhpc-monitoring.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ alertmanager_low_memory_threshold_gib: 5
1414
# Whether the OpenStack Capacity exporter is enabled.
1515
# Enabling this flag will result in HAProxy configuration and Prometheus scrape
1616
# targets being templated during deployment.
17-
stackhpc_enable_os_capacity: false
18-
19-
# Keystone authentication URL for OpenStack Capacity
20-
stackhpc_os_capacity_auth_url: "http{% if kolla_enable_tls_internal | bool %}s{% endif %}://{{ kolla_internal_fqdn }}:5000"
21-
22-
# OpenStack region for OpenStack Capacity
23-
stackhpc_os_capacity_openstack_region_name: "RegionOne"
17+
stackhpc_enable_os_capacity: true
2418

2519
# Whether TLS certificate verification is enabled for the OpenStack Capacity
2620
# exporter during Keystone authentication.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
features:
3+
- |
4+
Automatic deployment for OpenStack Capacity via a Kayobe service
5+
deploy hook using kolla admin credentials.
6+
upgrade:
7+
- |
8+
OpenStack Capacity no longer uses application credentials. Please
9+
delete any previously generated application credentials.

0 commit comments

Comments
 (0)