hawkular_metrics_rc.j2 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. containers:
  21. - image: {{openshift_metrics_image_prefix}}metrics-hawkular-metrics:{{openshift_metrics_image_version}}
  22. name: hawkular-metrics
  23. ports:
  24. - name: http-endpoint
  25. containerPort: 8080
  26. - name: https-endpoint
  27. containerPort: 8443
  28. - name: ping
  29. containerPort: 8888
  30. command:
  31. - "/opt/hawkular/scripts/hawkular-metrics-wrapper.sh"
  32. - "-b"
  33. - 0.0.0.0
  34. - "-Dhawkular.metrics.cassandra.nodes=hawkular-cassandra"
  35. - "-Dhawkular.metrics.cassandra.use-ssl"
  36. - "-Dhawkular.metrics.openshift.auth-methods=openshift-oauth,htpasswd"
  37. - "-Dhawkular.metrics.openshift.htpasswd-file=/secrets/hawkular-metrics.htpasswd.file"
  38. - "-Dhawkular.metrics.allowed-cors-access-control-allow-headers=authorization"
  39. - "-Dhawkular.metrics.default-ttl={{openshift_metrics_duration}}"
  40. - "-Dhawkular-alerts.cassandra-nodes=hawkular-cassandra"
  41. - "-Dhawkular-alerts.cassandra-use-ssl"
  42. - "-Dhawkular.alerts.openshift.auth-methods=openshift-oauth,htpasswd"
  43. - "-Dhawkular.alerts.openshift.htpasswd-file=/secrets/hawkular-metrics.htpasswd.file"
  44. - "-Dhawkular.alerts.allowed-cors-access-control-allow-headers=authorization"
  45. - "-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
  46. - "-Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true"
  47. - "-DKUBERNETES_MASTER_URL={{openshift_metrics_master_url}}"
  48. - "-DUSER_WRITE_ACCESS={{openshift_metrics_hawkular_user_write_access}}"
  49. - "--hmw.keystore=/secrets/hawkular-metrics.keystore"
  50. - "--hmw.truststore=/secrets/hawkular-metrics.truststore"
  51. - "--hmw.keystore_password_file=/secrets/hawkular-metrics.keystore.password"
  52. - "--hmw.truststore_password_file=/secrets/hawkular-metrics.truststore.password"
  53. - "--hmw.jgroups_keystore=/secrets/hawkular-metrics.jgroups.keystore"
  54. - "--hmw.jgroups_keystore_password_file=/secrets/hawkular-metrics.jgroups.keystore.password"
  55. - "--hmw.jgroups_alias_file=/secrets/hawkular-metrics.jgroups.alias"
  56. env:
  57. - name: POD_NAMESPACE
  58. valueFrom:
  59. fieldRef:
  60. fieldPath: metadata.namespace
  61. - name: MASTER_URL
  62. value: "{{ openshift_metrics_master_url }}"
  63. - name: OPENSHIFT_KUBE_PING_NAMESPACE
  64. valueFrom:
  65. fieldRef:
  66. fieldPath: metadata.namespace
  67. - name: OPENSHIFT_KUBE_PING_LABELS
  68. value: "metrics-infra=hawkular-metrics,name=hawkular-metrics"
  69. - name: STARTUP_TIMEOUT
  70. value: "{{ openshift_metrics_startup_timeout }}"
  71. volumeMounts:
  72. - name: hawkular-metrics-secrets
  73. mountPath: "/secrets"
  74. - name: hawkular-metrics-client-secrets
  75. mountPath: "/client-secrets"
  76. {% if ((openshift_metrics_hawkular_limits_cpu is defined and openshift_metrics_hawkular_limits_cpu is not none)
  77. or (openshift_metrics_hawkular_limits_memory is defined and openshift_metrics_hawkular_limits_memory is not none)
  78. or (openshift_metrics_hawkular_requests_cpu is defined and openshift_metrics_hawkular_requests_cpu is not none)
  79. or (openshift_metrics_hawkular_requests_memory is defined and openshift_metrics_hawkular_requests_memory is not none))
  80. %}
  81. resources:
  82. {% if (openshift_metrics_hawkular_limits_cpu is not none
  83. or openshift_metrics_hawkular_limits_memory is not none)
  84. %}
  85. limits:
  86. {% if openshift_metrics_hawkular_limits_cpu is not none %}
  87. cpu: "{{openshift_metrics_hawkular_limits_cpu}}"
  88. {% endif %}
  89. {% if openshift_metrics_hawkular_limits_memory is not none %}
  90. memory: "{{openshift_metrics_hawkular_limits_memory}}"
  91. {% endif %}
  92. {% endif %}
  93. {% if (openshift_metrics_hawkular_requests_cpu is not none
  94. or openshift_metrics_hawkular_requests_memory is not none)
  95. %}
  96. requests:
  97. {% if openshift_metrics_hawkular_requests_cpu is not none %}
  98. cpu: "{{openshift_metrics_hawkular_requests_cpu}}"
  99. {% endif %}
  100. {% if openshift_metrics_hawkular_requests_memory is not none %}
  101. memory: "{{openshift_metrics_hawkular_requests_memory}}"
  102. {% endif %}
  103. {% endif %}
  104. {% endif %}
  105. readinessProbe:
  106. exec:
  107. command:
  108. - "/opt/hawkular/scripts/hawkular-metrics-readiness.py"
  109. livenessProbe:
  110. exec:
  111. command:
  112. - "/opt/hawkular/scripts/hawkular-metrics-liveness.py"
  113. volumes:
  114. - name: hawkular-metrics-secrets
  115. secret:
  116. secretName: hawkular-metrics-secrets
  117. - name: hawkular-metrics-client-secrets
  118. secret:
  119. secretName: hawkular-metrics-account