forked from cloud-bulldozer/benchmark-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
95 lines (74 loc) · 2.96 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
- hosts: localhost
collections:
- operator_sdk.util
gather_facts: no
tasks:
- include_role:
name: "kernel_cache_drop"
when: workload.args.drop_cache_kernel is defined
- name: Get update from Cerberus if connected
block:
- include_role:
name: "cerberus"
when: cerberus_url is defined and cerberus_url != ""
- name: Get state
k8s_facts:
api_version: ripsaw.cloudbulldozer.io/v1alpha1
kind: Benchmark
name: '{{ meta.name }}'
namespace: '{{ operator_namespace }}'
register: cr_state
- name: Capture operator information
k8s_facts:
kind: Pod
api_version: v1
namespace: "{{ operator_namespace }}"
label_selectors:
- name = benchmark-operator
register: bo
- debug:
msg: "{{ cr_state }}"
- name: Set Workload UUID
block:
- include_role:
name: "uuid"
- name: Setting the uuid for the benchmark
operator_sdk.util.k8s_status:
api_version: ripsaw.cloudbulldozer.io/v1alpha1
kind: Benchmark
name: "{{ meta.name }}"
namespace: "{{ operator_namespace }}"
status:
uuid: "{{ uuid }}"
complete: false
suuid: "{{ trunc_uuid }}"
metadata: "not collected"
cerberus: "not connected"
when: workload is defined and (cr_state.resources[0].status is not defined or cr_state.resources[0].status.uuid is not defined)
- name: Run Workload
block:
- set_fact:
uuid: "{{ cr_state.resources[0].status.uuid }}"
trunc_uuid: "{{ cr_state.resources[0].status.suuid }}"
- block:
- include_role:
name: backpack
when: metadata is defined and not metadata.targeted | default('true') | bool
- operator_sdk.util.k8s_status:
api_version: ripsaw.cloudbulldozer.io/v1alpha1
kind: Benchmark
name: "{{ meta.name }}"
namespace: "{{ operator_namespace }}"
status:
metadata: "Collecting"
when: metadata is defined and metadata.targeted | default('true') | bool and not cr_state.resources[0].status.state is defined
when: metadata is defined and metadata.collection | default('false') | bool and (cr_state.resources[0].status.metadata is defined and cr_state.resources[0].status.metadata != "Complete")
- block:
- include_role:
name: "common"
- include_role:
name: "{{ workload.name }}"
vars:
workload_args: "{{ workload.args }}"
when: metadata is not defined or not metadata.collection | default('false') | bool or (cr_state.resources[0].status.metadata is defined and cr_state.resources[0].status.metadata == "Complete") or metadata.targeted | default('true') | bool
when: cr_state is defined and cr_state.resources[0].status is defined and not cr_state.resources[0].status.complete|bool and (cr_state.resources[0].status.state is not defined or cr_state.resources[0].status.state != "Error")