Skip to content

Commit 6628ba3

Browse files
committed
[rally] Add Rally role
Add a new `rally` Ansible role that runs OpenStack Rally benchmarks inside a podman container (quay.io/airshipit/xrally-openstack:3.0.0). The role auto-discovers OpenStack credentials from the cluster's KeystoneAPI resource and appends the deployment CA to the trust bundle so SSL verification works without any manual configuration. The role supports two execution modes: * Single run (default): `cifmw_rally_runs: []` — uses the top-level `cifmw_rally_*` variables, artifacts stored in `cifmw_rally_artifacts_basedir/`. * Multi-run: set `cifmw_rally_runs` to a list of dicts, each with a `name` key and optional `cifmw_rally_*` overrides. Artifacts for each run are namespaced under `cifmw_rally_artifacts_basedir/<name>/`. This is modelled after `cifmw_test_operator_stages` and replaces the former test_operator-based wiring (Rally is not a test-operator CRD). A `hooks/playbooks/rally_run.yaml` entry point is provided so jobs can invoke Rally via the ci-framework hooks system, e.g.: post_tests_90_rally_run: type: playbook source: rally_run.yaml Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: lkuchlan <lkuchlan@redhat.com>
1 parent 5c0a0f5 commit 6628ba3

19 files changed

Lines changed: 634 additions & 0 deletions

File tree

.ansible-lint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ exclude_paths:
1818
- roles/ci_gen_kustomize_values/molecule/default/converge.yml # invalid due to calls to "lookup('file')"
1919
- roles/ci_gen_kustomize_values/molecule/default/prepare.yml # import_playbook
2020
- roles/reproducer/files/cifmw-bootstrap.yml # invalid due to calls to "lookup('file')"
21+
- roles/rally/files/ # Rally task files, not Ansible YAML
2122
- roles/kustomize_deploy/molecule/flexible_loop/files/networking-environment-definition.yml # Generated
2223
- roles/kustomize_deploy/molecule/flexible_loop/prepare.yml # import_playbook
2324
- roles/*/molecule/*/side_effect.yml # syntax-check[empty-playbook] https://github.com/ansible/molecule/issues/3617

docs/dictionary/en-custom.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ baseimg
7777
baseurl
7878
bashrc
7979
bd
80+
benchmarking
8081
bgp
8182
blockquote
8283
bmaas
@@ -326,6 +327,7 @@ kerberos
326327
keycloak
327328
keypair
328329
keyring
330+
keystoneapi
329331
keystoneauth
330332
keystoneauth1
331333
keytab
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
- name: Ensure Cinder Rally prerequisites exist
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
environment:
6+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
7+
PATH: "{{ cifmw_path }}"
8+
tasks:
9+
- name: Create m1.tiny flavor if missing
10+
ansible.builtin.shell: |
11+
set -xe -o pipefail
12+
oc -n {{ namespace }} rsh openstackclient \
13+
openstack flavor show m1.tiny &>/dev/null || \
14+
oc -n {{ namespace }} rsh openstackclient \
15+
openstack flavor create m1.tiny \
16+
--ram 512 --disk 1 --vcpus 1 --public
17+
18+
- name: Create lvmdriver-1 volume type if missing
19+
ansible.builtin.shell: |
20+
set -xe -o pipefail
21+
oc -n {{ namespace }} rsh openstackclient \
22+
openstack volume type show lvmdriver-1 &>/dev/null || \
23+
oc -n {{ namespace }} rsh openstackclient \
24+
openstack volume type create lvmdriver-1 --public
25+
26+
- name: Check if cirros image already exists
27+
ansible.builtin.shell: |
28+
set -e -o pipefail
29+
oc -n {{ namespace }} rsh openstackclient \
30+
openstack image list -f value -c Name | grep -q '^cirros'
31+
register: _cirros_image_exists
32+
failed_when: false
33+
34+
- name: Download cirros image to hypervisor
35+
when: _cirros_image_exists.rc != 0
36+
ansible.builtin.get_url:
37+
url: "https://github.com/cirros-dev/cirros/releases/download/0.6.2/cirros-0.6.2-x86_64-disk.img"
38+
dest: "/tmp/cirros-0.6.2-x86_64-disk.img"
39+
mode: "0644"
40+
41+
- name: Copy cirros image to openstackclient pod
42+
when: _cirros_image_exists.rc != 0
43+
ansible.builtin.command: >-
44+
oc cp /tmp/cirros-0.6.2-x86_64-disk.img
45+
{{ namespace }}/openstackclient:/home/cloud-admin/cirros-0.6.2-x86_64-disk.img
46+
47+
- name: Upload cirros image for Rally if missing
48+
when: _cirros_image_exists.rc != 0
49+
ansible.builtin.shell: |
50+
set -xe -o pipefail
51+
oc -n {{ namespace }} rsh openstackclient \
52+
openstack image create cirros-0.6.2-x86_64-disk \
53+
--disk-format qcow2 \
54+
--container-format bare \
55+
--file /home/cloud-admin/cirros-0.6.2-x86_64-disk.img \
56+
--public
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Ensure Manila Rally prerequisites exist
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
environment:
6+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
7+
PATH: "{{ cifmw_path }}"
8+
tasks:
9+
- name: Create dhss_true share type if missing
10+
ansible.builtin.shell: |
11+
set -xe -o pipefail
12+
oc -n {{ namespace }} rsh openstackclient \
13+
openstack share type show dhss_true &>/dev/null || \
14+
oc -n {{ namespace }} rsh openstackclient \
15+
openstack share type create dhss_true False

