Skip to content
Draft
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
4 changes: 4 additions & 0 deletions roles/telemetry_verify_metrics/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
condition_type: Ready
tags: precheck

- name: Verify kube-rbac-proxy
ansible.builtin.include_tasks:
file: verify_rbac.yml

- name: Verify RabbitMQ metrics are being exposed and stored
ansible.builtin.include_tasks:
file: verify_rabbitmq_metrics.yml
Expand Down
78 changes: 78 additions & 0 deletions roles/telemetry_verify_metrics/tasks/verify_rbac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
- name: Verify the container exist in the prometheus-metric-storage-0
ansible.builtin.shell: |
oc describe pod prometheus-metric-storage-0
register: result
changed_when: false

- name: Print the result of rometheus-metric-storage-0
ansible.builtin.debug:
var: result.stdout_lines


- name: Verify kube-rbac-proxy is up and running
ansible.builtin.shell: |
oc logs prometheus-metric-storage-0 -c kube-rbac-proxy
register: result
changed_when: false

- name: Print the result of metrics
ansible.builtin.debug:
var: result.stdout_lines

- name: Create Service Account to Test
ansible.builtin.shell: |
oc apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: proxy-test
namespace: openstack
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: openstack-operator-metrics-reader
subjects:
- kind: ServiceAccount
name: proxy-test
namespace: openstack
EOF
changed_when: false

- name: Verify metrics through proxy
ansible.builtin.shell: |
oc exec -it openstackclient -- curl -v -k -H "Authorization: Bearer $(oc create token proxy-test)" https://metric-storage-prometheus:8443/metrics
register: result
changed_when: false

- name: Print the result of metrics
ansible.builtin.debug:
var: result.stdout_lines

- name: Print kube-rbac-proxy logs
ansible.builtin.shell: |
oc logs prometheus-metric-storage-0 -c kube-rbac-proxy
register: result
changed_when: false

- name: Print the result of metrics
ansible.builtin.debug:
var: result.stdout_lines

- name: Verify all clusterroles
ansible.builtin.shell: |
oc get clusterrole
register: result
changed_when: false

- name: Print the result of clusterroles
ansible.builtin.debug:
var: result.stdout_lines