From f910ecde81bb2306bd73041150bcafc6c727556f Mon Sep 17 00:00:00 2001 From: dyn Date: Wed, 17 Dec 2025 13:46:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(p3):=20better=20argo=20wait?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dyn --- p3/scripts/argo-install.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/p3/scripts/argo-install.sh b/p3/scripts/argo-install.sh index 52a1b4d..0747eb9 100755 --- a/p3/scripts/argo-install.sh +++ b/p3/scripts/argo-install.sh @@ -3,24 +3,38 @@ k3d cluster create inception-of-things # Setup a metrics-server to prevent dumb errors -# kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml -# kubectl patch deployment metrics-server -n kube-system --type='json' \ -# -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]' +kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml +kubectl patch deployment metrics-server -n kube-system --type='json' \ + -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]' kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml echo ">" -echo "> ArgoCD is starting (this takes around ~4 minutes)..." +echo "> ArgoCD is starting (this takes around ~5 minutes)..." echo ">" +sleep 10 +echo '> Starting watch...' +sleep 5 -kubectl wait --namespace argocd \ - --for=condition=ready pod \ - --selector=app.kubernetes.io/name=argocd-server \ - --timeout=600s +# So we have a progress-ish indicator visual +while true; do + ready=$(kubectl get pods -n argocd --no-headers 2>/dev/null | grep -E "([0-9]+)/\1" | wc -l) + total=$(kubectl get pods -n argocd --no-headers 2>/dev/null | wc -l) + + clear + kubectl get pods -n argocd + + if [ "$ready" -eq "$total" ] && [ "$total" -gt 0 ]; then + echo "All ArgoCD pods are ready!" + sleep 5 + break + fi + + sleep 5 +done echo 'ArgoCD is running' -sleep 10 SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" @@ -39,7 +53,7 @@ echo 'App imported in ArgoCD' sleep 10 TRAEFIK_IP=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -echo Traefik ip is : $TRAEFIK_IP +echo Traefik IP is: $TRAEFIK_IP if grep -q argo-app.com /etc/hosts; then sudo sed -i "/argo-app.com/d" /etc/hosts fi