Add ipe installation to bifrost

This commit adds support to install the Ironic Prometheus Exporter,
it's necessary to set `enable_prometheus_exporter=True` or pass
`--enable-prometheus-exporter` when using the `bifrost-cli`

Also the ipe is now enabled in the
bifrost-integration-tinyipa-keystone-ubuntu-bionic/centos8

Change-Id: I3972e88162fba31ad6e262f47b67a37cd37a2076
This commit is contained in:
Iury Gregory Melo Ferreira 2020-09-14 17:59:16 +02:00
parent dc4b453456
commit 4f175fd5be
14 changed files with 139 additions and 0 deletions

View File

@ -159,6 +159,7 @@ def cmd_install(args):
use_cirros=args.testenv, use_cirros=args.testenv,
use_tinyipa=args.testenv, use_tinyipa=args.testenv,
developer_mode=args.develop, developer_mode=args.develop,
enable_prometheus_exporter=args.enable_prometheus_exporter,
extra_vars=args.extra_vars, extra_vars=args.extra_vars,
**kwargs) **kwargs)
log("Ironic is installed and running, try it yourself:\n", log("Ironic is installed and running, try it yourself:\n",
@ -230,6 +231,9 @@ def parse_args():
action='store_true', default=False, action='store_true', default=False,
help='enable full disk cleaning between ' help='enable full disk cleaning between '
'deployments (can take a lot of time)') 'deployments (can take a lot of time)')
install.add_argument('--enable-prometheus-exporter', action='store_true',
default=False,
help='Enable Ironic Prometheus Exporter')
install.add_argument('-e', '--extra-vars', action='append', install.add_argument('-e', '--extra-vars', action='append',
help='additional vars to pass to ansible') help='additional vars to pass to ansible')

View File

@ -248,6 +248,9 @@ Additionally, the following parameters can be useful:
Using Bifrost to install older versions of Ironic may work, but is not Using Bifrost to install older versions of Ironic may work, but is not
guaranteed. guaranteed.
``--enable-prometheus-exporter``
Enable the Ironic Prometheus Exporter service.
See the built-in documentation for more details: See the built-in documentation for more details:
.. code-block:: bash .. code-block:: bash

View File

@ -16,3 +16,4 @@
TEST_VM_NODE_DRIVER: "{{ test_driver | default('ipmi') }}" TEST_VM_NODE_DRIVER: "{{ test_driver | default('ipmi') }}"
NOAUTH_MODE: "{{ noauth_mode | default(false) | bool | lower }}" NOAUTH_MODE: "{{ noauth_mode | default(false) | bool | lower }}"
ENABLE_TLS: "{{ enable_tls | default(false) | bool | lower }}" ENABLE_TLS: "{{ enable_tls | default(false) | bool | lower }}"
ENABLE_PROMETHEUS_EXPORTER: "{{ enable_prometheus_exporter | default(false) | bool | lower }}"

View File

