From 3b030aa40d03099751051b83f842f486d950705e Mon Sep 17 00:00:00 2001
From: "Lo, Chi (cl566n)" <cl566n@att.com>
Date: Thu, 15 Apr 2021 13:03:42 -0700
Subject: [PATCH] Removed hard-coded value for backendPort

This change will retrieve the backend port from values.yaml
instead of a hard-coded value.

Change-Id: I27630d3ead2c8a517f4fe8577e8396776010f9a8
---
 prometheus/Chart.yaml                        | 2 +-
 prometheus/templates/ingress-prometheus.yaml | 3 ++-
 releasenotes/notes/prometheus.yaml           | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/prometheus/Chart.yaml b/prometheus/Chart.yaml
index 9651a63fae..2e55df3131 100644
--- a/prometheus/Chart.yaml
+++ b/prometheus/Chart.yaml
@@ -15,7 +15,7 @@ apiVersion: v1
 appVersion: v2.25.0
 description: OpenStack-Helm Prometheus
 name: prometheus
-version: 0.1.8
+version: 0.1.9
 home: https://prometheus.io/
 sources:
   - https://github.com/prometheus/prometheus
diff --git a/prometheus/templates/ingress-prometheus.yaml b/prometheus/templates/ingress-prometheus.yaml
index f17b6790ec..60b928407d 100644
--- a/prometheus/templates/ingress-prometheus.yaml
+++ b/prometheus/templates/ingress-prometheus.yaml
@@ -14,7 +14,8 @@ limitations under the License.
 
 {{- if and .Values.manifests.ingress .Values.network.prometheus.ingress.public }}
 {{- $envAll := . -}}
-{{- $ingressOpts := dict "envAll" $envAll "backendService" "prometheus" "backendServiceType" "monitoring" "backendPort" "https" -}}
+{{- $port := tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" }}
+{{- $ingressOpts := dict "envAll" $envAll "backendService" "prometheus" "backendServiceType" "monitoring" "backendPort" $port -}}
 {{- $secretName := $envAll.Values.secrets.tls.monitoring.prometheus.internal -}}
 {{- if and .Values.manifests.certificates $secretName -}}
 {{- $_ := set $ingressOpts "certIssuer" .Values.endpoints.monitoring.host_fqdn_override.default.tls.issuerRef.name -}}
diff --git a/releasenotes/notes/prometheus.yaml b/releasenotes/notes/prometheus.yaml
index 8d6f4ab17c..879f6b5cdc 100644
--- a/releasenotes/notes/prometheus.yaml
+++ b/releasenotes/notes/prometheus.yaml
@@ -9,4 +9,5 @@ prometheus:
   - 0.1.6 Upgrade version to v2.25 fix/remove deprecated flags
   - 0.1.7 Enable TLS for Prometheus
   - 0.1.8 Change readiness probe from /status to /-/ready
+  - 0.1.9 Retrieve backend port name from values.yaml
 ...