From 735f7b4b16569c70c720d0e71a99ab9ea75449e4 Mon Sep 17 00:00:00 2001
From: Pierre Ozoux <pierre@ozoux.net>
Date: Thu, 24 Feb 2022 11:38:27 +0100
Subject: [PATCH] Scaeldown with argument.

(Sorry it is uggly :/ )
---
 libre | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libre b/libre
index 57322f2..83303d9 100755
--- a/libre
+++ b/libre
@@ -55,7 +55,6 @@ fi
 
 create_update_job_nc () {
   if [ "${APP}" = "nextcloud" ]; then
-    kubectl -n ${NS} scale --replicas=0 deployment/${FQDN}-web
     kubectl -n $NS delete job update-nc
     libre apply ../../common/nextcloud/other-manifests/update-job.yml
   fi
@@ -80,6 +79,9 @@ case "$1" in
     retVal=$? # returns 1 if diff
     if [ $retVal -ne 0 ]; then # if diff
       if [ "$2" = "--batch" ]; then
+        if [ "$3" = "--scaledown" ]; then
+          kubectl -n ${NS} scale --replicas=0 deployment/${FQDN}-app
+        fi
         cat /tmp/diff | grep -v "value:\|image\|generation\|+++\|---\|@@\|diff" | grep "^+\|^-"
         retVal=$? # returns 1 if grep
         if [ $retVal -ne 1 ]; then
@@ -89,7 +91,6 @@ case "$1" in
         cat /tmp/diff
         read -p "Ctrl-c to not apply the diff"
       fi
-      kubectl -n ${NS} scale --replicas=0 deployment/${FQDN}-app
       create_update_job_nc
       libre apply
     else
-- 
GitLab