@ -19,6 +19,7 @@ ironicinspector_source_install: true
ironicinspectorclient_source_install: false ironicinspectorclient_source_install: false
sushy_source_install: false sushy_source_install: false
staging_drivers_source_install: true staging_drivers_source_install: true
prometheus_exporter_source_install: true
# Setting to utilize diskimage-builder to create a bootable image. # Setting to utilize diskimage-builder to create a bootable image.
create_image_via_dib: true create_image_via_dib: true
dib_image_type: vm dib_image_type: vm
@ -110,6 +111,7 @@ ironicinspector_git_url: https://opendev.org/openstack/ironic-inspector
ironicinspectorclient_git_url: https://opendev.org/openstack/python-ironic-inspector-client ironicinspectorclient_git_url: https://opendev.org/openstack/python-ironic-inspector-client
ipa_git_url: https://opendev.org/openstack/ironic-python-agent ipa_git_url: https://opendev.org/openstack/ironic-python-agent
ipa_builder_git_url: https://opendev.org/openstack/ironic-python-agent-builder ipa_builder_git_url: https://opendev.org/openstack/ironic-python-agent-builder
prometheus_exporter_git_url: https://opendev.org/openstack/ironic-prometheus-exporter
mysql_username: "root" mysql_username: "root"
mysql_password: "" mysql_password: ""
disable_dnsmasq_dns: True disable_dnsmasq_dns: True
@ -124,6 +126,7 @@ ironicinspectorclient_git_folder: /opt/stack/python-ironic-inspector-client
sushy_git_folder: /opt/stack/sushy sushy_git_folder: /opt/stack/sushy
ipa_git_folder: /opt/stack/ironic-python-agent ipa_git_folder: /opt/stack/ironic-python-agent
ipa_builder_git_folder: /opt/stack/ironic-python-agent-builder ipa_builder_git_folder: /opt/stack/ironic-python-agent-builder
prometheus_exporter_git_folder: /opt/stack/ironic-prometheus-exporter
enabled_hardware_types: "ipmi,redfish,manual-management,ilo" enabled_hardware_types: "ipmi,redfish,manual-management,ilo"
default_deploy_interface: "direct" default_deploy_interface: "direct"
@ -351,3 +354,14 @@ tls_root: /etc/bifrost
tls_certificate_path: "{{ tls_root }}/bifrost.crt" tls_certificate_path: "{{ tls_root }}/bifrost.crt"
ironic_private_key_path: /etc/ironic/ironic.pem ironic_private_key_path: /etc/ironic/ironic.pem
ironic_inspector_private_key_path: /etc/ironic-inspector/inspector.pem ironic_inspector_private_key_path: /etc/ironic-inspector/inspector.pem
# Enable Ironic Prometheus Exporter
enable_prometheus_exporter: false
prometheus_exporter_host: "{{ internal_ip }}"
prometheus_exporter_port: 9608
# directory to save the node metrics
prometheus_exporter_data_dir: /var/lib/ironic-prometheus-exporter/data
# interval to collect sensor data
sensor_data_interval: 90
# sensor data should be collected from undeployed nodes
sensor_data_undeployed_nodes: false

View File

@ -119,3 +119,7 @@
package: openstacksdk package: openstacksdk
sourcedir: "{{ openstacksdk_git_folder }}" sourcedir: "{{ openstacksdk_git_folder }}"
source_install: "{{ openstacksdk_source_install }}" source_install: "{{ openstacksdk_source_install }}"
- name: "Install Ironic Prometheus Exporter"
include_tasks: prometheus_exporter_install.yml
when: enable_prometheus_exporter | bool

View File

@ -0,0 +1,27 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: "Install gunicorn"
include_role:
name: bifrost-pip-install
vars:
package: gunicorn
- name: "Ironic Prometheus Exporter - install"
include_role:
name: bifrost-pip-install
vars:
package: ironic-prometheus-exporter
sourcedir: "{{ prometheus_exporter_git_folder }}"
source_install: "{{ prometheus_exporter_source_install }}"
extra_args: "--no-cache-dir {{ pip_opts }}"

View File

@ -0,0 +1,38 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: "Set up IPE data dir"
file:
name: "{{ prometheus_exporter_data_dir }}"
owner: ironic
group: ironic
state: directory
mode: '0750'
- name: "Ensure IPE Flask Application is configured on systemd"
template:
src: ironic-prometheus-exporter.service.j2
dest: /etc/systemd/system/ironic-prometheus-exporter.service
owner: root
group: root
mode: 0644
become: true
register: ironic_prometheus_exporter_service_file
- name: "Ensure IPE Flask Application systemd service is started and enabled"
systemd:
name: ironic-prometheus-exporter
enabled: yes
state: started
daemon_reload: "{{ ironic_prometheus_exporter_service_file.changed }}"
become: true

View File

@ -48,6 +48,10 @@
- xinetd - xinetd
- nginx - nginx
- name: "Start ironic-prometheus-exporter"
include: prometheus_exporter_start.yml
when: enable_prometheus_exporter | bool and not skip_start | bool
# Multiple dnsmasqs are likely running, so lets tell the service manager # Multiple dnsmasqs are likely running, so lets tell the service manager
# to at least try stopping dnsmasq for us. # to at least try stopping dnsmasq for us.
- name: "Stop dnsmasq explicitly." - name: "Stop dnsmasq explicitly."

View File