hooks/playbooks/rally_run.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Run Rally benchmarks
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
environment:
6+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
7+
PATH: "{{ cifmw_path }}"
8+
tasks:
9+
- name: Run rally role
10+
ansible.builtin.include_role:
11+
name: rally

roles/rally/OWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See the OWNERS docs at https://www.kubernetes.dev/docs/guide/owners/
2+
3+
approvers:
4+
- ciops-team
5+
6+
reviewers:
7+
- ciops-team

roles/rally/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# rally
2+
Role to setup and run Rally benchmarking tests against an OpenStack deployment.
3+
4+
Rally is run inside the `quay.io/airshipit/xrally-openstack` container via podman.
5+
OpenStack credentials are discovered automatically from the Kubernetes KeystoneAPI resource,
6+
or can be supplied directly via `cifmw_rally_os_*` variables.
7+
8+
## Prerequisites
9+
- `oc` CLI available and pointing to the target OpenStack cluster (used for credential and CA discovery).
10+
- `cifmw_openstack_namespace` must be set to the OpenStack namespace (typically `openstack`).
11+
12+
## Privilege escalation
13+
become - Required to install podman and fix artifact directory ownership after the container run.
14+
15+
## Parameters
16+
17+
* `cifmw_rally_artifacts_basedir`: (String) Directory where all Rally artifacts are stored.
18+
Default: `{{ cifmw_basedir }}/tests/rally`
19+
* `cifmw_rally_registry`: (String) Container registry. Default: `quay.io`
20+
* `cifmw_rally_namespace`: (String) Registry namespace. Default: `airshipit`
21+
* `cifmw_rally_container`: (String) Container image name. Default: `xrally-openstack`
22+
* `cifmw_rally_image`: (String) Full image reference. Composed from registry/namespace/container.
23+
* `cifmw_rally_image_tag`: (String) Container image tag. Default: `3.0.0`
24+
* `cifmw_rally_dry_run`: (Boolean) Skip actual container execution. Default: `false`
25+
* `cifmw_rally_remove_container`: (Boolean) Remove container after run. Default: `true`
26+
* `cifmw_rally_fail_on_task_failure`: (Boolean) Fail the play if Rally exits non-zero. Default: `true`
27+
* `cifmw_rally_deployment_name`: (String) Rally deployment name. Default: `cifmw`
28+
* `cifmw_rally_concurrency`: (Integer) Concurrency passed to the Rally task via `--task-args`. Default: `1`
29+
* `cifmw_rally_task_file`: (String) Absolute path to a custom Rally task YAML on the host.
30+
Mutually exclusive with `cifmw_rally_openstack_tests`. Default: `""`
31+
* `cifmw_rally_task_extra_args`: (String) Extra arguments passed verbatim to `rally task start`. Default: `""`
32+
* `cifmw_rally_dns_servers`: (List) DNS servers used inside the Rally container. Default: `["192.168.122.10"]`
33+
* `cifmw_rally_os_auth_url`: (String) OpenStack auth URL. Auto-discovered from KeystoneAPI if unset.
34+
* `cifmw_rally_os_username`: (String) OpenStack username. Default: `admin`
35+
* `cifmw_rally_os_password`: (String) OpenStack password. Auto-discovered from Kubernetes secret if unset.
36+
* `cifmw_rally_os_project_name`: (String) OpenStack project. Default: `admin`
37+
* `cifmw_rally_os_user_domain_name`: (String) User domain. Default: `Default`
38+
* `cifmw_rally_os_project_domain_name`: (String) Project domain. Default: `Default`
39+
* `cifmw_rally_os_region_name`: (String) OpenStack region. Default: `regionOne`
40+
* `cifmw_rally_runs`: (List) List of run definitions for sequential multi-run mode.
41+
When empty (default), the role runs once using the top-level `cifmw_rally_*` variables.
42+
When non-empty, the role loops over the list; each entry may override any `cifmw_rally_*`
43+
variable for that run and **must** include a `name` key used to namespace artifacts.
44+
Default: `[]`
45+
46+
## Standalone usage (single run)
47+
48+
```yaml
49+
- hosts: hypervisor
50+
roles:
51+
- role: rally
52+
vars:
53+
cifmw_rally_openstack_tests: "cinder"
54+
cifmw_rally_concurrency: 2
55+
cifmw_rally_fail_on_task_failure: false
56+
```
57+
58+
## Usage via hook (multiple runs)
59+
60+
Add a `post_tests_*` hook in your job vars and define `cifmw_rally_runs`:
61+
62+
```yaml
63+
post_tests_90_rally_run:
64+
type: playbook
65+
source: rally_run.yaml
66+
cifmw_rally_runs:
67+
- name: cinder
68+
cifmw_rally_openstack_tests: "cinder"
69+
cifmw_rally_concurrency: 1
70+
- name: nova
71+
cifmw_rally_openstack_tests: "nova"
72+
cifmw_rally_concurrency: 2
73+
cifmw_rally_fail_on_task_failure: false
74+
```
75+
76+
Each run stores its artifacts under `cifmw_rally_artifacts_basedir/<name>/`.
77+
78+
## Custom task files
79+
80+
To use a custom Rally task file, set `cifmw_rally_task_file` to the absolute path of the
81+
YAML on the hypervisor host (pre-stage it via an earlier hook if needed).

