hawkular_metrics_rc.j2 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. apiVersion: v1
  2. kind: ReplicationController
  3. metadata:
  4. name: hawkular-metrics
  5. labels:
  6. metrics-infra: hawkular-metrics
  7. name: hawkular-metrics
  8. spec:
  9. selector:
  10. name: hawkular-metrics
  11. replicas: {{replica_count}}
  12. template:
  13. version: v1
  14. metadata:
  15. labels:
  16. metrics-infra: hawkular-metrics
  17. name: hawkular-metrics
  18. spec:
  19. serviceAccount: hawkular
  20. {% if node_selector is iterable and node_selector | length > 0 %}
  21. nodeSelector:
  22. {% for key, value in node_selector.items() %}
  23. {{key}}: "{{value}}"
  24. {% endfor %}
  25. {% endif %}
  26. containers:
  27. - image: {{openshift_metrics_image_prefix}}metrics-hawkular-metrics:{{openshift_metrics_image_version}}
  28. imagePullPolicy: IfNotPresent
  29. name: hawkular-metrics
  30. ports:
  31. - name: http-endpoint
  32. containerPort: 8080
  33. - name: https-endpoint
  34. containerPort: 8443
  35. - name: ping
  36. containerPort: 8888
  37. command:
  38. - "/opt/hawkular/scripts/hawkular-metrics-wrapper.sh"
  39. - "-b"
  40. - 0.0.0.0
  41. - "-Dhawkular.metrics.cassandra.nodes=hawkular-cassandra"
  42. - "-Dhawkular.metrics.cassandra.use-ssl"
  43. - "-Dhawkular.metrics.openshift.auth-methods=openshift-oauth,htpasswd"
  44. - "-Dhawkular.metrics.openshift.htpasswd-file=/hawkular-account/hawkular-metrics.htpasswd"
  45. - "-Dhawkular.metrics.allowed-cors-access-control-allow-headers=authorization"
  46. - "-Dhawkular.metrics.default-ttl={{openshift_metrics_duration}}"
  47. - "-Dhawkular.metrics.admin-tenant=_hawkular_admin"
  48. - "-Dhawkular-alerts.cassandra-nodes=hawkular-cassandra"
  49. - "-Dhawkular-alerts.cassandra-use-ssl"
  50. - "-Dhawkular.alerts.openshift.auth-methods=openshift-oauth,htpasswd"
  51. - "-Dhawkular.alerts.openshift.htpasswd-file=/hawkular-account/hawkular-metrics.htpasswd"
  52. - "-Dhawkular.alerts.allowed-cors-access-control-allow-headers=authorization"
  53. - "-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
  54. - "-Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true"
  55. - "-Dcom.datastax.driver.FORCE_NIO=true"
  56. - "-DKUBERNETES_MASTER_URL={{openshift_metrics_master_url}}"
  57. - "-DUSER_WRITE_ACCESS={{openshift_metrics_hawkular_user_write_access}}"
  58. - "-Dhawkular.metrics.jmx-reporting-enabled"
  59. env:
  60. - name: POD_NAMESPACE
  61. valueFrom:
  62. fieldRef:
  63. fieldPath: metadata.namespace
  64. - name: MASTER_URL
  65. value: "{{ openshift_metrics_master_url }}"
  66. - name: JGROUPS_PASSWORD
  67. value: "{{ 17 | oo_random_word }}"
  68. - name: TRUSTSTORE_AUTHORITIES
  69. value: "/hawkular-metrics-certs/tls.truststore.crt"
  70. - name: ENABLE_PROMETHEUS_ENDPOINT
  71. value: "{{ openshift_metrics_hawkular_enable_prometheus_endpoint }}"
  72. - name: OPENSHIFT_KUBE_PING_NAMESPACE
  73. valueFrom:
  74. fieldRef:
  75. fieldPath: metadata.namespace
  76. - name: OPENSHIFT_KUBE_PING_LABELS
  77. value: "metrics-infra=hawkular-metrics,name=hawkular-metrics"
  78. - name: STARTUP_TIMEOUT
  79. value: "{{ openshift_metrics_startup_timeout }}"
  80. volumeMounts:
  81. - name: hawkular-metrics-certs
  82. mountPath: "/hawkular-metrics-certs"
  83. - name: hawkular-metrics-account
  84. mountPath: "/hawkular-account"
  85. {% if ((openshift_metrics_hawkular_limits_cpu is defined and openshift_metrics_hawkular_limits_cpu is not none)
  86. or (openshift_metrics_hawkular_limits_memory is defined and openshift_metrics_hawkular_limits_memory is not none)
  87. or (openshift_metrics_hawkular_requests_cpu is defined and openshift_metrics_hawkular_requests_cpu is not none)
  88. or (openshift_metrics_hawkular_requests_memory is defined and openshift_metrics_hawkular_requests_memory is not none))
  89. %}
  90. resources:
  91. {% if (openshift_metrics_hawkular_limits_cpu is not none
  92. or openshift_metrics_hawkular_limits_memory is not none)
  93. %}
  94. limits:
  95. {% if openshift_metrics_hawkular_limits_cpu is not none %}
  96. cpu: "{{openshift_metrics_hawkular_limits_cpu}}"
  97. {% endif %}
  98. {% if openshift_metrics_hawkular_limits_memory is not none %}
  99. memory: "{{openshift_metrics_hawkular_limits_memory}}"
  100. {% endif %}
  101. {% endif %}
  102. {% if (openshift_metrics_hawkular_requests_cpu is not none
  103. or openshift_metrics_hawkular_requests_memory is not none)
  104. %}
  105. requests:
  106. {% if openshift_metrics_hawkular_requests_cpu is not none %}
  107. cpu: "{{openshift_metrics_hawkular_requests_cpu}}"
  108. {% endif %}
  109. {% if openshift_metrics_hawkular_requests_memory is not none %}
  110. memory: "{{openshift_metrics_hawkular_requests_memory}}"
  111. {% endif %}
  112. {% endif %}
  113. {% endif %}
  114. readinessProbe:
  115. exec:
  116. command:
  117. - "/opt/hawkular/scripts/hawkular-metrics-readiness.py"
  118. livenessProbe:
  119. exec:
  120. command:
  121. - "/opt/hawkular/scripts/hawkular-metrics-liveness.py"
  122. volumes:
  123. - name: hawkular-metrics-certs
  124. secret:
  125. secretName: hawkular-metrics-certs
  126. - name: hawkular-metrics-account
  127. secret:
  128. secretName: hawkular-metrics-account