@ -0,0 +1,10 @@
[Unit]
Description=Ironic Prometheus Exporter Flask App
[Service]
Type=simple
Restart=on-failure
ExecStart={{ bifrost_venv_dir }}/bin/gunicorn ironic_prometheus_exporter.app.wsgi:application \
--bind {{ prometheus_exporter_host }}:{{ prometheus_exporter_port}} \
--env IRONIC_CONFIG=/etc/ironic/ironic.conf \
--workers 2 --threads 2 --access-logfile=- --error-logfile=-

View File

@ -94,6 +94,11 @@ deploy_kernel = {{ ipa_kernel_url }}
deploy_ramdisk = {{ ipa_ramdisk_url }} deploy_ramdisk = {{ ipa_ramdisk_url }}
rescue_kernel = {{ ipa_kernel_url }} rescue_kernel = {{ ipa_kernel_url }}
rescue_ramdisk = {{ ipa_ramdisk_url }} rescue_ramdisk = {{ ipa_ramdisk_url }}
{% if enable_prometheus_exporter | bool %}
send_sensor_data = true
send_sensor_data_for_undeployed_nodes = {{ sensor_data_undeployed_nodes }}
send_sensor_data_interval = {{ sensor_data_interval }}
{% endif %}
[database] [database]
connection = mysql+pymysql://{{ ironic.database.username }}:{{ ironic.database.password }}@{{ ironic.database.host }}/{{ ironic.database.name }}?charset=utf8 connection = mysql+pymysql://{{ ironic.database.username }}:{{ ironic.database.password }}@{{ ironic.database.host }}/{{ ironic.database.name }}?charset=utf8
@ -196,3 +201,10 @@ http_basic_auth_user_file = /etc/ironic/htpasswd
username = {{ admin_username }} username = {{ admin_username }}
password = {{ admin_password }} password = {{ admin_password }}
{% endif %} {% endif %}
{% if enable_prometheus_exporter | bool %}
[oslo_messaging_notifications]
driver = prometheus_exporter
transport_url = fake://
location = {{ prometheus_exporter_data_dir }}
{% endif %}

View File

@ -15,6 +15,7 @@ keystone_git_url: "{{ git_url_root }}/openstack/keystone"
sushy_git_url: "{{ git_url_root }}/openstack/sushy" sushy_git_url: "{{ git_url_root }}/openstack/sushy"
ipa_git_url: "{{ git_url_root }}/openstack/ironic-python-agent" ipa_git_url: "{{ git_url_root }}/openstack/ironic-python-agent"
ipa_builder_git_url: "{{ git_url_root }}/openstack/ironic-python-agent-builder" ipa_builder_git_url: "{{ git_url_root }}/openstack/ironic-python-agent-builder"
prometheus_exporter_git_url: "{{ git_url_root }}/openstack/ironic-prometheus-exporter"
# *_git_folder can be overridden by local clones for offline installs # *_git_folder can be overridden by local clones for offline installs
ironicclient_git_folder: "{{ git_root}}/python-ironicclient" ironicclient_git_folder: "{{ git_root}}/python-ironicclient"
ironic_git_folder: "{{ git_root}}/ironic" ironic_git_folder: "{{ git_root}}/ironic"
@ -28,6 +29,7 @@ keystone_git_folder: "{{ git_root}}/keystone"
sushy_git_folder: "{{ git_root}}/sushy" sushy_git_folder: "{{ git_root}}/sushy"
ipa_git_folder: "{{ git_root}}/ironic-python-agent" ipa_git_folder: "{{ git_root}}/ironic-python-agent"
ipa_builder_git_folder: "{{ git_root}}/ironic-python-agent-builder" ipa_builder_git_folder: "{{ git_root}}/ironic-python-agent-builder"
prometheus_exporter_git_folder: "{{ git_root}}/ironic-prometheus-exporter"
# *git_branch can be overridden for stable branch testing # *git_branch can be overridden for stable branch testing
git_branch: master git_branch: master
ironicclient_git_branch: "{{ git_branch }}" ironicclient_git_branch: "{{ git_branch }}"
@ -42,6 +44,7 @@ keystone_git_branch: "{{ git_branch }}"
sushy_git_branch: "{{ git_branch }}" sushy_git_branch: "{{ git_branch }}"
ipa_git_branch: "{{ git_branch }}" ipa_git_branch: "{{ git_branch }}"
ipa_builder_git_branch: master ipa_builder_git_branch: master
prometheus_exporter_git_branch: "{{ git_branch }}"
# disable source install to prevent cloning # disable source install to prevent cloning
ironicclient_source_install: false ironicclient_source_install: false
openstacksdk_source_install: false openstacksdk_source_install: false
@ -49,7 +52,9 @@ ironicinspector_source_install: true
ironicinspectorclient_source_install: false ironicinspectorclient_source_install: false
sushy_source_install: false sushy_source_install: false
staging_drivers_source_install: true staging_drivers_source_install: true
prometheus_exporter_source_install: true
enable_keystone: false enable_keystone: false
enable_prometheus_exporter: false
update_repos: true update_repos: true
force_update_repos: true force_update_repos: true
@ -114,6 +119,11 @@ bifrost_install_sources:
git_url: "{{ ipa_builder_git_url }}" git_url: "{{ ipa_builder_git_url }}"
git_branch: "{{ ipa_builder_git_branch }}" git_branch: "{{ ipa_builder_git_branch }}"
name: ironic-python-agent-builder name: ironic-python-agent-builder
- git_folder: "{{ prometheus_exporter_git_folder }}"
git_url: "{{ prometheus_exporter_git_url }}"
git_branch: "{{ prometheus_exporter_git_branch }}"
name: ironic-prometheus-exporter
source_install: "{{ enable_prometheus_exporter }}"
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment # Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"

