From fa0fe88403cc3a760c7b93a4a97d8b8233bc3d4e Mon Sep 17 00:00:00 2001
From: Andri Joos <andri@joos.io>
Date: Wed, 9 Aug 2023 15:43:20 +0200
Subject: [PATCH] ingress file option in .deploy_job_template in .gitlab-ci.yml

---
 .gitlab-ci.yml | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 91b72a6..9732483 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -185,6 +185,7 @@ variables:
 ## DEPLOYMENT_NAME
 ## NAMESPACE
 # Optional vars:
+## INGRESS_FILE
 ## OPT_KUBECTL_CMD
 ## MOUNT
 ## MOUNT_PARAMS # repocopy will replace current file
@@ -217,6 +218,7 @@ variables:
     - kubectl rollout restart deployment -n $NAMESPACE $DEPLOYMENT_NAME
     - kubectl rollout status deployment -n $NAMESPACE $DEPLOYMENT_NAME
     - echo "only deployment $DEPLOYMENT_NAME in namespace $NAMESPACE restarted. please restart any helper deployments (like databases) manually"
+    - if ! [ -z "$INGRESS_FILE" ]; then if [ "$PROD" = "true" ]; then kubectl apply -f "$INGRESS_FILE"; else kubectl apply -f ${INGRESS_FILE/ingress/testingress}; fi; fi;
 
 
 # prepare env scripts
@@ -321,8 +323,6 @@ prepare_scripts:
   artifacts:
     expire_in: 1 week
     paths:
-      - prod_ingress_config.yaml
-      - test_ingress_config.yaml
       - distribution_ingress_config.yaml
       - ingress_deployment.yaml
       - endpoints.yaml
@@ -839,17 +839,6 @@ configure_ingress_entries:
     - kubectl delete -f endpoints.yaml --ignore-not-found=true
     - kubectl apply -f endpoints.yaml
     - kubectl apply -f distribution_ingress_config.yaml
-    - >
-      if [ "$PROD" = "true" ]; then
-        echo "applying prod ingress config"
-        $CHANGE_KUBECTL_CONTEXT_PROD_CMD
-        kubectl apply -f prod_ingress_config.yaml
-      else
-        $CHANGE_KUBECTL_CONTEXT_TEST_CMD
-        echo "applying test ingress config"
-        kubectl apply -f test_ingress_config.yaml
-        $CHANGE_KUBECTL_CONTEXT_PROD_CMD
-      fi
 
     # - $KUBECTL_USE_CONTEXT_TEST_CMD
     # - kubectl apply -f test_ingress_config.yaml
-- 
GitLab