diff --git a/neon_diana_utils/configuration.py b/neon_diana_utils/configuration.py index a30b5bc3..39d88a42 100644 --- a/neon_diana_utils/configuration.py +++ b/neon_diana_utils/configuration.py @@ -696,6 +696,10 @@ def configure_klat_chat(external_url: str = None, confirmed = click.confirm(f"Is '{api_url}' correct?") api_subdomain = api_url.split('://', 1)[1].split('.', 1)[0] + forward_www = False + if subdomain != "www": + forward_www = click.prompt(f"Route www.{domain} traffic to Klat?") + # Get Libretranslate HTTP API URL libretranslate_url = "https://libretranslate.2022.us" confirmed = False @@ -790,6 +794,11 @@ def configure_klat_chat(external_url: str = None, {'host': api_subdomain, 'serviceName': 'klat-chat-server', 'servicePort': 8010} ] + if forward_www: + helm_values['klat']['ingress']['rules'].append({ + {'host': 'www', 'serviceName': 'klat-chat-client', + 'servicePort': 8001} + }) with open(join(output_path, "klat-chat", "values.yaml"), 'w') as f: yaml.safe_dump(helm_values, f) else: diff --git a/neon_diana_utils/helm_charts/klat/klat-chat/Chart.yaml b/neon_diana_utils/helm_charts/klat/klat-chat/Chart.yaml index d6f90c5b..6f502ae1 100644 --- a/neon_diana_utils/helm_charts/klat/klat-chat/Chart.yaml +++ b/neon_diana_utils/helm_charts/klat/klat-chat/Chart.yaml @@ -3,5 +3,5 @@ name: klat-chat description: Deploy Klat Services type: application -version: 0.0.4 +version: 0.0.5 appVersion: "1.0.1a13" diff --git a/neon_diana_utils/helm_charts/klat/klat-chat/templates/ingress.yaml b/neon_diana_utils/helm_charts/klat/klat-chat/templates/ingress.yaml index 7213aa2c..a8e64c1d 100644 --- a/neon_diana_utils/helm_charts/klat/klat-chat/templates/ingress.yaml +++ b/neon_diana_utils/helm_charts/klat/klat-chat/templates/ingress.yaml @@ -13,17 +13,30 @@ metadata: annotations: kubernetes.io/ingress.class: {{ .Values.ingress.ingressClassName }} cert-manager.io/issuer: {{ .Values.ingress.certIssuer }} + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" spec: tls: - secretName: {{ .Values.ingress.tlsSecretName }} hosts: {{- range .Values.ingress.rules }} + {{- if eq .host "*" }} + - "*.{{ $.Values.domain }}" + {{- else if eq .host $.Values.domain }} + - {{ $.Values.domain}} + {{- else }} - {{ printf "%s.%s " .host $.Values.domain }} {{- end }} + {{- end }} rules: {{- range .Values.ingress.rules }} + {{- if eq .host "*" }} + - host: "*.{{ $.Values.domain }}" + {{- else if eq .host $.Values.domain }} + - host: {{ $.Values.domain}} + {{- else }} - host: {{ printf "%s.%s " .host $.Values.domain }} + {{- end }} http: paths: - path: / diff --git a/neon_diana_utils/helm_charts/klat/klat-chat/values.yaml b/neon_diana_utils/helm_charts/klat/klat-chat/values.yaml index 68546ad8..2edf2d86 100644 --- a/neon_diana_utils/helm_charts/klat/klat-chat/values.yaml +++ b/neon_diana_utils/helm_charts/klat/klat-chat/values.yaml @@ -26,7 +26,7 @@ resources: ingress: enabled: True ingressClassName: nginx - tlsSecretName: tls-letsencrypt-prod + tlsSecretName: tls-letsencrypt-klat certIssuer: letsencrypt-private-key rules: - host: klat diff --git a/neon_diana_utils/templates/klat/Chart.yaml b/neon_diana_utils/templates/klat/Chart.yaml index 1101be36..7c45d8f0 100644 --- a/neon_diana_utils/templates/klat/Chart.yaml +++ b/neon_diana_utils/templates/klat/Chart.yaml @@ -9,5 +9,5 @@ appVersion: "1.0.1a5" dependencies: - name: klat-chat alias: klat - version: 0.0.4 + version: 0.0.5 repository: https://neongeckocom.github.io/neon-diana-utils \ No newline at end of file