Skip to content

Commit

Permalink
Merge pull request #723 from yadneshk/deploy_kepler
Browse files Browse the repository at this point in the history
Update telemetry role to deploy Kepler
  • Loading branch information
openshift-merge-bot[bot] committed Sep 23, 2024
2 parents 4950d47 + 0859e4e commit bd96a22
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 17 deletions.
1 change: 0 additions & 1 deletion .github/workflows/molecule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
- edpm_sshd
- edpm_ssh_known_hosts
- edpm_timezone
- edpm_telemetry
- edpm_telemetry_logging
- edpm_update
- edpm_users
Expand Down
2 changes: 1 addition & 1 deletion docs/source/playbooks/telemetry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Playbook - telemetry
====================

Deploys Ceilometer and node_exporter telemetry using the edpm_telemetry role.
Deploys Ceilometer, node_exporter and kepler services using the edpm_telemetry role.

.. literalinclude:: ../../../playbooks/telemetry.yml
:language: YAML
2 changes: 2 additions & 0 deletions roles/edpm_telemetry/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ edpm_telemetry_image_download_retries: 5
edpm_telemetry_old_tripleo_compute_sevices:
- tripleo_ceilometer_agent_compute.service
- tripleo_ceilometer_agent_ipmi.service
# Image to use for kepler
edpm_telemetry_kepler_image: "quay.io/sustainable_computing_io/kepler:release-0.7.11"
4 changes: 4 additions & 0 deletions roles/edpm_telemetry/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ argument_specs:
type: list
required: true
description: List of ceilometer agents to be stopped during EDPM adoption
edpm_telemetry_kepler_image:
type: str
required: true
description: "Kepler image url"
21 changes: 10 additions & 11 deletions roles/edpm_telemetry/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ dependency:
options:
role-file: collections.yml
driver:
name: podman
name: delegated
options:
managed: false
ansible_connection_options:
ansible_connection: local
platforms:
- command: /sbin/init
dockerfile: ../../../../molecule/common/Containerfile.j2
image: ${EDPM_ANSIBLE_MOLECULE_IMAGE:-"ubi9/ubi-init"}
name: instance
privileged: true
registry:
url: ${EDPM_ANSIBLE_MOLECULE_REGISTRY:-"registry.access.redhat.com"}
ulimits:
- host
- name: compute-1
groups:
- compute
provisioner:
log: true
name: ansible
inventory:
hosts:
all:
hosts:
instance:
compute-1:
ctlplane_ip: 10.0.0.3
canonical_hostname: edpm-0.localdomain
scenario:
test_sequence:
Expand Down
28 changes: 28 additions & 0 deletions roles/edpm_telemetry/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,46 @@
vars_files:
- ../../defaults/main.yml
tasks:
- name: Enable package repos
become: true
ansible.builtin.shell: |
set -euxo pipefail
pushd /var/tmp
curl -sL https://github.com/openstack-k8s-operators/repo-setup/archive/refs/heads/main.tar.gz | tar -xz
pushd repo-setup-main
python3 -m venv ./venv
PBR_VERSION=0.0.0 ./venv/bin/pip install ./
./venv/bin/repo-setup current-podified -b antelope
popd
rm -rf repo-setup-main
# NOTE(gibi): this is done by the boostrap role in a real deployment
- name: Install openstack-selinux
become: true
ansible.builtin.dnf:
name: "openstack-selinux"
state: present

- name: Create config-data telemetry directory
become: true
ansible.builtin.file:
path: "{{ edpm_telemetry_config_src }}"
state: directory
mode: "0775"

- name: Create /run/libvirt directory
become: true
ansible.builtin.file:
path: "/run/libvirt"
state: directory
mode: "0775"

- name: Create libvirt user
become: true
command: groupadd libvirt

- name: Create ceilometer.conf
become: true
ansible.builtin.copy:
dest: "{{ edpm_telemetry_config_src }}/ceilometer.conf"
mode: "0644"
Expand Down Expand Up @@ -73,6 +97,7 @@
telemetry_secret=eQ5qb0yysfJ8lx82Vl061vSyY
- name: Create polling.yaml
become: true
ansible.builtin.copy:
dest: "{{ edpm_telemetry_config_src }}/polling.yaml"
mode: "0644"
Expand Down Expand Up @@ -101,12 +126,14 @@
- hardware.*
- name: Create certs directory
become: true
ansible.builtin.file:
path: "{{ edpm_telemetry_certs }}"
state: directory
mode: "0775"

