From b868e51ed4e81d3dd64e4cfedd891b8d73d9ceea Mon Sep 17 00:00:00 2001 From: Antonin Filippi Date: Wed, 23 Apr 2025 07:18:40 +0000 Subject: [PATCH] Supprimer z2/stop-app.sh --- z2/stop-app.sh | 55 -------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 z2/stop-app.sh diff --git a/z2/stop-app.sh b/z2/stop-app.sh deleted file mode 100644 index ccabdca..0000000 --- a/z2/stop-app.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Delete Kubernetes objects in reverse order - -# Check if REGION environment variable is set -if [ -z "$REGION" ]; then - # Default region if not set - export REGION="westeurope" - echo "No region specified. Using default region: $REGION" -else - echo "Stopping application in region: $REGION" -fi - -# For AKS deployments, make sure we're connected to the right cluster -if command -v az &> /dev/null; then - echo "Checking AKS connection for region $REGION..." - # You might need to adjust these parameters based on your specific Azure setup - RESOURCE_GROUP="flask-rg-$REGION" - CLUSTER_NAME="flask-aks-$REGION" - - # Try to connect to the Azure cluster - if ! az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --overwrite-existing 2>/dev/null; then - echo "Warning: Could not connect to AKS cluster in $REGION. Continuing with current kubectl context." - else - echo "Successfully connected to AKS cluster in $REGION" - fi -fi - -echo "Stopping application..." - -# Delete Service first to stop incoming traffic -kubectl delete -f service.yaml 2>/dev/null || echo "Service could not be deleted or does not exist." - -# Delete StatefulSet and wait for pods to terminate -kubectl delete -f statefulset.yaml 2>/dev/null || echo "StatefulSet could not be deleted or does not exist." - -# Delete Deployment -kubectl delete -f deployment.yaml 2>/dev/null || echo "Deployment could not be deleted or does not exist." - -# Delete PostgreSQL objects -kubectl delete -f postgres-service.yaml 2>/dev/null || echo "PostgreSQL service could not be deleted or does not exist." -kubectl delete -f postgres-deployment.yaml 2>/dev/null || echo "PostgreSQL deployment could not be deleted or does not exist." - -# Wait for pods to terminate -echo "Waiting for pods to terminate..." -kubectl wait --for=delete pod --selector=app=web-app -n my-app --timeout=60s 2>/dev/null || true -kubectl wait --for=delete pod --selector=app=stateful-app -n my-app --timeout=60s 2>/dev/null || true -kubectl wait --for=delete pod --selector=app=postgres -n my-app --timeout=60s 2>/dev/null || true - -# Delete PersistentVolume and PersistentVolumeClaim -kubectl delete -f persistent-storage.yaml 2>/dev/null || echo "PersistentVolume and PersistentVolumeClaim could not be deleted or do not exist." - -# Delete Namespace (this will delete all resources in the namespace) -kubectl delete -f namespace.yaml 2>/dev/null || echo "Namespace could not be deleted or does not exist." - -echo "Application stopped in region $REGION: All Kubernetes objects have been deleted." \ No newline at end of file