Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ baseimg
baseurl
bashrc
bd
benchmarking
bgp
blockquote
bmaas
Expand Down Expand Up @@ -328,6 +329,7 @@ kerberos
keycloak
keypair
keyring
keystoneapi
keystoneauth
keystoneauth1
keytab
Expand Down
11 changes: 7 additions & 4 deletions hooks/playbooks/manila_create_default_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
( ( _manila_share_creation.rc | int ) != 0 )
and not ( "HTTP 409" in _manila_share_creation.stderr )

- name: Prepare extra spec options string
when: extra_specs is mapping and extra_specs | length > 0
ansible.builtin.set_fact:
# convert dict to 'k=v ...' format; guard against extra_specs being passed as a string
extra_spec_opt: "{%- for k, v in extra_specs.items() -%}{{ k }}={{ v }} {% endfor -%}"

- name: Update default share type properties
when: extra_spec_opt is defined
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
# convert dict to 'k=v ...' format
extra_spec_opt: "{%- for k, v in extra_specs.items() -%}{{ k }}={{ v }} {% endfor -%}"
when: extra_spec_opt | length > 0
ansible.builtin.command: |
oc -n {{ namespace }} exec -it pod/openstackclient \
-- openstack share type set {{ share_type_name }} --extra-specs {{ extra_spec_opt }}
83 changes: 83 additions & 0 deletions hooks/playbooks/rally_cinder_prerequisites.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
- name: Ensure Cinder Rally prerequisites exist
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
vars:
_openstackclient_pod: openstackclient
tasks:
- name: Check m1.tiny flavor
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: openstack flavor show m1.tiny
register: _flavor_show
failed_when: false
changed_when: false

- name: Create m1.tiny flavor if missing
Comment thread
evallesp marked this conversation as resolved.
when: _flavor_show.rc != 0
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: >-
openstack flavor create m1.tiny
--ram 512 --disk 1 --vcpus 1 --public

- name: Check lvmdriver-1 volume type
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: openstack volume type show lvmdriver-1
register: _volume_type_show
failed_when: false
changed_when: false

- name: Create lvmdriver-1 volume type if missing
when: _volume_type_show.rc != 0
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: openstack volume type create lvmdriver-1 --public

- name: Check if cirros image already exists
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: openstack image show cirros-0.6.2-x86_64-disk
register: _cirros_image_exists
failed_when: false
changed_when: false

- name: Download cirros image to hypervisor
when: _cirros_image_exists.rc != 0
ansible.builtin.get_url:
url: "https://github.com/cirros-dev/cirros/releases/download/0.6.2/cirros-0.6.2-x86_64-disk.img"
dest: "/tmp/cirros-0.6.2-x86_64-disk.img"
mode: "0644"

- name: Copy cirros image to openstackclient pod
when: _cirros_image_exists.rc != 0
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command: >-
oc cp /tmp/cirros-0.6.2-x86_64-disk.img
{{ namespace }}/openstackclient:/home/cloud-admin/cirros-0.6.2-x86_64-disk.img

- name: Upload cirros image for Rally if missing
Comment thread
evallesp marked this conversation as resolved.
when: _cirros_image_exists.rc != 0
kubernetes.core.k8s_exec:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: "{{ namespace }}"
pod: "{{ _openstackclient_pod }}"
command: >-
openstack image create cirros-0.6.2-x86_64-disk
--disk-format qcow2
--container-format bare
--file /home/cloud-admin/cirros-0.6.2-x86_64-disk.img
--public
11 changes: 11 additions & 0 deletions hooks/playbooks/rally_run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Run Rally benchmarks
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
tasks:
- name: Run rally role
ansible.builtin.include_role:
name: rally
7 changes: 7 additions & 0 deletions roles/rally/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs at https://www.kubernetes.dev/docs/guide/owners/

approvers:
- ciops-team

reviewers:
- ciops-team
95 changes: 95 additions & 0 deletions roles/rally/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# rally
Role to setup and run Rally benchmarking tests against an OpenStack deployment.

Rally is run inside the `quay.io/airshipit/xrally-openstack` container via podman.
OpenStack credentials are discovered automatically from the Kubernetes KeystoneAPI resource,
or can be supplied directly via `cifmw_rally_os_*` variables.

## Prerequisites
- `oc` CLI available and pointing to the target OpenStack cluster (used for credential and CA discovery).
- `cifmw_openstack_namespace` must be set to the OpenStack namespace (typically `openstack`).

### Manila prerequisites

If running Manila benchmarks, the `dhss_true` share type must exist before Rally runs.
Use `manila_create_default_resources.yml` with `share_type_name` and `extra_specs` overrides:

```yaml
pre_tests_80_manila_share_type:
type: playbook
source: manila_create_default_resources.yml
extra_vars:
share_type_name: dhss_true
extra_specs: {}
```

## Privilege escalation
become - Required to install podman and fix artifact directory ownership after the container run.

## Parameters

