Skip to content

Commit

Permalink
add check for kafka readyz
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam0Brien committed Jan 9, 2025
1 parent 8f763d0 commit d6e0b3a
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions scripts/start-inventory-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ kubectl apply -f deploy/kind/relations/spicedb-kind-setup/relations-api/svc.yaml


echo "Waiting for all pods to be ready (1/1)..."
MAX_RETRIES=18
RETRY_COUNT=0

while true; do
POD_STATUSES=$(kubectl get pods --no-headers)
Expand All @@ -61,33 +63,24 @@ while true; do
echo "Waiting for pods to be ready... ($NOT_READY pods not ready)"
kubectl get pods
sleep 5
done


echo "Waiting for pod my-cluster-kafka-1 readiness..."
MAX_RETRIES=18
RETRY_COUNT=0

while true; do
kubectl exec my-cluster-kafka-1 -- /opt/kafka/kafka_readiness.sh >/dev/null 2>&1
kubectl exec my-cluster-kafka-1 -- /opt/kafka/kafka_readiness.sh >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "Pod my-cluster-kafka-1 is ready."
break
else
echo "Pod my-cluster-kafka-1 is not ready yet. Retrying in 10 seconds..."
sleep 10
((RETRY_COUNT++))
if [[ $RETRY_COUNT -ge $MAX_RETRIES ]]; then
echo "Timeout waiting for pod my-cluster-kafka-1 readiness." >&2
echo "Logs from pod my-cluster-kafka-1:"
kubectl logs my-cluster-kafka-1
echo "Describing pod my-cluster-kafka-1:"
kubectl describe pod my-cluster-kafka-1
exit 1
fi
sleep 10
((RETRY_COUNT++))
if [[ $RETRY_COUNT -ge $MAX_RETRIES ]]; then
echo "Logs from pod my-cluster-kafka-1:"
kubectl logs my-cluster-kafka-1
echo "Describing pod my-cluster-kafka-1:"
kubectl describe pod my-cluster-kafka-1
exit 1
fi
fi
done

done

kubectl apply -f deploy/kind/e2e/e2e-batch.yaml
echo "Setup complete."

0 comments on commit d6e0b3a

Please sign in to comment.