1
0
mirror of https://github.com/HariSekhon/DevOps-Bash-tools.git synced 2025-02-06 10:02:14 +00:00

updated .envrc-aws

This commit is contained in:
Hari Sekhon 2024-12-17 02:28:27 +07:00
parent 5b982bc972
commit e20a8ee0db

View File

@ -140,6 +140,14 @@ if [ -n "${EKS_CLUSTER:-}" ]; then
# kubectl context is easily created by running adjacent aws_kube_creds.sh script first
export EKS_CONTEXT="arn:aws:eks:$AWS_DEFAULT_REGION:$AWS_ACCOUNT_ID:cluster/$EKS_CLUSTER"
if command -v kubectl &>/dev/null; then
if ! kubectl config get-clusters | grep -Fxq "$EKS_CONTEXT"; then
echo "EKS Cluster '$EKS_CLUSTER' not configured, configuring now"
aws eks update-kubeconfig --name "$EKS_CLUSTER"
echo
fi
fi
# XXX: safer to inline .envrc-kubernetes if you're worried about changes to it bypassing 'direnv allow' authorization
# shellcheck disable=SC1090,SC1091
. "$srcdir/.envrc-kubernetes" "$EKS_CONTEXT" ${EKS_NAMESPACE:+"$EKS_NAMESPACE"}