Skip to content

Commit

Permalink
Merge branch 'master' into alexy_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie authored Aug 7, 2024
2 parents ce8e96e + 11dc0d0 commit 474a140
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 17 deletions.
19 changes: 12 additions & 7 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
override-checkout: main
- name: github.com/openstack-k8s-operators/telemetry-operator
override-checkout: main
irrelevant-files:
irrelevant-files: &irrelevant_files
- .github/.*
- ci/github/.*
- callback_plugins/.*
Expand Down Expand Up @@ -63,17 +63,22 @@
override-checkout: main
- name: github.com/openstack-k8s-operators/telemetry-operator
override-checkout: main
irrelevant-files:
- .github/.*
- ci/github/.*
- callback_plugins/.*
- README*
- .*/*.md
irrelevant-files: *irrelevant_files

name: feature-verification-tests-noop
parent: noop
description: |
A job that always passes. Runs when there's a change to jobs that don't
need full zuul to run but still need to report a pass.
run:
- ci/noop.yml
files: *irrelevant_files

- project:
name: infrawatch/feature-verification-tests
github-check:
jobs:
- feature-verification-tests-noop
- openstack-k8s-operators-content-provider:
override-checkout: main
- functional-tests-on-osp18
Expand Down
6 changes: 6 additions & 0 deletions ci/github/test_logger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@
when: true
fail:
msg: "If the task fails, the status will be reported since there's a test ID."

- name: "Set the name based on a var input"
set_fact:
testid: "RHOSO-1234"
- name: "run test with variable name - {{ testid }}"
debug: msg="test"
1 change: 1 addition & 0 deletions ci/github/test_logger_expected
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ RHELOSP-042=passed
RHELOSP-043=passed
RHELOSP-054=passed
RHOSO-078=failed
RHOSO-1234=passed
5 changes: 5 additions & 0 deletions ci/noop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
tasks:
- ansible.builtin.debug:
msg: "Do nothing"
15 changes: 6 additions & 9 deletions ci/run_playbooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
tags:
- setup

- name: Run telemetry tests on OSP18
block:
- name: "Run telemetry tests playbook locally on the target host"
ansible.builtin.shell:
cmd: |
Expand All @@ -80,13 +78,12 @@
ansible.builtin.copy:
content: "{{ output.stdout }}"
dest: "{{ logs_dir }}/ansible_run.log"


- name: Revert the version update
ansible.builtin.shell:
cmd: |
oc patch openstackversions controlplane --type json -p='[{"op": "replace", "path": "/spec/customContainerImages", "value": {} }]'
when: "{{ patch_openstackversions | bool }}"
always:
- name: Revert the version update
ansible.builtin.shell:
cmd: |
oc patch openstackversions controlplane --type json -p='[{"op": "replace", "path": "/spec/customContainerImages", "value": {} }]'
when: "{{ patch_openstackversions | bool }}"

- name: Include report result
ansible.builtin.include_tasks:
Expand Down
20 changes: 19 additions & 1 deletion roles/telemetry_autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ Requirements
------------
The following resources are required in the OpenStack cloud
* network called public
* network called provate
* network called private
* security group called basic with ssh and tcp enabled to the VMs
* a flavor called m1.small
* an image called cirros

Tests:
------
Verify overcloud deployment for autoscaling
Test service API endpoints
Verify all the services are running on overcloud
Verify time-series database service is available
Using the heat service for autoscaling
Create an archive policy
Configure heat template for automatically scaling instances
Create the deployment template for heat to control instance scaling
Create stack deployment for autoscaling
Verify that the stack and resources are created
Verify that the alarms were created for the stack
Verify the deployment and metric resources exist for the stack
Testing and troubleshooting autoscaling
Verify that alarms are triggered with traffic
Verify that Orchestration service has scaled the instances

Role Variables
--------------

Expand Down
6 changes: 6 additions & 0 deletions roles/telemetry_autoscaling/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
include_vars: "{{ item }}"
with_items: "{{ vars_files }}"

- name: RHOSO-12666 Test services are enabled for autoscaling
when: metrics_backend == "prometheus"
ansible.builtin.include_tasks:
file: test_services.yml
tags: precheck

- name: Check pre-reqs for autoscaling
ansible.builtin.include_tasks:
file: verify_autoscaling.yml
Expand Down
35 changes: 35 additions & 0 deletions roles/telemetry_autoscaling/tasks/test_services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Verify Orchestration (heat) and telemetry services resources are ready for autoscaling

- name: Verify that custom resource HEAT is ready
ansible.builtin.command:
cmd: |
oc get heat heat -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}'
register: result
failed_when:
- result.stdout != "True"

- name: Verify that custom resource CEILOMETER is ready
ansible.builtin.command:
cmd: |
oc get ceilometer ceilometer -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}'
register: result
failed_when:
- result.stdout != "True"

# - name: Verify that custom resource AUTOSCALING is ready
# It is returning an unexpected response and needs further debugging. will raise another PR to inspect this
# ansible.builtin.command:
# cmd: |
# oc get autoscaling autoscaling -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}'
# register: result
# failed_when:
# - result.stdout != "True"

- name: Verify that custom resource METRICSTORAGE is ready
ansible.builtin.command:
cmd: |
oc get metricstorage metric-storage -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}'
register: result
failed_when:
- result.stdout != "True"
9 changes: 9 additions & 0 deletions roles/telemetry_autoscaling/tasks/verify_autoscaling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@
{{ openstack_cmd }} metric status --fit-width;
register: result
failed_when: result.rc >= 1

# This works when using prometheus as the metrics backend
- name: Verify that PROMETHEUS is enabled
when: metrics_backend == "prometheus"
ansible.builtin.shell: |
{{ openstack_cmd }} metric query up --disable-rbac -c container -c value |grep -i "prometheus" |awk '{print $4}'
register: result
failed_when:
- result.stdout != "0"
53 changes: 53 additions & 0 deletions roles/telemetry_logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
telemetry_logging
=========

Test logging in Openstack

Requirements
------------

Role Variables
--------------

For journal_tests.yml

identifiers_test_id
- polarion id for test
identifiers_list
- Lists identifier strings to look for in the journalctl of the compute nodes


Dependencies
------------

Openstack on Openshift deployed and logging enabled for Openstack

Example Playbook
----------------

Each tasks/playbook.yml should be called independently via "ansible.builtin.import_role" with appropriate vars passed:

- name: "Verify logging journalctl identifiers"
hosts: computes
gather_facts: no
vars:
identifiers_test_id: "RHOSO-12681"
identifiers_list:
- ceilometer_agent_compute
- nova_compute

tasks:
- name: "Verify journalctl logging identifiers"
ansible.builtin.import_role:
name: telemetry_logging


License
-------

Apache 2

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

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
53 changes: 53 additions & 0 deletions roles/telemetry_logging/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
galaxy_info:
author: Alex Yefimov
description: Tests that logging is set up as expected in OpenSTack running on OpenShift
company: Red Hat

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: Apache-2.0

min_ansible_version: "2.1"

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
10 changes: 10 additions & 0 deletions roles/telemetry_logging/tasks/journal_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Get journals
ansible.builtin.shell:
cmd:
tstamp=$(date -d '30 minute ago' "+%Y-%m-%d %H:%M:%S")
journalctl -t "{{ item }}" --no-pager -S "${tstamp}" | wc -l
register: journal_wc
changed_when: false
failed_when:
- journal_wc.stdout | int <= 1
5 changes: 5 additions & 0 deletions roles/telemetry_logging/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: "Verify journal entries - {{ journal_test_id }}"
when: journal_list is defined
ansible.builtin.include_tasks: "journal_tests.yml"
loop: "{{ identifiers_list }}"

0 comments on commit 474a140

Please sign in to comment.