install_hawkular.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. - command: >
  3. {{ openshift.common.client_binary }} -n {{ openshift_metrics_project | quote }}
  4. --config={{ mktemp.stdout }}/admin.kubeconfig
  5. get rc hawkular-metrics -o jsonpath='{.spec.replicas}'
  6. register: hawkular_metrics_replica_count
  7. failed_when: false
  8. changed_when: false
  9. - name: generate hawkular-metrics replication controller
  10. template:
  11. src: hawkular_metrics_rc.j2
  12. dest: "{{ mktemp.stdout }}/templates/hawkular_metrics_rc.yaml"
  13. vars:
  14. replica_count: "{{hawkular_metrics_replica_count.stdout | default(0)}}"
  15. node_selector: "{{openshift_metrics_hawkular_nodeselector | default('') }}"
  16. changed_when: false
  17. - name: read hawkular-metrics route destination ca certificate
  18. slurp: src={{ mktemp.stdout }}/ca.crt
  19. register: metrics_route_dest_ca_cert
  20. changed_when: false
  21. - block:
  22. - set_fact: hawkular_key={{ lookup('file', openshift_metrics_hawkular_key) }}
  23. when: openshift_metrics_hawkular_key is exists
  24. changed_when: false
  25. - set_fact: hawkular_cert={{ lookup('file', openshift_metrics_hawkular_cert) }}
  26. when: openshift_metrics_hawkular_cert is exists
  27. changed_when: false
  28. - set_fact: hawkular_ca={{ lookup('file', openshift_metrics_hawkular_ca) }}
  29. when: openshift_metrics_hawkular_ca is exists
  30. changed_when: false
  31. - name: generate the hawkular-metrics route
  32. template:
  33. src: route.j2
  34. dest: "{{ mktemp.stdout }}/templates/hawkular-metrics-route.yaml"
  35. vars:
  36. name: hawkular-metrics
  37. annotations: "{{ openshift_metrics_hawkular_route_annotations }}"
  38. labels:
  39. metrics-infra: hawkular-metrics
  40. host: "{{ openshift_metrics_hawkular_hostname }}"
  41. to:
  42. kind: Service
  43. name: hawkular-metrics
  44. tls:
  45. termination: reencrypt
  46. key: "{{ hawkular_key | default('') }}"
  47. certificate: "{{ hawkular_cert | default('') }}"
  48. ca_certificate: "{{ hawkular_ca | default('') }}"
  49. destination_ca_certificate: "{{ metrics_route_dest_ca_cert.content | b64decode }}"
  50. changed_when: false