View File

@ -0,0 +1,6 @@
---
features:
- |
Adds support to install the Ironic Prometheus Exporter. It can be done
through the ``bifrost-cli`` using ``--enable-prometheus-exporter`` option,
or when setting `enable_prometheus_expoter=True` when deploying.

View File

@ -14,6 +14,7 @@ ZUUL_BRANCH=${ZUUL_BRANCH:-}
CLI_TEST=${CLI_TEST:-false} CLI_TEST=${CLI_TEST:-false}
BOOT_MODE=${BOOT_MODE:-} BOOT_MODE=${BOOT_MODE:-}
ENABLE_TLS=${ENABLE_TLS:-false} ENABLE_TLS=${ENABLE_TLS:-false}
ENABLE_PROMETHEUS_EXPORTER=${ENABLE_PROMETHEUS_EXPORTER:-false}
# Set defaults for ansible command-line options to drive the different # Set defaults for ansible command-line options to drive the different
# tests. # tests.
@ -180,6 +181,7 @@ ${ANSIBLE} -vvvv \
-e wait_for_node_deploy=${WAIT_FOR_DEPLOY} \ -e wait_for_node_deploy=${WAIT_FOR_DEPLOY} \
-e not_enrolled_data_file=${BAREMETAL_DATA_FILE}.rest \ -e not_enrolled_data_file=${BAREMETAL_DATA_FILE}.rest \
-e enable_tls=${ENABLE_TLS} \ -e enable_tls=${ENABLE_TLS} \
-e enable_prometheus_exporter=${ENABLE_PROMETHEUS_EXPORTER} \
-e generate_tls=${ENABLE_TLS} \ -e generate_tls=${ENABLE_TLS} \
-e skip_install=${CLI_TEST} \ -e skip_install=${CLI_TEST} \
-e skip_package_install=${CLI_TEST} \ -e skip_package_install=${CLI_TEST} \

View File

@ -82,10 +82,12 @@
nodeset: ubuntu-bionic nodeset: ubuntu-bionic
required-projects: required-projects:
- openstack/keystone - openstack/keystone
- openstack/ironic-prometheus-exporter
vars: vars:
enable_keystone: true enable_keystone: true
enable_tls: true enable_tls: true
test_driver: redfish test_driver: redfish
enable_prometheus_exporter: true
- job: - job:
name: bifrost-integration-tinyipa-ubuntu-focal name: bifrost-integration-tinyipa-ubuntu-focal
@ -120,10 +122,12 @@
nodeset: centos-8 nodeset: centos-8
required-projects: required-projects:
- openstack/keystone - openstack/keystone
- openstack/ironic-prometheus-exporter
vars: vars:
enable_keystone: true enable_keystone: true
enable_tls: true enable_tls: true
test_driver: redfish test_driver: redfish
enable_prometheus_exporter: true
- job: - job:
name: bifrost-integration-tinyipa-debian-buster name: bifrost-integration-tinyipa-debian-buster