From 3b22af820b8af6f00a195baa6849d462341b6868 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Thu, 25 May 2023 11:40:57 +0200
Subject: [PATCH] deploy behind main url, redirect from beta

---
 .gitlab-ci.yml                    |  6 +++---
 chart/templates/redirections.yaml | 15 +++++++++++++++
 chart/values.jass-prod.yaml       |  5 ++++-
 3 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 chart/templates/redirections.yaml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e7a21b95..631c2b75 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -154,7 +154,7 @@ build-client-prod:
     - cd client
   variables:
     PATH_TAG: client-static-serve
-    API_URL: "https://jass-beta.pasteur.cloud/api"
+    API_URL: "https://jass.pasteur.fr/api"
 
 
 
@@ -223,10 +223,10 @@ deploy-prod:
   extends: .deploy
   variables:
     NAMESPACE: "jass-prod"
-    PUBLIC_URL: "jass-beta.pasteur.cloud"
+    PUBLIC_URL: "jass.pasteur.fr"
   environment:
     name: "k8sprod-02/jass-prod/${CI_COMMIT_REF_SLUG}"
-    url: "https://jass-beta.pasteur.cloud"
+    url: "https://jass.pasteur.fr"
 
 
 delete-dev-deployment:
diff --git a/chart/templates/redirections.yaml b/chart/templates/redirections.yaml
new file mode 100644
index 00000000..2173c81b
--- /dev/null
+++ b/chart/templates/redirections.yaml
@@ -0,0 +1,15 @@
+{{- if .Values.ingress.redirections -}}
+{{- $target := .Values.ingress.host.name -}}
+{{- range .Values.ingress.redirections.hosts }}
+kind: Ingress
+apiVersion: networking.k8s.io/v1beta1
+metadata:
+  name: {{ printf "redirect-from-%s" . | replace "." "-" | trunc 63 | trimSuffix "-" | quote }}
+  annotations:
+    nginx.ingress.kubernetes.io/temporal-redirect: {{ $target }}
+spec:
+  ingressClassName: external
+  rules:
+    - host: {{ . }}
+{{- end }}
+{{- end }}
diff --git a/chart/values.jass-prod.yaml b/chart/values.jass-prod.yaml
index fd9e8dc4..8ae07f21 100644
--- a/chart/values.jass-prod.yaml
+++ b/chart/values.jass-prod.yaml
@@ -10,4 +10,7 @@ celery:
 
 ingress:
   annotations:
-    kubernetes.io/ingress.class: external
\ No newline at end of file
+    kubernetes.io/ingress.class: external
+  redirections:
+    hosts:
+      - jass-beta.pasteur.cloud
\ No newline at end of file
-- 
GitLab