From e54aac81bac422edd285f7871113b73bc9b7924b Mon Sep 17 00:00:00 2001 From: Lalith Kota Date: Mon, 27 Jan 2025 14:08:26 +0530 Subject: [PATCH] Helm Chart: Istio hostname fix Signed-off-by: Lalith Kota --- charts/websub/templates/gateway.yaml | 7 +++++-- charts/websub/templates/virtualservice.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/websub/templates/gateway.yaml b/charts/websub/templates/gateway.yaml index a1cd9b4..87ae90a 100644 --- a/charts/websub/templates/gateway.yaml +++ b/charts/websub/templates/gateway.yaml @@ -1,5 +1,8 @@ {{- if .Values.istio.enabled }} {{- if .Values.istio.gateway.enabled }} +{{- $istioGatewayHostname := include "common.tplvalues.render" (dict "value" .Values.istio.gateway.host "context" $) }} +{{- $mainHostname := include "common.tplvalues.render" (dict "value" .Values.hostname "context" $) }} +{{- $hostname := default $mainHostname $istioGatewayHostname }} apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: @@ -18,7 +21,7 @@ spec: number: 8080 protocol: HTTP2 hosts: - - {{ default .Values.hostname .Values.istio.gateway.host | quote }} + - {{ $hostname | quote }} {{- if .Values.istio.gateway.httpTlsRedirect }} tls: httpsRedirect: true @@ -30,7 +33,7 @@ spec: number: 8443 protocol: HTTPS hosts: - - {{ default .Values.hostname .Values.istio.gateway.host | quote }} + - {{ $hostname | quote }} tls: {{ toYaml (omit .Values.istio.gateway.tls "enabled") | nindent 6 }} {{- end }} diff --git a/charts/websub/templates/virtualservice.yaml b/charts/websub/templates/virtualservice.yaml index f0bdb87..9eaff45 100644 --- a/charts/websub/templates/virtualservice.yaml +++ b/charts/websub/templates/virtualservice.yaml @@ -1,5 +1,8 @@ {{- if .Values.istio.enabled }} {{- if .Values.istio.virtualservice.enabled }} +{{- $istioVsHostname := include "common.tplvalues.render" (dict "value" .Values.istio.virtualservice.host "context" $) }} +{{- $mainHostname := include "common.tplvalues.render" (dict "value" .Values.hostname "context" $) }} +{{- $hostname := default $mainHostname $istioVsHostname }} apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: @@ -10,14 +13,14 @@ metadata: {{- end }} spec: hosts: - - {{ default .Values.hostname .Values.istio.virtualservice.host | quote }} + - {{ $hostname | quote }} gateways: - {{ default (include "common.names.fullname" .) .Values.istio.virtualservice.gateway }} http: - headers: request: set: - x-forwarded-host: {{ default .Values.hostname .Values.istio.virtualservice.host | quote }} + x-forwarded-host: {{ $hostname | quote }} x-forwarded-proto: https match: - uri: