From f36dcea22111ec1b0e821741d4ed087468587a8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miko=C5=82aj=20Stefaniak?= <mstefaniak@google.com>
Date: Tue, 11 Jun 2024 10:29:56 +0200
Subject: [PATCH] fix: metrics endpoint not accesible from remote hosts (#49)

---
 config/default/manager_config_patch.yaml | 5 +++--
 config/prometheus/gmp.yaml               | 2 +-
 config/prometheus/monitor.yaml           | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml
index 8d7716d..d526cf4 100644
--- a/config/default/manager_config_patch.yaml
+++ b/config/default/manager_config_patch.yaml
@@ -22,6 +22,9 @@ spec:
     spec:
       containers:
       - name: manager
+        ports:
+        - containerPort: 8080
+          name: metrics
         env:
         - name: POD_NAMESPACE
           valueFrom:
@@ -29,5 +32,3 @@ spec:
               fieldPath: metadata.namespace
         - name: "LEADER_ELECTION"
           value: "true"
-        - name: METRICS_PROBE_BIND_ADDR
-          value: "127.0.0.1:8080"
diff --git a/config/prometheus/gmp.yaml b/config/prometheus/gmp.yaml
index 176fb94..ef27810 100644
--- a/config/prometheus/gmp.yaml
+++ b/config/prometheus/gmp.yaml
@@ -31,5 +31,5 @@ spec:
     matchLabels:
       control-plane: controller-manager
   endpoints:
-  - port: 8080
+  - port: metrics
     interval: 30s
diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml
index 599a4b0..30956f3 100644
--- a/config/prometheus/monitor.yaml
+++ b/config/prometheus/monitor.yaml
@@ -28,7 +28,7 @@ metadata:
   namespace: system
 spec:
   endpoints:
-    - targetPort: 8080
+    - port: metrics
   selector:
     matchLabels:
       control-plane: controller-manager