diff options
5 files changed, 32 insertions, 3 deletions
diff --git a/roles/openshift_metrics/tasks/install_hawkular.yaml b/roles/openshift_metrics/tasks/install_hawkular.yaml index 34a8c58b8..b377b6299 100644 --- a/roles/openshift_metrics/tasks/install_hawkular.yaml +++ b/roles/openshift_metrics/tasks/install_hawkular.yaml @@ -1,8 +1,27 @@ --- +- shell: > + {{ openshift.common.client_binary }} -n {{ openshift_metrics_project }} + --config={{ mktemp.stdout }}/admin.kubeconfig + get rc hawkular-metrics --template=\{\{.spec.replicas\}\} || echo 0 + register: hawkular_metrics_replica_count + changed_when: false + - name: generate hawkular-metrics replication controller template: src: hawkular_metrics_rc.j2 dest: "{{ mktemp.stdout }}/templates/hawkular_metrics_rc.yaml" + vars: + replica_count: "{{hawkular_metrics_replica_count.stdout}}" + +- shell: > + {{ openshift.common.client_binary }} -n {{ openshift_metrics_project }} + --config={{ mktemp.stdout }}/admin.kubeconfig + get rc hawkular-cassandra-{{node}} --template=\{\{.spec.replicas\}\} || echo 0 + vars: + node: "{{ item }}" + register: cassandra_replica_count + changed_when: false + with_sequence: count={{ openshift_metrics_cassandra_replicas }} - name: generate hawkular-cassandra replication controllers template: @@ -11,6 +30,7 @@ vars: node: "{{ item }}" master: "{{ (item == '1')|string|lower }}" + replica_count: "{{cassandra_replica_count.results[item|int - 1].stdout}}" with_sequence: count={{ openshift_metrics_cassandra_replicas }} - name: generate hawkular-cassandra persistent volume claims diff --git a/roles/openshift_metrics/tasks/install_heapster.yaml b/roles/openshift_metrics/tasks/install_heapster.yaml index a8f849a88..63ea7e943 100644 --- a/roles/openshift_metrics/tasks/install_heapster.yaml +++ b/roles/openshift_metrics/tasks/install_heapster.yaml @@ -1,3 +1,12 @@ --- +- shell: > + {{ openshift.common.client_binary }} -n {{ openshift_metrics_project }} + --config={{ mktemp.stdout }}/admin.kubeconfig + get rc heapster --template=\{\{.spec.replicas\}\} || echo 0 + register: heapster_replica_count + changed_when: false + - name: Generate heapster replication controller template: src=heapster.j2 dest={{mktemp.stdout}}/templates/metrics-heapster-rc.yaml + vars: + replica_count: "{{heapster_replica_count.stdout}}" diff --git a/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 b/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 index 9a1c446cd..48ef3290d 100644 --- a/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 +++ b/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 @@ -9,7 +9,7 @@ metadata: spec: selector: name: hawkular-cassandra-{{ node }} - replicas: 0 + replicas: {{replica_count}} template: version: v1 metadata: diff --git a/roles/openshift_metrics/templates/hawkular_metrics_rc.j2 b/roles/openshift_metrics/templates/hawkular_metrics_rc.j2 index 1397276e6..e6954ea44 100644 --- a/roles/openshift_metrics/templates/hawkular_metrics_rc.j2 +++ b/roles/openshift_metrics/templates/hawkular_metrics_rc.j2 @@ -8,7 +8,7 @@ metadata: spec: selector: name: hawkular-metrics - replicas: 0 + replicas: {{replica_count}} template: version: v1 metadata: diff --git a/roles/openshift_metrics/templates/heapster.j2 b/roles/openshift_metrics/templates/heapster.j2 index f64c6696e..eeca03be0 100644 --- a/roles/openshift_metrics/templates/heapster.j2 +++ b/roles/openshift_metrics/templates/heapster.j2 @@ -8,7 +8,7 @@ metadata: spec: selector: name: heapster - replicas: 0 + replicas: {{replica_count}} template: version: v1 metadata: |