Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions caipe/scripts/refresh-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@

set -euo pipefail

echo "πŸš€ Starting AI Platform Engineering cleanup process..."
echo ""
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}

echo "πŸ”‘ Deleting all secrets in ai-platform-engineering namespace..."
log "[Step 1/5] Starting AI Platform Engineering cleanup process..."

log "[Step 2/5] Deleting all secrets in ai-platform-engineering namespace..."
kubectl delete secret --all -n ai-platform-engineering > /dev/null

echo ""
echo "⏱️ Waiting 1 second for cleanup to complete..."
log "[Step 3/5] Waiting 1 second for cleanup to complete..."
sleep 1

echo ""
echo "πŸ“ Command executed: kubectl delete secret --all -n ai-platform-engineering"
echo ""

echo "πŸ—‘οΈ Deleting all pods in ai-platform-engineering namespace..."
log "[Step 4/5] Deleting all pods in ai-platform-engineering namespace..."
kubectl delete pod --all -n ai-platform-engineering > /dev/null

echo ""
echo "⏳ Sleep for 5s to wait for the new pods to get ready"
log "[Step 5/5] Sleep for 5s to wait for the new pods to get ready"
sleep 5

echo ""
echo "πŸ“Š Current pods in ai-platform-engineering namespace:"
echo "=================================================="
kubectl get pods -n ai-platform-engineering | awk 'NR==1 || !/Running/'

echo ""
echo "βœ… Cleanup process completed successfully!"
echo "🎯 All secrets and pods have been refreshed in the ai-platform-engineering namespace"
NON_RUNNING=$(kubectl get pods -n ai-platform-engineering | awk 'NR>1 && !/Running/')
if [ -n "$NON_RUNNING" ]; then
log " - Non-healty pods in ai-platform-engineering namespace after waiting 5s:"
echo "=================================================="
kubectl get pods -n ai-platform-engineering | awk 'NR==1 || !/Running/'
log "❗ Please check the logs of the pods and fix the issues."
else
log "All pods are running πŸŽ‰"
fi
Loading
Loading