diff options
Diffstat (limited to 'roles/openshift_metrics/tasks')
-rw-r--r-- | roles/openshift_metrics/tasks/scale.yaml | 30 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/start_metrics.yaml | 27 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/stop_metrics.yaml | 27 |
3 files changed, 36 insertions, 48 deletions
diff --git a/roles/openshift_metrics/tasks/scale.yaml b/roles/openshift_metrics/tasks/scale.yaml deleted file mode 100644 index bb4fa621b..000000000 --- a/roles/openshift_metrics/tasks/scale.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get {{object}} - -o jsonpath='{.spec.replicas}' -n {{openshift_metrics_project}} - register: replica_count - failed_when: "replica_count.rc == 1 and 'exists' not in replica_count.stderr" - when: not ansible_check_mode - changed_when: no - -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig scale {{object}} - --replicas={{desired}} -n {{openshift_metrics_project}} - register: scale_result - failed_when: scale_result.rc == 1 and 'exists' not in scale_result.stderr - when: - - replica_count.stdout != (desired | string) - - not ansible_check_mode - changed_when: no - -- name: Waiting for {{object}} to scale to {{desired}} - command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig - get {{object}} -n {{openshift_metrics_project|quote}} -o jsonpath='{.status.replicas}' - register: replica_counts - until: replica_counts.stdout.find("{{desired}}") != -1 - retries: 30 - delay: 10 - when: - - replica_count.stdout != (desired | string) - - not ansible_check_mode diff --git a/roles/openshift_metrics/tasks/start_metrics.yaml b/roles/openshift_metrics/tasks/start_metrics.yaml index c4cae4aff..f02774e47 100644 --- a/roles/openshift_metrics/tasks/start_metrics.yaml +++ b/roles/openshift_metrics/tasks/start_metrics.yaml @@ -10,9 +10,12 @@ changed_when: no - name: Start Hawkular Cassandra - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 1 with_items: "{{metrics_cassandra_rc.stdout_lines}}" loop_control: loop_var: object @@ -28,9 +31,12 @@ changed_when: no - name: Start Hawkular Metrics - include: scale.yaml - vars: - desired: "{{openshift_metrics_hawkular_replicas}}" + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: "{{openshift_metrics_hawkular_replicas}}" with_items: "{{metrics_metrics_rc.stdout_lines}}" loop_control: loop_var: object @@ -46,9 +52,12 @@ changed_when: no - name: Start Heapster - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 1 with_items: "{{metrics_heapster_rc.stdout_lines}}" loop_control: loop_var: object diff --git a/roles/openshift_metrics/tasks/stop_metrics.yaml b/roles/openshift_metrics/tasks/stop_metrics.yaml index bae181e3e..5a73443a8 100644 --- a/roles/openshift_metrics/tasks/stop_metrics.yaml +++ b/roles/openshift_metrics/tasks/stop_metrics.yaml @@ -11,9 +11,12 @@ check_mode: no - name: Stop Heapster - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_heapster_rc.stdout_lines}}" loop_control: loop_var: object @@ -29,9 +32,12 @@ changed_when: "'No resources found' not in metrics_hawkular_rc.stderr" - name: Stop Hawkular Metrics - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_hawkular_rc.stdout_lines}}" loop_control: loop_var: object @@ -46,9 +52,12 @@ changed_when: "'No resources found' not in metrics_cassandra_rc.stderr" - name: Stop Hawkular Cassandra - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_cassandra_rc.stdout_lines}}" loop_control: loop_var: object |