roles/rally/defaults/main.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
18+
# All variables intended for modification should be placed in this file.
19+
# All variables within this role should have a prefix of "cifmw_rally"
20+
cifmw_rally_artifacts_basedir: "{{ cifmw_basedir }}/tests/rally"
21+
cifmw_rally_registry: "quay.io"
22+
cifmw_rally_namespace: "airshipit"
23+
cifmw_rally_container: "xrally-openstack"
24+
cifmw_rally_image: "{{ cifmw_rally_registry }}/{{ cifmw_rally_namespace }}/{{ cifmw_rally_container }}"
25+
cifmw_rally_image_tag: "3.0.0"
26+
cifmw_rally_dry_run: false
27+
cifmw_rally_remove_container: true
28+
cifmw_rally_fail_on_task_failure: true
29+
cifmw_rally_deployment_name: "cifmw"
30+
cifmw_rally_concurrency: 1
31+
cifmw_rally_task_file: ""
32+
cifmw_rally_openstack_tests: ""
33+
cifmw_rally_task_extra_args: ""
34+
cifmw_rally_dns_servers:
35+
- "192.168.122.10"
36+
cifmw_rally_runs: []

roles/rally/meta/main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
18+
galaxy_info:
19+
author: CI Framework
20+
description: CI Framework Role -- rally
21+
company: Red Hat
22+
license: Apache-2.0
23+
min_ansible_version: "2.14"
24+
namespace: cifmw
25+
galaxy_tags:
26+
- cifmw
27+
- rally
28+
29+
dependencies: []
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
18+
- name: Converge
19+
hosts: all
20+
vars:
21+
cifmw_rally_dry_run: true
22+
cifmw_rally_openstack_tests: "cinder"
23+
roles:
24+
- role: "rally"

0 commit comments

Comments
 (0)