From b95db2a673a0f72da12c1f97f318990214dcef08 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sun, 15 Oct 2023 02:35:36 -0300 Subject: [PATCH] Refreshes Images in Case of New Image --- deploy.sh | 3 +++ refresh.sh | 19 +++++++++++++++++++ setup.py | 1 + 3 files changed, 23 insertions(+) create mode 100755 refresh.sh diff --git a/deploy.sh b/deploy.sh index 9c8eb9a..152b02f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -111,6 +111,9 @@ function main() { fi + # Refreshes all pods in case of a new image + bash ./refresh.sh + exit 0 } diff --git a/refresh.sh b/refresh.sh new file mode 100755 index 0000000..3d2a6ed --- /dev/null +++ b/refresh.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +NAMESPACES=( + portfolio +) + +DEPLOYMENTS=( + "frontend-deployment" + "backend-deployment" + "storage-deployment" + "storage-processor-deployment" +) + +for i in "${NAMESPACES[@]}"; do + for x in "${DEPLOYMENTS[@]}"; do + PODS=$(kubectl -n $i get pods --no-headers | awk '{print $1}' | grep $x | tr '\n' ' ') + kubectl -n $i delete pods $PODS + done +done diff --git a/setup.py b/setup.py index d9466b7..f8edc4b 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ def write_template(template: str, output: str): open(output, 'w') as output: output.write(envsubst(template.read())) + def configure_templates(environment: str): if not environment in ("prod", "staging", "local"): raise ValueError("Invalid Environment Selected")