You are on page 1of 2

suv@Suvankars-MacBook-Pro[8:23:07]:~$ cat .

zprofile
alias ns='kubectl config set-context --current --namespace '
alias flux-op-log='kubectl -n flux log $(kubectl get -n flux pods -l app=flux-helm-operator --no-headers -o custom-
columns=name:metadata.name)'
alias flux-log='kubectl -n flux log $(kubectl get -n flux pods -l app=flux --no-headers -o custom-
columns=name:metadata.name)'
alias l='ls -ltr'
alias co='git checkout'
alias r='git rebase -i origin/master'
alias rate='cd thermeon/gke-production-envs/clusters/prj-shared-services'
export PATH=$PATH:/Users/suv:/bin
alias t='terraform'
alias k='kubectl config current-context'
alias fl='kubectl -n flux logs deployment/flux -f'
alias n='kubectl config view --minify | grep namespace'
alias us='gke-login p u'
alias eu='gke-login p e'
alias au='gke-login p a'
alias ev='kubectl get pods --all-namespaces |grep Evicted'
alias de='gke-login d e'
alias get='kubectl get pods'

gke-login.sh script:-

#!/bin/bash

ENV=$1
REGION=$2

if [[ "$ENV" == "mine" ]]; then


PROJECT="prj-dev"
REGION="europe-west1"
CLUSTER=$(whoami)
else
if [[ "$ENV" == "adhoc" ]]; then
PROJECT="prj-dev"
REGION="europe-west1"
CLUSTER=$2
else
if [[ "$ENV" == "p" ]]; then
ENV="production"
else
if [[ "$ENV" == "d" ]]; then
ENV="dev"
else
echo "Unknown environment shorthand: $ENV. Should be p or d"
exit 1
fi
fi
if [[ "$REGION" == "u" ]]; then
REGION="us-central1"
else
if [[ "$REGION" == "a" ]]; then
REGION="australia-southeast1"
else
if [[ "$REGION" == "e" ]]; then
REGION="europe-west1"
else
echo "Unknown region shorthand: $REGION. Should be u, a or e"
exit 1
fi
fi
fi
CLUSTER="${ENV}-${REGION}"
PROJECT="prj-$ENV"
if [[ "$ENV" == "production" ]]; then
PROJECT="prj-shared-services"
fi
fi
fi
gcloud container clusters --project $PROJECT --region $REGION get-credentials $CLUSTER
if [[ "$ENV" == "dev" || "$ENV" == "mine" ]]; then
kubectl config set-context --current --namespace $(whoami)
fi

You might also like