From e15352805666dfdb98f3bf3a28009ee52d87a72e Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 10 Apr 2024 00:03:26 +0200
Subject: [PATCH] Do not use envsubst

---
 .gitlab-ci.yml                            | 4 ++--
 deploy/overlays/review/kustomization.yaml | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3b0f558a..3e7cee44 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -64,7 +64,7 @@ deploy production:
   script:
     - cd deploy/overlays/production
     - kustomize edit set image registry.edugit.org/teckids/team-pr/teckids.org:$CI_COMMIT_REF_NAME@$(cat ../../../DIGESTFILE)
-    - kustomize build | envsubst > output.yaml
+    - kustomize build > output.yaml
     - kubectl --kubeconfig=/tmp/kubeconfig apply -f output.yaml
   only:
     - master
@@ -83,7 +83,7 @@ deploy review:
   script:
     - cd deploy/overlays/review
     - kustomize edit set image registry.edugit.org/teckids/team-pr/teckids.org:$CI_COMMIT_REF_NAME@$(cat ../../../DIGESTFILE)
-    - kustomize build | envsubst > output.yaml
+    - kustomize build | sed s/__REVIEW_NAME__/$CI_COMMIT_REF_SLUG/g > output.yaml
     - kubectl --kubeconfig=/tmp/kubeconfig apply -f output.yaml
 
 delete review:
diff --git a/deploy/overlays/review/kustomization.yaml b/deploy/overlays/review/kustomization.yaml
index 5ee2add9..58a8bcb9 100644
--- a/deploy/overlays/review/kustomization.yaml
+++ b/deploy/overlays/review/kustomization.yaml
@@ -6,7 +6,7 @@ commonAnnotations:
   source-repository: https://edugit.org/Teckids/team-pr/teckids.org
 commonLabels:
   app: teckids-website
-  environment: ${CI_COMMIT_REF_SLUG}
+  environment: __REVIEW_NAME__
 namespace: teckids-website
 patches:
 - target:
@@ -15,7 +15,10 @@ patches:
   patch: |-
     - op: replace
       path: /spec/rules/0/host
-      value: ${CI_COMMIT_REF_SLUG}.review.teckids.org
+      value: __REVIEW_NAME__.review.teckids.org
     - op: replace
       path: /spec/tls/0/hosts/0
-      value: ${CI_COMMIT_REF_SLUG}.review.teckids.org
+      value: __REVIEW_NAME__.review.teckids.org
+    - op: replace
+      path: /spec/tls/0/secretName
+      value: __REVIEW_NAME__-website-tls
-- 
GitLab