Skip to content

Instantly share code, notes, and snippets.

@PyDataBlog
Last active June 27, 2022 22:09
Show Gist options
  • Save PyDataBlog/38ff8880ac9d3fe8c0cb1b109bebee88 to your computer and use it in GitHub Desktop.
Save PyDataBlog/38ff8880ac9d3fe8c0cb1b109bebee88 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Function which takes a namespace, and waits until ip is assigned to it.
function wait_for_ip() {
namespace=$1
echo "Waiting for IP for namespace: $namespace"
while [ -z $ip ]; do
ip=$(kubectl get ingress -n $namespace -o jsonpath="{.items[*].status.loadBalancer.ingress[*].ip}")
[ -z "$ip" ]
done
echo 'Found Ingress Address IP'
url=$(kubectl get ingress -n $namespace -o jsonpath="{.items[*].spec.rules[*].host}")
echo 'Visit https://'$url' in your browser'
}
wait_for_ip $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment