From 7deb8420305506e54c1bd3d26991e0715694a95b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=20Eisenbl=C3=A4tter?= <mark.eisenblaetter@gmail.com>
Date: Thu, 15 Nov 2018 00:01:35 +0100
Subject: [PATCH] calico-node: add prometheus annotations (#3645)

add prometheus annotations to calico-node if
calico_felix_prometheusmetricsenabled is enabled.

This will allow a kubernetes_sd to automaticly find the pods and start
scraping.
---
 roles/network_plugin/calico/templates/calico-node.yml.j2 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/roles/network_plugin/calico/templates/calico-node.yml.j2 b/roles/network_plugin/calico/templates/calico-node.yml.j2
index dfee56134..4ce24a476 100644
--- a/roles/network_plugin/calico/templates/calico-node.yml.j2
+++ b/roles/network_plugin/calico/templates/calico-node.yml.j2
@@ -21,6 +21,10 @@ spec:
         # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
         scheduler.alpha.kubernetes.io/critical-pod: ''
         kubespray.etcd-cert/serial: "{{ etcd_client_cert_serial }}"
+{% if calico_felix_prometheusmetricsenabled %}
+        prometheus.io/scrape: 'true'
+        prometheus.io/port: "{{ calico_felix_prometheusmetricsport }}"
+{% endif %}
     spec:
 {% if kube_version is version('v1.11.1', '>=') %}
       priorityClassName: system-node-critical
-- 
GitLab