From ea13eed3bf86a8af67785e588449302ab96a6907 Mon Sep 17 00:00:00 2001 From: Jeff Cantrill Date: Tue, 7 Feb 2017 19:54:04 -0500 Subject: fixes 1419839. Install only heapster for openshift_metrics when heapster standalone flag is set --- .../openshift_metrics/tasks/install_heapster.yaml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'roles/openshift_metrics/tasks/install_heapster.yaml') diff --git a/roles/openshift_metrics/tasks/install_heapster.yaml b/roles/openshift_metrics/tasks/install_heapster.yaml index 44bab8ace..c490bcdd3 100644 --- a/roles/openshift_metrics/tasks/install_heapster.yaml +++ b/roles/openshift_metrics/tasks/install_heapster.yaml @@ -13,3 +13,55 @@ replica_count: "{{heapster_replica_count.stdout | default(0)}}" node_selector: "{{openshift_metrics_heapster_nodeselector | default('') }}" changed_when: no + +- set_fact: + heapster_sa_secrets: ["heapster-secrets"] + +- set_fact: + heapster_sa_secrets: "{{ heapster_sa_secrets + [item] }}" + with_items: + - hawkular-metrics-certificate + - hawkular-metrics-account + when: "not {{ openshift_metrics_heapster_standalone | bool }}" + +- name: Generating serviceaccount for heapster + template: src=serviceaccount.j2 dest={{mktemp.stdout}}/templates/metrics-{{obj_name}}-sa.yaml + vars: + obj_name: heapster + labels: + metrics-infra: support + secrets: "{{ heapster_sa_secrets }}" + changed_when: no + +- name: Generate service for heapster + template: src=service.j2 dest={{mktemp.stdout}}/templates/metrics-{{obj_name}}-svc.yaml + vars: + obj_name: heapster + ports: + - {port: 80, targetPort: http-endpoint} + selector: + name: "{{obj_name}}" + labels: + metrics-infra: "{{obj_name}}" + name: "{{obj_name}}" + changed_when: no + +- name: generate cluster-reader role binding for the heapster service account + template: + src: rolebinding.j2 + dest: "{{ mktemp.stdout }}/templates/heapster-rolebinding.yaml" + vars: + cluster: True + obj_name: heapster-cluster-reader + labels: + metrics-infra: heapster + roleRef: + kind: ClusterRole + name: cluster-reader + subjects: + - kind: ServiceAccount + name: heapster + namespace: "{{ openshift_metrics_project }}" + changed_when: no + +- include: generate_heapster_certificates.yaml -- cgit v1.2.3