-
Notifications
You must be signed in to change notification settings - Fork 23
Add RADOS gateway usage exporter support #1082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Alex-Welsh
merged 22 commits into
stackhpc/2024.1
from
radosgw-usage-exporter-deploy-yoga
Nov 13, 2024
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
39cd9fe
Add playbook for deploying radosgw usage exporter
seunghun1ee d72fdec
Fix regex to include FQDN
seunghun1ee 0451289
Improve playbook with run_once
seunghun1ee 38e1daa
Add general condition variable to enable rgw exporter
seunghun1ee 4a6b814
Add prometheus target template for rgw exporter
seunghun1ee 7ab1048
Add deploying rgw exporter at service deploy post hook
seunghun1ee a045da6
Fix condition order
seunghun1ee a2b804e
Delegate to controller to ensure access to openstack
seunghun1ee bf0edab
Add option to enable/disable TLS verification
seunghun1ee dc73026
Add option to select port for rgw exporter
seunghun1ee 3077f82
Add cert copying steps to rgw exporter container
seunghun1ee 5460e2c
Fix typo
seunghun1ee 288c317
Add tag to deploy playbook
seunghun1ee 892b6fc
Set openstack auth env automatically
seunghun1ee 28a88f4
Revert "Add deploying rgw exporter at service deploy post hook"
seunghun1ee 16e2d91
Add radosgw usuage exporter support release note
seunghun1ee 355dd35
Replace ec2 credential owner to ceph_rgw
seunghun1ee a3c6168
Set verify to follow kolla_enable_tls_internal
seunghun1ee 442025e
Move condition to block and replace regex_replace with urlsplit
seunghun1ee d6db95a
Add deploying rgw exporter at service deploy post hook
seunghun1ee bb6f276
Bump radosgw_usage_exporter to v0.1.1
seunghun1ee 59cba1e
Better release note and grammar
seunghun1ee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
- name: Deploy RADOS gateway usage exporter | ||
hosts: monitoring | ||
gather_facts: false | ||
tags: radosgw_usage_exporter | ||
vars: | ||
venv: "{{ virtualenv_path }}/openstack" | ||
Alex-Welsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tasks: | ||
seunghun1ee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Deploy RADOS gateway usage exporter | ||
when: stackhpc_enable_radosgw_usage_exporter | ||
block: | ||
- name: Set up openstack cli virtualenv | ||
ansible.builtin.pip: | ||
virtualenv: "{{ venv }}" | ||
virtualenv_command: "/usr/bin/python3 -m venv" | ||
name: | ||
- python-openstackclient | ||
state: latest | ||
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}" | ||
run_once: true | ||
delegate_to: "{{ groups['controllers'][0] }}" | ||
vars: | ||
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}" | ||
|
||
- name: Read admin-openrc credential file | ||
ansible.builtin.command: | ||
cmd: "cat {{ lookup('ansible.builtin.env', 'KOLLA_CONFIG_PATH') }}/admin-openrc.sh" | ||
delegate_to: localhost | ||
register: credential | ||
changed_when: false | ||
|
||
- name: Set facts for admin credentials | ||
ansible.builtin.set_fact: | ||
openstack_auth_env: | ||
OS_PROJECT_DOMAIN_NAME: "{{ credential.stdout_lines | select('match', '.*OS_PROJECT_DOMAIN_NAME*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_USER_DOMAIN_NAME: "{{ credential.stdout_lines | select('match', '.*OS_USER_DOMAIN_NAME*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_PROJECT_NAME: "{{ credential.stdout_lines | select('match', '.*OS_PROJECT_NAME*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_USERNAME: "{{ credential.stdout_lines | select('match', '.*OS_USERNAME*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_PASSWORD: "{{ credential.stdout_lines | select('match', '.*OS_PASSWORD*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_AUTH_URL: "{{ credential.stdout_lines | select('match', '.*OS_AUTH_URL*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_INTERFACE: "{{ credential.stdout_lines | select('match', '.*OS_INTERFACE*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_IDENTITY_API_VERSION: "{{ credential.stdout_lines | select('match', '.*OS_IDENTITY_API_VERSION*.') | first | split('=') | last | replace(\"'\", '') }}" | ||
OS_CACERT: "{{ '/etc/ssl/certs/ca-certificates.crt' if os_distribution == 'ubuntu' else '/etc/pki/tls/certs/ca-bundle.crt' }}" | ||
|
||
- name: Check ec2 credential for ceph_rgw | ||
ansible.builtin.command: > | ||
{{ venv }}/bin/openstack | ||
ec2 credentials list --user ceph_rgw | ||
--format json | ||
environment: "{{ openstack_auth_env }}" | ||
register: credential_check | ||
delegate_to: "{{ groups['controllers'][0] }}" | ||
changed_when: false | ||
vars: | ||
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}" | ||
run_once: true | ||
|
||
- name: Create ec2 credential if there's none | ||
ansible.builtin.command: > | ||
{{ venv }}/bin/openstack | ||
ec2 credentials create --user ceph_rgw --project service | ||
--format json | ||
environment: "{{ openstack_auth_env }}" | ||
delegate_to: "{{ groups['controllers'][0] }}" | ||
changed_when: true | ||
vars: | ||
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}" | ||
run_once: true | ||
when: credential_check.stdout == [] | ||
|
||
- name: Query ec2 credential for ceph_rgw | ||
ansible.builtin.command: > | ||
{{ venv }}/bin/openstack | ||
ec2 credentials list --user ceph_rgw | ||
--format json | ||
environment: "{{ openstack_auth_env }}" | ||
delegate_to: "{{ groups['controllers'][0] }}" | ||
changed_when: false | ||
vars: | ||
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}" | ||
register: credential | ||
run_once: true | ||
|
||
- name: Get object storage endpoint | ||
ansible.builtin.command: > | ||
{{ venv }}/bin/openstack | ||
endpoint list --service object-store --interface internal | ||
--format json | ||
environment: "{{ openstack_auth_env }}" | ||
delegate_to: "{{ groups['controllers'][0] }}" | ||
changed_when: false | ||
vars: | ||
ansible_host: "{{ hostvars[groups['controllers'][0]].ansible_host }}" | ||
register: endpoint | ||
run_once: true | ||
|
||
- name: Process object storage endpoint | ||
ansible.builtin.set_fact: | ||
radosgw_server: "{{ scheme + '://' + hostname + ':' + radosgw_port }}" | ||
vars: | ||
swift: "{{ endpoint.stdout | from_json | first }}" | ||
hostname: "{{ swift.URL | urlsplit('hostname') }}" | ||
scheme: "{{ swift.URL | urlsplit('scheme') }}" | ||
radosgw_port: "{{ swift.URL | urlsplit('port') }}" | ||
run_once: true | ||
|
||
- name: Ensure radosgw_usage_exporter container is running | ||
community.docker.docker_container: | ||
name: radosgw_usage_exporter | ||
image: ghcr.io/stackhpc/radosgw_usage_exporter:0.1.0 | ||
network_mode: host | ||
env: | ||
RADOSGW_SERVER: "{{ radosgw_server }}" | ||
ADMIN_ENTRY: admin | ||
ACCESS_KEY: "{{ ec2.Access }}" | ||
SECRET_KEY: "{{ ec2.Secret }}" | ||
VIRTUAL_PORT: "{{ stackhpc_radosgw_usage_exporter_port | string }}" | ||
entrypoint: "{{ ['python', '-u', './radosgw_usage_exporter.py', '--insecure'] if not stackhpc_radosgw_usage_exporter_verify else omit }}" | ||
vars: | ||
ec2: "{{ credential.stdout | from_json | first }}" | ||
become: true | ||
|
||
- name: Ensure the exporter to use certificate | ||
seunghun1ee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
when: stackhpc_radosgw_usage_exporter_cacert | length > 0 | ||
block: | ||
- name: Create radosgw-usage-exporter directory | ||
ansible.builtin.file: | ||
path: /opt/kayobe/radosgw-usage-exporter/ | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: Copy CA certificate to RADOS gateway usage exporter nodes | ||
ansible.builtin.copy: | ||
src: "{{ stackhpc_radosgw_usage_exporter_cacert }}" | ||
dest: "/opt/kayobe/radosgw-usage-exporter/{{ stackhpc_radosgw_usage_exporter_cacert | basename }}" | ||
mode: 0644 | ||
register: copy_to_node_result | ||
|
||
- name: Copy CA certificate to RADOS gateway usage exporter container | ||
community.docker.docker_container_copy_into: | ||
container: radosgw_usage_exporter | ||
path: "{{ copy_to_node_result.dest }}" | ||
container_path: "/usr/local/share/ca-certificates/{{ copy_to_node_result.dest | basename }}" | ||
become: true | ||
|
||
- name: Update CA certificate of RADOS gateway usage exporter container | ||
community.docker.docker_container_exec: | ||
container: radosgw_usage_exporter | ||
command: update-ca-certificates | ||
user: root | ||
become: true |
1 change: 1 addition & 0 deletions
1
etc/kayobe/hooks/overcloud-service-deploy/post.d/deploy-radosgw-usage-exporter.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../ansible/deploy-radosgw-usage-exporter.yml |
21 changes: 21 additions & 0 deletions
21
etc/kayobe/kolla/config/prometheus/prometheus.yml.d/80-radosgw-exporter.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# yamllint disable-file | ||
--- | ||
Alex-Welsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{% if stackhpc_enable_radosgw_usage_exporter | bool %} | ||
{% raw %} | ||
scrape_configs: | ||
- job_name: ceph_radosgw_usage_exporter | ||
honor_labels: true | ||
scrape_interval: 15s | ||
metric_relabel_configs: | ||
- replacement: ${1} | ||
source_labels: [owner,user] | ||
target_label: tenant_id | ||
separator: "" | ||
regex: (.+) | ||
static_configs: | ||
- targets: | ||
{% for host in groups['monitoring'] %} | ||
- "{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{% endraw %}{{ stackhpc_radosgw_usage_exporter_port }}{% raw %}" | ||
{% endfor %} | ||
{% endraw %} | ||
{% endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
releasenotes/notes/add-radosgw-usage-exporter-support-93d55c544418b05a.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
features: | ||
- | | ||
Adds RADOS Gateway usage exporter support. | ||
|
||
To deploy the exporter, set the variable ``stackhpc_enable_radosgw_usage_exporter`` | ||
to true. Then run playbook ``deploy-radosgw-usage-exporter.yml``. | ||
seunghun1ee marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.