-echo "Not all Docker services are healthy"
-docker ps | grep " ${STACK_NAME}_"
-
-for S_WITH_HEALTH in $SERVICES_WITH_HEALTH ; do
- docker ps | grep " ${STACK_NAME}_" | grep -i healthy | grep -q "_${S_WITH_HEALTH}." && continue
- echo
- echo BEGIN LOGS of container ${S_WITH_HEALTH} not healthy
- docker service logs ${STACK_NAME}_${S_WITH_HEALTH} 2>&1 | tail -n 100
- echo END LOGS of container ${S_WITH_HEALTH} not healthy
- echo
-done
+if [ -n "$KUBERNETES" ]; then
+ echo "Not all pods are running"
+ kubectl get pods -n "${STACK_NAME}"
+ for POD in $OSM_DEPLOYMENT $OSM_STATEFULSET; do
+ kubectl get pods -n "${STACK_NAME}" | grep -i running | grep -q ^"${POD}-" && continue
+ echo
+ echo BEGIN LOGS of pods ${POD} not running
+ LOG_POD=$(kubectl get pods -n "${STACK_NAME}" | grep -e ^"${POD}-" | awk '{print $1}' )
+ [ -z "$LOG_POD" ] && echo "${POD} Failed to deploy" || kubectl logs ${LOG_POD} -n $STACK_NAME 2>&1 | tail -n 100
+ echo END LOGS of services $POD not running
+ done
+else
+ echo "Not all Docker services are healthy"
+ sg docker -c "docker ps" | grep " ${STACK_NAME}_"
+ for S_WITH_HEALTH in $SERVICES_WITH_HEALTH ; do
+ sg docker -c "docker ps" | grep " ${STACK_NAME}_" | grep -i healthy | grep -q "_${S_WITH_HEALTH}." && continue
+ echo
+ echo BEGIN LOGS of container ${S_WITH_HEALTH} not healthy
+ sg docker -c "docker service logs ${STACK_NAME}_${S_WITH_HEALTH} 2>&1" | tail -n 100
+ echo END LOGS of container ${S_WITH_HEALTH} not healthy
+ echo
+ done
+fi