Created
November 16, 2018 00:25
-
-
Save coderfi/75f273913e9b62b97a7e6dec046bf552 to your computer and use it in GitHub Desktop.
Gets the gateway url, works with minikube or remote (such as AWS EKS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') | |
| if [[ "${INGRESS_HOST}" == "" ]]; then | |
| # assume minikube | |
| INGRESS_HOST=$(minikube ip) | |
| INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}') | |
| else | |
| INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}') | |
| fi | |
| #SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}') | |
| echo export INGRESS_HOST=$INGRESS_HOST | |
| echo export INGRESS_PORT=$INGRESS_PORT | |
| # echo export SECURE_INGRESS_POR=$SECURE_INGRESS_PORT | |
| if [[ "${INGRESS_PORT}" != "80" ]]; then | |
| echo export GATEWAY_URL=http://$INGRESS_HOST:$INGRESS_PORT | |
| else | |
| echo export GATEWAY_URL=http://$INGRESS_HOST | |
| fi | |
| # echo export SECURE_GATEWAY_URL=https://$INGRESS_HOST:$SECURE_INGRESS_PORT | |
| # Run this command to configure your shell: | |
| # eval $(./gateway-env) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment