Skip to content

Commit 00f43d7

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 9505890 commit 00f43d7

17 files changed

Lines changed: 628 additions & 0 deletions

File tree

docs/dictionary/en-custom.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ baseimg
7878
baseurl
7979
bashrc
8080
bd
81+
benchmarking
8182
bgp
8283
blockquote
8384
bmaas
@@ -328,6 +329,7 @@ kerberos
328329
keycloak
329330
keypair
330331
keyring
332+
keystoneapi
331333
keystoneauth
332334
keystoneauth1
333335
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

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: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
### Manila prerequisites
13+
14+
If running Manila benchmarks, the `dhss_true` share type must exist before Rally runs.
15+
Use `manila_create_default_resources.yml` with `share_type_name` and `extra_specs` overrides:
16+
17+
```yaml
18+
pre_tests_80_manila_share_type:
19+
type: playbook
20+
source: manila_create_default_resources.yml
21+
extra_vars:
22+
share_type_name: dhss_true
23+
extra_specs: {}
24+
```
25+
26+
## Privilege escalation
27+
become - Required to install podman and fix artifact directory ownership after the container run.
28+
29+
## Parameters
30+
31+
* `cifmw_rally_artifacts_basedir`: (String) Directory where all Rally artifacts are stored.
32+
Default: `{{ cifmw_basedir }}/tests/rally`
33+
* `cifmw_rally_registry`: (String) Container registry. Default: `quay.io`
34+
* `cifmw_rally_namespace`: (String) Registry namespace. Default: `airshipit`
35+
* `cifmw_rally_container`: (String) Container image name. Default: `xrally-openstack`
36+
* `cifmw_rally_image`: (String) Full image reference. Composed from registry/namespace/container.
37+
* `cifmw_rally_image_tag`: (String) Container image tag. Default: `3.0.0`
38+
* `cifmw_rally_dry_run`: (Boolean) Skip actual container execution. Default: `false`
39+
* `cifmw_rally_remove_container`: (Boolean) Remove container after run. Default: `true`
40+
* `cifmw_rally_fail_on_task_failure`: (Boolean) Fail the play if Rally exits non-zero. Default: `true`
41+
* `cifmw_rally_deployment_name`: (String) Rally deployment name. Default: `cifmw`
42+
* `cifmw_rally_concurrency`: (Integer) Concurrency passed to the Rally task via `--task-args`. Default: `1`
43+
* `cifmw_rally_task_file`: (String) Absolute path to a custom Rally task YAML on the host.
44+
Mutually exclusive with `cifmw_rally_openstack_tests`. Default: `""`
45+
* `cifmw_rally_task_extra_args`: (String) Extra arguments passed verbatim to `rally task start`. Default: `""`
46+
* `cifmw_rally_dns_servers`: (List) DNS servers used inside the Rally container. Default: `["192.168.122.10"]`
47+
* `cifmw_rally_os_auth_url`: (String) OpenStack auth URL. Auto-discovered from KeystoneAPI if unset.
48+
* `cifmw_rally_os_username`: (String) OpenStack username. Default: `admin`
49+
* `cifmw_rally_os_password`: (String) OpenStack password. Auto-discovered from Kubernetes secret if unset.
50+
* `cifmw_rally_os_project_name`: (String) OpenStack project. Default: `admin`
51+
* `cifmw_rally_os_user_domain_name`: (String) User domain. Default: `Default`
52+
* `cifmw_rally_os_project_domain_name`: (String) Project domain. Default: `Default`
53+
* `cifmw_rally_os_region_name`: (String) OpenStack region. Default: `regionOne`
54+
* `cifmw_rally_runs`: (List) List of run definitions for sequential multi-run mode.
55+
When empty (default), the role runs once using the top-level `cifmw_rally_*` variables.
56+
When non-empty, the role loops over the list; each entry may override any `cifmw_rally_*`
57+
variable for that run and **must** include a `name` key used to namespace artifacts.
58+
Default: `[]`
59+
60+
## Standalone usage (single run)
61+
62+
```yaml
63+
- hosts: hypervisor
64+
roles:
65+
- role: rally
66+
vars:
67+
cifmw_rally_openstack_tests: "cinder"
68+
cifmw_rally_concurrency: 2
69+
cifmw_rally_fail_on_task_failure: false
70+
```
71+
72+
## Usage via hook (multiple runs)
73+
74+
Add a `post_tests_*` hook in your job vars and define `cifmw_rally_runs`:
75+
76+
```yaml
77+
post_tests_90_rally_run:
78+
type: playbook
79+
source: rally_run.yaml
80+
cifmw_rally_runs:
81+
- name: cinder
82+
cifmw_rally_openstack_tests: "cinder"
83+
cifmw_rally_concurrency: 1
84+
- name: nova
85+
cifmw_rally_openstack_tests: "nova"
86+
cifmw_rally_concurrency: 2
87+
cifmw_rally_fail_on_task_failure: false
88+
```
89+
90+
Each run stores its artifacts under `cifmw_rally_artifacts_basedir/<name>/`.
91+
92+
## Custom task files
93+
94+
To use a custom Rally task file, set `cifmw_rally_task_file` to the absolute path of the
95+
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"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# Mainly used to override the defaults set in .config/molecule/
3+
# By default, it uses the "config_podman.yml" - in CI, it will use
4+
# "config_local.yml".
5+
log: true
6+
7+
provisioner:
8+
name: ansible
9+
log: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: Prepare
19+
hosts: all
20+
vars:
21+
cifmw_basedir: "{{ ansible_user_dir }}/ci-framework-data"
22+
cifmw_install_yamls_tasks_out: "{{ ansible_user_dir }}/zuul-jobs/roles/install_yamls_makes/tasks"
23+
cifmw_install_yamls_defaults:
24+
NAMESPACE: openstack
25+
roles:
26+
- role: test_deps
27+
- role: ci_setup
28+
- role: install_yamls

0 commit comments

Comments
 (0)