From 083f8fd8d6082f8ae94d61690dcef3b4eeb07cce Mon Sep 17 00:00:00 2001
From: Steve Wilkerson <wilkers.steve@gmail.com>
Date: Mon, 5 Mar 2018 10:11:08 -0600
Subject: [PATCH] Prometheus: use endpoints section and lookups to set port

This PS moves prometheus to use the endpoints section and lookups
to set the port it serves on.

Change-Id: Ifae665e21128dd566da5a68b9904a94a68df4018
---
 prometheus/templates/service.yaml     | 2 +-
 prometheus/templates/statefulset.yaml | 4 ++--
 prometheus/values.yaml                | 1 -
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/prometheus/templates/service.yaml b/prometheus/templates/service.yaml
index 34e2e6772..5789727ee 100644
--- a/prometheus/templates/service.yaml
+++ b/prometheus/templates/service.yaml
@@ -31,7 +31,7 @@ metadata:
 spec:
   ports:
   - name: prom-metrics
-    port: {{ .Values.network.prometheus.port }}
+    port: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
     {{ if .Values.network.prometheus.node_port.enabled }}
     nodePort: {{ .Values.network.prometheus.node_port.port }}
     {{ end }}
diff --git a/prometheus/templates/statefulset.yaml b/prometheus/templates/statefulset.yaml
index df3e8ef8b..946768631 100644
--- a/prometheus/templates/statefulset.yaml
+++ b/prometheus/templates/statefulset.yaml
@@ -121,11 +121,11 @@ spec:
 {{ tuple $envAll $envAll.Values.pod.resources.prometheus | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
           ports:
             - name: prom-metrics
-              containerPort: {{ .Values.network.prometheus.port }}
+              containerPort: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
           readinessProbe:
             httpGet:
               path: /status
-              port: {{ .Values.network.prometheus.port }}
+              port: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
             initialDelaySeconds: 30
             timeoutSeconds: 30
           volumeMounts:
diff --git a/prometheus/values.yaml b/prometheus/values.yaml
index 86fbf458b..10fffb584 100644
--- a/prometheus/values.yaml
+++ b/prometheus/values.yaml
@@ -160,7 +160,6 @@ network:
     node_port:
       enabled: false
       port: 30900
-    port: 9090
 
 storage:
   enabled: true