Skip to content

Commit

Permalink
Minikube warn if Port Fowarding cannot start (#698) (#700)
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.

Co-authored-by: Nick Burch <[email protected]>
  • Loading branch information
Gagravarr and Nick Burch authored Nov 8, 2023
1 parent 87f19a2 commit d362a02
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 d362a02

Please sign in to comment.