summaryrefslogtreecommitdiffstats
path: root/roles/openshift_metrics/templates/hawkular_openshift_agent_ds.j2
blob: 40d09e9fa54f9c84ebb030a25867ad42742c137a (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
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: hawkular-openshift-agent
  labels:
    name: hawkular-openshift-agent
    metrics-infra: agent
  namespace: {{openshift_metrics_hawkular_agent_namespace}}
spec:
  selector:
    matchLabels:
      name: hawkular-openshift-agent
  template:
    metadata:
      labels:
        name: hawkular-openshift-agent
        metrics-infra: agent
    spec:
      serviceAccount: hawkular-openshift-agent
{% if node_selector is iterable and node_selector | length > 0 %}
      nodeSelector:
{% for key, value in node_selector.iteritems() %}
        {{key}}: "{{value}}"
{% endfor %}
{% endif %}
      containers:
      - image: {{openshift_metrics_image_prefix}}metrics-hawkular-openshift-agent:{{openshift_metrics_image_version}}
        imagePullPolicy: IfNotPresent
        name: hawkular-openshift-agent
{% if ((openshift_metrics_hawkular_agent_limits_cpu is defined and openshift_metrics_hawkular_agent_limits_cpu is not none)
   or (openshift_metrics_hawkular_agent_limits_memory is defined and openshift_metrics_hawkular_agent_limits_memory is not none)
   or (openshift_metrics_hawkular_agent_requests_cpu is defined and openshift_metrics_hawkular_agent_requests_cpu is not none)
   or (openshift_metrics_hawkular_agent_requests_memory is defined and openshift_metrics_hawkular_agent_requests_memory is not none))
%}
        resources:
{% if (openshift_metrics_hawkular_agent_limits_cpu is not none
   or openshift_metrics_hawkular_agent_limits_memory is not none)
%}
          limits:
{% if openshift_metrics_hawkular_agent_limits_cpu is not none %}
            cpu: "{{openshift_metrics_hawkular_agent_limits_cpu}}"
{% endif %}
{% if openshift_metrics_hawkular_agent_limits_memory is not none %}
            memory: "{{openshift_metrics_hawkular_agent_limits_memory}}"
{% endif %}
{% endif %}
{% if (openshift_metrics_hawkular_agent_requests_cpu is not none
   or openshift_metrics_hawkular_agent_requests_memory is not none)
%}
          requests:
{% if openshift_metrics_hawkular_agent_requests_cpu is not none %}
            cpu: "{{openshift_metrics_hawkular_agent_requests_cpu}}"
{% endif %}
{% if openshift_metrics_hawkular_agent_requests_memory is not none %}
            memory: "{{openshift_metrics_hawkular_agent_requests_memory}}"
{% endif %}
{% endif %}
{% endif %}

        livenessProbe:
          httpGet:
            scheme: HTTP
            path: /health
            port: 8080
          initialDelaySeconds: 30
          periodSeconds: 30
        command:
          - "hawkular-openshift-agent"
          - "-config"
          - "/hawkular-openshift-agent-configuration/config.yaml"
          - "-v"
          - "3"
        env:
        - name: K8S_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: K8S_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        volumeMounts:
        - name: hawkular-openshift-agent-configuration
          mountPath: "/hawkular-openshift-agent-configuration"
      volumes:
      - name: hawkular-openshift-agent-configuration
        configMap:
          name: hawkular-openshift-agent-configuration
      - name: hawkular-openshift-agent
        configMap:
          name: hawkular-openshift-agent-configuration