Skip to content

Commit

Permalink
Minikube warn if Port Fowarding cannot start (#698)
Browse files Browse the repository at this point in the history
Add error handling to the shell script function `start_port_forward`
to avoid the current hanging if no *node port* is defined for the
service.

Doesn't attempt any alternate forwarding (eg kubectl), just gives
a moderately helpful message and errors out.
  • Loading branch information
Nick Burch committed Nov 7, 2023
1 parent b4b8c49 commit 2fb7489
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mini-langstream/mini-langstream
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,15 @@ start_port_forward() {
local service=$1
local file=$(mktemp)

minikube_cmd service $1 --url -n $k8s_namespace &> $file &
grep -q 'http' <(tail -f $file)
url=$(grep -e http $file)
echo "$url"
minikube_cmd service $1 --url -n $k8s_namespace &> $file
if grep -q 'http' $file; then
url=$(grep -e http $file)
echo "$url"
else
echo "${service}: ❌ - Port forwarding failed to start" >&2
cat $file >&2
exit 1
fi
}

kafka_hostname=langstream-kafka
Expand Down

0 comments on commit 2fb7489

Please sign in to comment.