From 68e057d56a61cd160d0e7a03d236398e903c6cc3 Mon Sep 17 00:00:00 2001
From: Andrew Blanchard <andrew.blanchard@leapfrog.ai>
Date: Thu, 15 Apr 2021 21:29:58 +0000
Subject: [PATCH] #350 Updated the HAProxy config to only configure rules for
 alert manager and prometheus if they are enabled.

---
 chart/templates/haproxy/values.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/chart/templates/haproxy/values.yaml b/chart/templates/haproxy/values.yaml
index 807b2f28b0..66dfc0d219 100644
--- a/chart/templates/haproxy/values.yaml
+++ b/chart/templates/haproxy/values.yaml
@@ -65,22 +65,33 @@ config: |
     unique-id-format %{+X}o\ 1-%[date,hex,bytes(8,8),lower]-%[capture.req.hdr(3)]
     http-request set-header X-Amzn-Trace-Id Root=%[unique-id,lower]
     bind :8080
+{{- if and .Values.istio.sso.enabled }}
     acl host_kiali hdr(host) -i kiali.{{ .Values.hostname }}
     acl host_tracing hdr(host) -i tracing.{{ .Values.hostname }}
+{{- end }}
+{{- if and .Values.monitoring.enabled .Values.monitoring.sso.enabled }}
     acl host_alertmanager hdr(host) -i alertmanager.{{ .Values.hostname }}
     acl host_prometheus hdr(host) -i prometheus.{{ .Values.hostname }}
+{{- end }}
 
     option forwardfor
+{{- if and .Values.istio.sso.enabled }}
     use_backend kiali_main if host_kiali
     use_backend tracing_main if host_tracing
+{{- end }}
+{{- if and .Values.monitoring.enabled .Values.monitoring.sso.enabled }}
     use_backend alertmanager_main if host_alertmanager
     use_backend prometheus_main if host_prometheus
+{{- end }} 
+{{- if and .Values.istio.sso.enabled }}
   backend kiali_main
     mode http
     server kiali kiali.istio-system.svc.cluster.local:20001
   backend tracing_main
     mode http
     server jaeger tracing.istio-system.svc.cluster.local:80
+{{- end }}
+{{- if and .Values.monitoring.enabled .Values.monitoring.sso.enabled }}
   backend alertmanager_main
     mode http
     option forwardfor
@@ -91,6 +102,7 @@ config: |
     option forwardfor
     http-request replace-header Host .* monitoring-monitoring-kube-prometheus.monitoring.svc.cluster.local
     server prometheus monitoring-monitoring-kube-prometheus.monitoring.svc.cluster.local:9090
+{{- end }}
 
 image:
   repository: registry1.dso.mil/ironbank/opensource/haproxy/haproxy22
-- 
GitLab