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
219 changes: 219 additions & 0 deletions ci/chargeback_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
---
- name: "Verify logging projects, endpoints, credentials, nodes, pods, services, manifests and subscriptions"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars_files:
- vars/osp18_env.yml
vars:
common_pod_test_id: ""
common_pod_status_str: "Running"
common_pod_nspace: openstack-operators
common_pod_list:
- telemetry-operator-controller-manager
- openstack-operator-controller-manager

common_subscription_test_id: ""
common_subscription_nspace: openshift-operators-redhat
common_subscription_list:
- loki-operator

common_project_test_id: ""
common_project_list:
- openshift-openstack-infra
- openshift
- openstack-operators
- openshift-logging

common_endpoint_test_id: ""
common_endpoint_list:
- [nova,compute,public]
- [nova,compute,internal]
- [placement,placement,public]
- [placement,placement,internal]
- [swift,object-store,public]
- [swift,object-store,internal]
- [cinderv3,volumev3,public]
- [cinderv3,volumev3,internal]
- [barbican,key-manager,public]
- [barbican,key-manager,internal]
- [keystone,identity,public]
- [keystone,identity,internal]
- [glance,image,public]
- [glance,image,internal]
- [neutron,network,public]
- [neutron,network,internal]

common_manifest_test_id: ""
common_manifest_list:
- "loki-operator 2"
- "loki-helm-operator 1"

common_service_test_id: ""
common_service_nspace: openshift-logging
common_service_list:
- cluster-logging-operator-metrics
- logging-loki-compactor-grpc
- logging-loki-compactor-http
- logging-loki-distributor-grpc
- logging-loki-distributor-http
- logging-loki-gateway-http
- logging-loki-gossip-ring
- logging-loki-index-gateway-grpc
- logging-loki-index-gateway-http
- logging-loki-ingester-grpc
- logging-loki-ingester-http
- logging-loki-querier-grpc
- logging-loki-querier-http
- logging-loki-query-frontend-grpc
- logging-loki-query-frontend-http
- openstack-logging

tasks:
- name: "Verify logging infrastructure components"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods are running in openstack"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: ""
common_pod_status_str: "Running"
common_pod_nspace: openstack
common_pod_list:
- openstackclient
tasks:
- name: "Verify Running Pods"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods are running in openshift-operators-redhat"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: ""
common_pod_status_str: "Running"
common_pod_nspace: openshift-operators-redhat
common_pod_list:
- loki-operator-controller-manager
tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common

- name: "Verify logging pods are running in openshift-logging"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: ""
common_pod_status_str: "Running"
common_pod_nspace: openshift-logging
common_pod_list:
- cluster-logging-operator
- logging-loki-compactor
- logging-loki-distributor
- logging-loki-index-gateway
- logging-loki-ingester
- logging-loki-querier
- logging-loki-query-frontend
- collector

tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common

- name: "Verify logging pods are running in minio-dev"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: ""
common_pod_status_str: "Running"
common_pod_nspace: minio-dev
common_pod_list:
- minio
tasks:
- name: "Run pod running tests"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods have complete status in openstack"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: ""
common_pod_nspace: openstack
common_pod_status_str: "Completed"
common_pod_list:
- bootstrap-edpm-deployment-openstack-edpm-ipam
- configure-network-edpm-deployment-openstack-edpm-ipam
- configure-os-edpm-deployment-openstack-edpm-ipam
- install-certs-edpm-deployment-openstack-edpm-ipam
- install-os-edpm-deployment-openstack-edpm-ipam
- libvirt-edpm-deployment-openstack-edpm-ipam
- logging-edpm-deployment-openstack-edpm-ipam
- neutron-metadata-edpm-deployment-openstack-edpm-ipam
- ovn-edpm-deployment-openstack-edpm-ipam
- reboot-os-edpm-deployment-openstack-edpm-ipam
- run-os-edpm-deployment-openstack-edpm-ipam
- ssh-known-hosts-edpm-deployment
- telemetry-edpm-deployment-openstack-edpm-ipam
- validate-network-edpm-deployment-openstack-edpm-ipam
tasks:
- name: "Run pods completed tests"
ansible.builtin.import_role:
name: common


- name: "Verify the crds exist"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_service_test_id: ""
common_service_nspace: openstack
common_service_list:
- nova-internal
- nova-metadata-internal
- nova-novncproxy-cell1-public
- nova-public
common_crd_test_id: ""
common_crd_list:
- alertingrules.loki.grafana.com
- lokistacks.loki.grafana.com
- recordingrules.loki.grafana.com
- rulerconfigs.loki.grafana.com
tasks:
- name: "Run Services and CRD tests"
ansible.builtin.import_role:
name: common
51 changes: 51 additions & 0 deletions roles/observe_chargeback/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Ansible Playbook: CloudKitty ChargeBack Validation
=========

This Ansible playbook validates and enforces the configuration of the OpenStack CloudKitty (chargeback) service. It performs a series of tests to ensure that the CloudKitty rating modules are in the correct state and that the `hashmap` module has the correct priority.

Playbook Files
---------

* **`main.yml`**: The main playbook entry point. It includes the `chargeback_tests.yml` file to execute the validation logic.
* **`chargeback_tests.yml`**: This task file contains the sequence of steps used to validate and configure the CloudKitty service.

Workflow
---------

The `chargeback_tests.yml` playbook executes the following steps:

1. **Get Module Status**: It first runs the `{{ openstack_cmd }} rating module list` command to fetch the current status of all CloudKitty rating modules.

2. **Validate Module States**: It uses an `assert` task to test for specific, expected conditions. The playbook will **fail** if these are not met:
* The `noop` module must be **enabled** (`True`).
* The `hashmap` module must be **enabled** (`True`).
* The `pyscripts` module must be **disabled** (`False`).

3. `Check Hashmap Priority`: It runs a shell command to find the current priority value of the `hashmap` module.

4. `Set Hashmap Priority`: It idempotently sets the `hashmap` module's priority to `100`. This task is skipped if the priority is already set to `100`.



Requirements
---------

This playbook relies on an Ansible variable, `openstack_cmd`, which must be defined when running the playbook.

This variable must contain the full command necessary to execute OpenStack CLI commands (e.g., `/usr/bin/openstack` or simply `openstack` if it's in the system's PATH).
The host running the playbook must have access to the OpenStack environment and the necessary credentials loaded for the CLI to function.


Usage
---------

You can run this playbook using the `ansible-playbook` command. You must pass the `openstack_cmd` variable as an extra argument.

Example of running the playbook in bash shell:
``ansible-playbook main.yml -e "openstack_cmd=/usr/bin/openstack``


Author Information
------------------

Alex Yefimov
3 changes: 3 additions & 0 deletions roles/observe_chargeback/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
chargeback_test_id: ""

Loading