Skip to content

Instantly share code, notes, and snippets.

@rujmah
Created November 18, 2022 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rujmah/0e0256bf0277119402da68311bab783d to your computer and use it in GitHub Desktop.
Save rujmah/0e0256bf0277119402da68311bab783d to your computer and use it in GitHub Desktop.
Kong & kubectl Env Settings setup script
#!/bin/env bash
set -e
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
ENDCOLOR="\e[0m"
CLUSTER_NAME=$1
[[ -z "$CLUSTER_NAME" ]] && { echo "${RED}Please specify a CLUSTER NAME: ${YELLOW} . ./setup-kong.sh CLUSTER_NAME ${ENDCOLOR}"; exit 1; }
echo -e "${GREEN}>>> Setting up Kong dev Env on Cluster ${YELLOW}$CLUSTER_NAME \r\n${ENDCOLOR}"
aws eks update-kubeconfig --name $CLUSTER_NAME
export KONG_PROXY=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].hostname}" service -n kong kong-data-plane-kong-proxy)
export KONG_ADMIN=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].hostname}" service -n kong kong-control-plane-kong-admin)
export KONG_ADMIN_URL=http://$KONG_ADMIN:8001
export KONG_PROXY_URL=http://$KONG_PROXY
export DECK_KONG_ADDR=$KONG_ADMIN_URL
echo -e "${GREEN}\nthe following env variables were set:\n ${YELLOW}"
env | ack KONG
echo -e "${GREEN}\nend\n${ENDCOLOR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment