🐛 fix(p3): better argo wait

Signed-off-by: dyn <oss+dyn@xtrm.me>
This commit is contained in:
dyn
2025-12-17 13:46:51 +01:00
parent 072f39cc10
commit f910ecde81

View File

@ -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