* `cifmw_rally_artifacts_basedir`: (String) Directory where all Rally artifacts are stored.
Default: `{{ cifmw_basedir }}/tests/rally`
* `cifmw_rally_registry`: (String) Container registry. Default: `quay.io`
* `cifmw_rally_namespace`: (String) Registry namespace. Default: `airshipit`
* `cifmw_rally_container`: (String) Container image name. Default: `xrally-openstack`
* `cifmw_rally_image`: (String) Full image reference. Composed from registry/namespace/container.
* `cifmw_rally_image_tag`: (String) Container image tag. Default: `3.0.0`
* `cifmw_rally_dry_run`: (Boolean) Skip actual container execution. Default: `false`
* `cifmw_rally_remove_container`: (Boolean) Remove container after run. Default: `true`
* `cifmw_rally_fail_on_task_failure`: (Boolean) Fail the play if Rally exits non-zero. Default: `true`
* `cifmw_rally_deployment_name`: (String) Rally deployment name. Default: `cifmw`
* `cifmw_rally_concurrency`: (Integer) Concurrency passed to the Rally task via `--task-args`. Default: `1`
* `cifmw_rally_task_file`: (String) Absolute path to a custom Rally task YAML on the host.
Mutually exclusive with `cifmw_rally_openstack_tests`. Default: `""`
* `cifmw_rally_task_extra_args`: (String) Extra arguments passed verbatim to `rally task start`. Default: `""`
* `cifmw_rally_dns_servers`: (List) DNS servers used inside the Rally container. Default: `["192.168.122.10"]`
* `cifmw_rally_os_auth_url`: (String) OpenStack auth URL. Auto-discovered from KeystoneAPI if unset.
* `cifmw_rally_os_username`: (String) OpenStack username. Default: `admin`
* `cifmw_rally_os_password`: (String) OpenStack password. Auto-discovered from Kubernetes secret if unset.
* `cifmw_rally_os_project_name`: (String) OpenStack project. Default: `admin`
* `cifmw_rally_os_user_domain_name`: (String) User domain. Default: `Default`
* `cifmw_rally_os_project_domain_name`: (String) Project domain. Default: `Default`
* `cifmw_rally_os_region_name`: (String) OpenStack region. Default: `regionOne`
* `cifmw_rally_runs`: (List) List of run definitions for sequential multi-run mode.
When empty (default), the role runs once using the top-level `cifmw_rally_*` variables.
When non-empty, the role loops over the list; each entry may override any `cifmw_rally_*`
variable for that run and **must** include a `name` key used to namespace artifacts.
Default: `[]`

## Standalone usage (single run)

```yaml
- hosts: hypervisor
roles:
- role: rally
vars:
cifmw_rally_openstack_tests: "cinder"
cifmw_rally_concurrency: 2
cifmw_rally_fail_on_task_failure: false
```

## Usage via hook (multiple runs)

Add a `post_tests_*` hook in your job vars and define `cifmw_rally_runs`:

```yaml
post_tests_90_rally_run:
type: playbook
source: rally_run.yaml
cifmw_rally_runs:
- name: cinder
cifmw_rally_openstack_tests: "cinder"
cifmw_rally_concurrency: 1
- name: nova
cifmw_rally_openstack_tests: "nova"
cifmw_rally_concurrency: 2
cifmw_rally_fail_on_task_failure: false
```

Each run stores its artifacts under `cifmw_rally_artifacts_basedir/<name>/`.

## Custom task files

To use a custom Rally task file, set `cifmw_rally_task_file` to the absolute path of the
YAML on the hypervisor host (pre-stage it via an earlier hook if needed).
36 changes: 36 additions & 0 deletions roles/rally/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "cifmw_rally"
cifmw_rally_artifacts_basedir: "{{ cifmw_basedir }}/tests/rally"
cifmw_rally_registry: "quay.io"
cifmw_rally_namespace: "airshipit"
cifmw_rally_container: "xrally-openstack"
cifmw_rally_image: "{{ cifmw_rally_registry }}/{{ cifmw_rally_namespace }}/{{ cifmw_rally_container }}"
cifmw_rally_image_tag: "3.0.0"
cifmw_rally_dry_run: false
cifmw_rally_remove_container: true
cifmw_rally_fail_on_task_failure: true
cifmw_rally_deployment_name: "cifmw"
cifmw_rally_concurrency: 1
cifmw_rally_task_file: ""
cifmw_rally_openstack_tests: ""
cifmw_rally_task_extra_args: ""
cifmw_rally_dns_servers:
- "192.168.122.10"
cifmw_rally_runs: []
29 changes: 29 additions & 0 deletions roles/rally/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


galaxy_info:
author: CI Framework
description: CI Framework Role -- rally
company: Red Hat
license: Apache-2.0
min_ansible_version: "2.14"
namespace: cifmw
galaxy_tags:
- cifmw
- rally

dependencies: []
24 changes: 24 additions & 0 deletions roles/rally/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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: Converge
hosts: all
vars:
cifmw_rally_dry_run: true
Comment thread
evallesp marked this conversation as resolved.
cifmw_rally_openstack_tests: "cinder"
roles:
- role: "rally"
9 changes: 9 additions & 0 deletions roles/rally/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Mainly used to override the defaults set in .config/molecule/
# By default, it uses the "config_podman.yml" - in CI, it will use
# "config_local.yml".
log: true

provisioner:
name: ansible
log: true
28 changes: 28 additions & 0 deletions roles/rally/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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: Prepare
hosts: all
vars:
cifmw_basedir: "{{ ansible_user_dir }}/ci-framework-data"
cifmw_install_yamls_tasks_out: "{{ ansible_user_dir }}/zuul-jobs/roles/install_yamls_makes/tasks"
cifmw_install_yamls_defaults:
NAMESPACE: openstack
roles:
- role: test_deps
- role: ci_setup
- role: install_yamls
Loading
Loading