- name: Create tls.crt
become: true
ansible.builtin.copy:
dest: "{{ edpm_telemetry_certs }}/tls.crt"
mode: "0600"
Expand All @@ -131,6 +158,7 @@
-----END CERTIFICATE-----
- name: Create tls.key
become: true
ansible.builtin.copy:
dest: "{{ edpm_telemetry_certs }}/tls.key"
mode: "0600"
Expand Down
9 changes: 5 additions & 4 deletions roles/edpm_telemetry/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
- "ceilometer_agent_compute"
- "ceilometer_agent_ipmi"
- "node_exporter"
- "kepler"

- name: ensure systemd services are defined and functional
ansible.builtin.include_tasks: "{{test_helper_dir}}/verify_systemd_unit.yaml"
loop:
- {"name": "edpm_ceilometer_agent_compute.service"}
- {"name": "edpm_ceilometer_agent_ipmi.service"}
- {"name": "edpm_node_exporter.service"}
- { "name": "edpm_ceilometer_agent_compute.service" }
- { "name": "edpm_ceilometer_agent_ipmi.service" }
- { "name": "edpm_node_exporter.service" }
- { "name": "edpm_kepler.service" }

- name: ensure kolla_set_configs copied the expected files and started the correct binary
become: true
Expand All @@ -40,7 +42,6 @@
- "/usr/bin/ceilometer-polling --polling-namespaces compute --logfile /dev/stdout"
- "Copying /var/lib/openstack/config/ceilometer-host-specific.conf to /etc/ceilometer/ceilometer.conf.d/02-ceilometer-host-specific.conf"


- name: ensure kolla_set_configs copied the expected files and started the correct binary
become: true
ansible.builtin.shell: |
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_telemetry/tasks/download_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- "{{ edpm_telemetry_ceilometer_compute_image }}"
- "{{ edpm_telemetry_ceilometer_ipmi_image }}"
- "{{ edpm_telemetry_node_exporter_image }}"
- "{{ edpm_telemetry_kepler_image }}"
become: true
register: edpm_telemetry_images_download
until: edpm_telemetry_images_download.failed == false
Expand Down
42 changes: 42 additions & 0 deletions roles/edpm_telemetry/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,41 @@
[Install]
WantedBy=multi-user.target
- name: Create Kepler systemd unit file
become: true
ansible.builtin.copy:
dest: /etc/systemd/system/edpm_kepler.service
mode: "0644"
content: |
[Unit]
Description=Podman edpm_kepler.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --replace --name kepler \
--privileged --network=host --pid=host --rm -e EXPOSE_ESTIMATED_IDLE_POWER_METRICS="true" -e ENABLE_PROCESS_METRICS="true" \
-v /lib/modules:/lib/modules -v /usr/src:/usr/src -v /sys/:/sys/ -v /proc:/proc -v /etc:/etc \
{{ edpm_telemetry_kepler_image }}
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target default.target
- name: Reload systemd daemon
become: true
ansible.builtin.systemd:
daemon_reload: true

- name: Enable node_exporter
become: true
ansible.builtin.systemd:
Expand All @@ -154,3 +189,10 @@
ansible.builtin.systemd:
state: restarted
name: edpm_ceilometer_agent_ipmi.service

- name: Enable and start Kepler service
become: true
ansible.builtin.systemd:
name: edpm_kepler.service
enabled: true
state: started
5 changes: 5 additions & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@
parent: edpm-ansible-molecule-base
vars:
TEST_RUN: edpm_tuned
- job:
name: edpm-ansible-molecule-edpm_telemetry
parent: edpm-ansible-molecule-base
vars:
TEST_RUN: edpm_telemetry
2 changes: 2 additions & 0 deletions zuul.d/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- edpm-ansible-molecule-edpm_ovs
- edpm-ansible-molecule-edpm_tripleo_cleanup
- edpm-ansible-molecule-edpm_tuned
- edpm-ansible-molecule-edpm_telemetry
- openstack-k8s-operators-content-provider
- adoption-standalone-to-crc-ceph-provider:
dependencies:
Expand Down Expand Up @@ -52,3 +53,4 @@
- ^roles/edpm_neutron_metadata/*
- ^roles/edpm_pre_adoption_validation/*
- ^roles/edpm_tripleo_cleanup/*
- ^roles/edpm_telemetry/*

0 comments on commit bd96a22

Please sign in to comment.