11{{- if .Values.ingressInternal.enabled }}
2+ {{- $appActive := .Values.app.enabled -}}
3+ {{- $realtimeActive := .Values.realtime.enabled -}}
4+ {{- $hasCopilotIngress := and .Values.copilot.enabled .Values.ingressInternal.copilot -}}
5+ {{- $realtimeHasOwnRule := and $realtimeActive (or (not $appActive) (ne .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host)) -}}
26apiVersion : networking.k8s.io/v1
37kind : Ingress
48metadata :
@@ -17,22 +21,32 @@ spec:
1721 {{- if .Values.ingressInternal.tls.enabled }}
1822 tls :
1923 - hosts :
24+ {{- if $appActive }}
2025 - {{ .Values.ingressInternal.app.host | quote }}
21- {{- if and .Values.realtime.enabled (ne .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host) }}
26+ {{- end }}
27+ {{- if $realtimeHasOwnRule }}
2228 - {{ .Values.ingressInternal.realtime.host | quote }}
2329 {{- end }}
24- {{- if and .Values.copilot.enabled .Values.ingressInternal.copilot }}
25- {{- if and (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
30+ {{- if $hasCopilotIngress }}
31+ {{- $copilotHostCovered := false }}
32+ {{- if and $appActive (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) }}
33+ {{- $copilotHostCovered = true }}
34+ {{- end }}
35+ {{- if and $realtimeHasOwnRule (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
36+ {{- $copilotHostCovered = true }}
37+ {{- end }}
38+ {{- if not $copilotHostCovered }}
2639 - {{ .Values.ingressInternal.copilot.host | quote }}
2740 {{- end }}
2841 {{- end }}
2942 secretName : {{ .Values.ingressInternal.tls.secretName }}
3043 {{- end }}
3144 rules :
45+ {{- if $appActive }}
3246 - host : {{ .Values.ingressInternal.app.host | quote }}
3347 http :
3448 paths :
35- {{- if and .Values.realtime.enabled (eq .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host) }}
49+ {{- if and $realtimeActive (eq .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host) }}
3650 {{- range .Values.ingressInternal.realtime.paths }}
3751 - path : {{ .path }}
3852 pathType : {{ .pathType }}
4357 number : {{ $.Values.realtime.service.port }}
4458 {{- end }}
4559 {{- end }}
46- {{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) }}
60+ {{- if and $hasCopilotIngress (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) }}
4761 {{- range .Values.ingressInternal.copilot.paths }}
4862 - path : {{ .path }}
4963 pathType : {{ .pathType }}
6377 port :
6478 number : {{ $.Values.app.service.port }}
6579 {{- end }}
66- {{- if and .Values.realtime.enabled (ne .Values.ingressInternal.realtime.host .Values.ingressInternal.app.host) }}
80+ {{- end }}
81+ {{- if $realtimeHasOwnRule }}
6782 - host : {{ .Values.ingressInternal.realtime.host | quote }}
6883 http :
6984 paths :
7691 port :
7792 number : {{ $.Values.realtime.service.port }}
7893 {{- end }}
79- {{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
94+ {{- if and $hasCopilotIngress (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
8095 {{- range .Values.ingressInternal.copilot.paths }}
8196 - path : {{ .path }}
8297 pathType : {{ .pathType }}
@@ -88,7 +103,15 @@ spec:
88103 {{- end }}
89104 {{- end }}
90105 {{- end }}
91- {{- if and .Values.copilot.enabled .Values.ingressInternal.copilot (and (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) (ne .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host)) }}
106+ {{- if $hasCopilotIngress }}
107+ {{- $copilotServed := false }}
108+ {{- if and $appActive (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.app.host) }}
109+ {{- $copilotServed = true }}
110+ {{- end }}
111+ {{- if and $realtimeHasOwnRule (eq .Values.ingressInternal.copilot.host .Values.ingressInternal.realtime.host) }}
112+ {{- $copilotServed = true }}
113+ {{- end }}
114+ {{- if not $copilotServed }}
92115 - host : {{ .Values.ingressInternal.copilot.host | quote }}
93116 http :
94117 paths :
@@ -101,5 +124,6 @@ spec:
101124 port :
102125 number : {{ $.Values.copilot.server.service.port }}
103126 {{- end }}
127+ {{- end }}
104128 {{- end }}
105129{{- end }}
0 commit comments