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