install_heapster.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ---
  2. - command: >
  3. {{ openshift_client_binary }} -n {{ openshift_metrics_project | quote }}
  4. --config={{ mktemp.stdout }}/admin.kubeconfig
  5. get rc heapster -o jsonpath='{.spec.replicas}'
  6. register: heapster_replica_count
  7. failed_when: false
  8. changed_when: no
  9. - name: Generate heapster replication controller
  10. template: src=heapster.j2 dest={{mktemp.stdout}}/templates/metrics-heapster-rc.yaml
  11. vars:
  12. replica_count: "{{heapster_replica_count.stdout | default(0)}}"
  13. node_selector: "{{openshift_metrics_heapster_nodeselector | default('') }}"
  14. changed_when: no
  15. - set_fact:
  16. heapster_sa_secrets: ["heapster-secrets"]
  17. - set_fact:
  18. heapster_sa_secrets: "{{ heapster_sa_secrets + [item] }}"
  19. with_items:
  20. - hawkular-metrics-certs
  21. - hawkular-metrics-account
  22. when: not openshift_metrics_heapster_standalone | bool
  23. - name: Generating serviceaccount for heapster
  24. template: src=serviceaccount.j2 dest={{mktemp.stdout}}/templates/metrics-{{obj_name}}-sa.yaml
  25. vars:
  26. obj_name: heapster
  27. labels:
  28. metrics-infra: support
  29. secrets: "{{ heapster_sa_secrets }}"
  30. changed_when: no
  31. - name: Generate service for heapster
  32. template: src=service.j2 dest={{mktemp.stdout}}/templates/metrics-{{obj_name}}-svc.yaml
  33. vars:
  34. obj_name: heapster
  35. ports:
  36. - {port: 80, targetPort: http-endpoint}
  37. selector:
  38. name: "{{obj_name}}"
  39. annotations:
  40. service.alpha.openshift.io/serving-cert-secret-name: heapster-certs
  41. labels:
  42. metrics-infra: "{{obj_name}}"
  43. name: "{{obj_name}}"
  44. changed_when: no
  45. - name: generate cluster-reader role binding for the heapster service account
  46. template:
  47. src: rolebinding.j2
  48. dest: "{{ mktemp.stdout }}/templates/heapster-rolebinding.yaml"
  49. vars:
  50. cluster: True
  51. obj_name: heapster-cluster-reader
  52. labels:
  53. metrics-infra: heapster
  54. roleRef:
  55. kind: ClusterRole
  56. name: cluster-reader
  57. subjects:
  58. - kind: ServiceAccount
  59. name: heapster
  60. namespace: "{{ openshift_metrics_project }}"
  61. changed_when: no
  62. - include_tasks: generate_heapster_secrets.yaml