🐛 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 k3d cluster create inception-of-things
# Setup a metrics-server to prevent dumb errors # Setup a metrics-server to prevent dumb errors
# kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml 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' \ kubectl patch deployment metrics-server -n kube-system --type='json' \
# -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
kubectl create namespace argocd kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
echo ">" echo ">"
echo "> ArgoCD is starting (this takes around ~4 minutes)..." echo "> ArgoCD is starting (this takes around ~5 minutes)..."
echo ">" echo ">"
sleep 10
echo '> Starting watch...'
sleep 5
kubectl wait --namespace argocd \ # So we have a progress-ish indicator visual
--for=condition=ready pod \ while true; do
--selector=app.kubernetes.io/name=argocd-server \ ready=$(kubectl get pods -n argocd --no-headers 2>/dev/null | grep -E "([0-9]+)/\1" | wc -l)
--timeout=600s 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' echo 'ArgoCD is running'
sleep 10
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
@ -39,7 +53,7 @@ echo 'App imported in ArgoCD'
sleep 10 sleep 10
TRAEFIK_IP=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 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 if grep -q argo-app.com /etc/hosts; then
sudo sed -i "/argo-app.com/d" /etc/hosts sudo sed -i "/argo-app.com/d" /etc/hosts
fi fi