heapster.j2 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. apiVersion: "v1"
  2. kind: "ReplicationController"
  3. metadata:
  4. name: heapster
  5. labels:
  6. metrics-infra: heapster
  7. name: heapster
  8. spec:
  9. selector:
  10. name: heapster
  11. replicas: {{replica_count}}
  12. template:
  13. version: v1
  14. metadata:
  15. name: heapster
  16. labels:
  17. metrics-infra: heapster
  18. name: heapster
  19. spec:
  20. serviceAccountName: heapster
  21. {% if node_selector is iterable and node_selector | length > 0 %}
  22. nodeSelector:
  23. {% for key, value in node_selector.items() %}
  24. {{key}}: "{{value}}"
  25. {% endfor %}
  26. {% endif %}
  27. containers:
  28. - name: heapster
  29. image: {{ openshift_metrics_heapster_image }}
  30. imagePullPolicy: IfNotPresent
  31. ports:
  32. - containerPort: 8082
  33. name: "http-endpoint"
  34. command:
  35. - "heapster-wrapper.sh"
  36. - "--wrapper.allowed_users_file=/secrets/heapster.allowed-users"
  37. - "--source=kubernetes.summary_api:${MASTER_URL}?useServiceAccount=true&kubeletHttps=true&kubeletPort=10250"
  38. - "--tls_cert=/heapster-certs/tls.crt"
  39. - "--tls_key=/heapster-certs/tls.key"
  40. - "--tls_client_ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
  41. - "--allowed_users=%allowed_users%"
  42. - "--metric_resolution={{openshift_metrics_resolution}}"
  43. {% if not openshift_metrics_heapster_standalone %}
  44. - "--wrapper.username_file=/hawkular-account/hawkular-metrics.username"
  45. - "--wrapper.password_file=/hawkular-account/hawkular-metrics.password"
  46. - "--wrapper.endpoint_check=https://hawkular-metrics:443/hawkular/metrics/status"
  47. - "--sink=hawkular:https://hawkular-metrics:443?tenant=_system&labelToTenant=pod_namespace&labelNodeId={{openshift_metrics_node_id}}&caCert=/hawkular-metrics-certs/tls.crt&user=%username%&pass=%password%&filter=label(container_name:^system.slice.*|^user.slice)&concurrencyLimit={{ openshift_metrics_heapster_concurrency_limit }}"
  48. {% endif %}
  49. env:
  50. - name: STARTUP_TIMEOUT
  51. value: "{{ openshift_metrics_startup_timeout }}"
  52. {% if ((openshift_metrics_heapster_limits_cpu is defined and openshift_metrics_heapster_limits_cpu is not none)
  53. or (openshift_metrics_heapster_limits_memory is defined and openshift_metrics_heapster_limits_memory is not none)
  54. or (openshift_metrics_heapster_requests_cpu is defined and openshift_metrics_heapster_requests_cpu is not none)
  55. or (openshift_metrics_heapster_requests_memory is defined and openshift_metrics_heapster_requests_memory is not none))
  56. %}
  57. resources:
  58. {% if (openshift_metrics_heapster_limits_cpu is not none
  59. or openshift_metrics_heapster_limits_memory is not none)
  60. %}
  61. limits:
  62. {% if openshift_metrics_heapster_limits_cpu is not none %}
  63. cpu: "{{openshift_metrics_heapster_limits_cpu}}"
  64. {% endif %}
  65. {% if openshift_metrics_heapster_limits_memory is not none %}
  66. memory: "{{openshift_metrics_heapster_limits_memory}}"
  67. {% endif %}
  68. {% endif %}
  69. {% if (openshift_metrics_heapster_requests_cpu is not none
  70. or openshift_metrics_heapster_requests_memory is not none)
  71. %}
  72. requests:
  73. {% if openshift_metrics_heapster_requests_cpu is not none %}
  74. cpu: "{{openshift_metrics_heapster_requests_cpu}}"
  75. {% endif %}
  76. {% if openshift_metrics_heapster_requests_memory is not none %}
  77. memory: "{{openshift_metrics_heapster_requests_memory}}"
  78. {% endif %}
  79. {% endif %}
  80. {% endif %}
  81. volumeMounts:
  82. - name: heapster-secrets
  83. mountPath: "/secrets"
  84. - name: heapster-certs
  85. mountPath: "/heapster-certs"
  86. {% if not openshift_metrics_heapster_standalone %}
  87. - name: hawkular-metrics-certs
  88. mountPath: "/hawkular-metrics-certs"
  89. - name: hawkular-metrics-account
  90. mountPath: "/hawkular-account"
  91. readinessProbe:
  92. exec:
  93. command:
  94. - "/opt/heapster-readiness.sh"
  95. {% endif %}
  96. volumes:
  97. - name: heapster-secrets
  98. secret:
  99. secretName: heapster-secrets
  100. - name: heapster-certs
  101. secret:
  102. secretName: heapster-certs
  103. {% if not openshift_metrics_heapster_standalone %}
  104. - name: hawkular-metrics-certs
  105. secret:
  106. secretName: hawkular-metrics-certs
  107. - name: hawkular-metrics-account
  108. secret:
  109. secretName: hawkular-metrics-account
  110. {% endif %}