From 3f1409d87db116a3a3fe856bfff0437c12b9672f Mon Sep 17 00:00:00 2001
From: Marc Brugger <github@bakito.ch>
Date: Thu, 19 Oct 2023 05:09:13 +0200
Subject: [PATCH] Correct cilium metrics port mapping (#10519)

Signed-off-by: Marc Brugger <m.brugger@bison-group.com>
---
 roles/network_plugin/cilium/templates/hubble/deploy.yml.j2  | 5 +++++
 roles/network_plugin/cilium/templates/hubble/service.yml.j2 | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/roles/network_plugin/cilium/templates/hubble/deploy.yml.j2 b/roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
index 86533e6e7..f0153d64d 100644
--- a/roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
+++ b/roles/network_plugin/cilium/templates/hubble/deploy.yml.j2
@@ -43,6 +43,11 @@ spec:
           ports:
             - name: grpc
               containerPort: 4245
+{% if cilium_enable_prometheus %}
+            - name: prometheus
+              containerPort: 9966
+              protocol: TCP
+{% endif %}
           readinessProbe:
             tcpSocket:
               port: grpc
diff --git a/roles/network_plugin/cilium/templates/hubble/service.yml.j2 b/roles/network_plugin/cilium/templates/hubble/service.yml.j2
index f1df0ebb2..0f862a9c5 100644
--- a/roles/network_plugin/cilium/templates/hubble/service.yml.j2
+++ b/roles/network_plugin/cilium/templates/hubble/service.yml.j2
@@ -8,7 +8,7 @@ metadata:
   namespace: kube-system
   annotations:
     prometheus.io/scrape: 'true'
-    prometheus.io/port: "9091"
+    prometheus.io/port: "{{ cilium_hubble_scrape_port }}"
   labels:
     k8s-app: hubble
 spec:
@@ -31,6 +31,9 @@ metadata:
   namespace: kube-system
   labels:
     k8s-app: hubble-relay
+  annotations:
+    prometheus.io/scrape: 'true'
+    prometheus.io/port: "9966"
 spec:
   clusterIP: None
   type: ClusterIP
-- 
GitLab