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
12 changes: 12 additions & 0 deletions roles/ocp-28597-metrics/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace: ocp-28597-metrics

migration_sample_name: "{{ namespace }}"
migration_plan_name: "{{ migration_sample_name }}-migplan-{{ ansible_date_time.epoch }}"
migration_name: "{{ migration_sample_name }}-mig-{{ ansible_date_time.epoch }}"
with_deploy: true
with_migrate: true
with_cleanup: true
with_validate: true
pv: false
quiesce: false

4 changes: 4 additions & 0 deletions roles/ocp-28597-metrics/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Validate metrics work
import_tasks: validate-target.yml
when: (with_validate|bool) and (with_migrate|bool)

37 changes: 37 additions & 0 deletions roles/ocp-28597-metrics/tasks/validate-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- name: Add label to namespace {{ migration_namespace }}
shell: "{{ oc_binary }} label ns {{ migration_namespace }} openshift.io/cluster-monitoring=true"


- name: To get namespace {{ migration_namespace }} definition
shell: "{{ oc_binary }} get ns {{ migration_namespace }} -o yaml"
register: output

- debug:
msg: "{{ output }}"

- fail:
msg: "Add label openshift.io/cluster-monitoring=true to ns {{ migration_namespace }} failed"
when: not (output.stdout is search("openshift.io/cluster-monitoring"))

- name: To check service migration-operator-metrics is running
shell: "{{ oc_binary }} get service -n {{ migration_namespace }}"
register: service_info

- debug:
msg: "{{ service_info }}"

- fail:
msg: "Failed to find service/migration-operator-metrics in namespace {{ migration_namespace }}"
when: not (service_info.stdout is search("migration-operator-metrics"))

- name: To get metrics from migration-controller pod
shell: "{{ oc_binary }} -n {{ migration_namespace }} rsh $({{ oc_binary }} get pod -n {{ migration_namespace }}|awk '/migration-controller/ {print $1}') curl http://mig-controller-metrics.openshift-migration.svc.cluster.local:2112/metrics"
register: metrics_info

- debug:
msg: "{{ metrics_info }}"

- fail:
msg: "Failed to get cam_app_workload_migrations metrics from migration-controller pod"
when: not (metrics_info.stdout is search("cam_app_workload_migrations"))