updated gcp_secrets_to_kubernetes.sh

pull/2/head
Hari Sekhon 4 years ago
parent c402308755
commit 9345c3d215

@ -53,12 +53,17 @@ help_usage "$@"
#min_args 1 "$@"
# fix kube cluster to protect consistency against k8s race conditions
# XXX: fix kube cluster to protect consistency against k8s race conditions
kubeconfig="/tmp/.kube/config.${EUID:-$UID}.$$"
mkdir -p "$(dirname "$kubeconfig")"
cp -f "${KUBECONFIG:-$HOME/.kube/config}" "$kubeconfig"
export KUBECONFIG="$kubeconfig"
# XXX: fix the project for consistency
project="$(gcloud config list --format='get(core.project)')"
not_blank "$project" || die "ERROR: GCloud SDK core.project value not set"
export CLOUDSDK_CORE_PROJECT="$project"
# there's no -o jsonpath / -o namespace / -o cluster as of Kubernetes 1.15 so have to just print columns
kubectl_context="$(kubectl config get-contexts "$(kubectl config current-context)" --no-headers)"
current_cluster="$(awk '{print $3}' <<< "$kubectl_context")"

Loading…
Cancel
Save