From 9db0c68e3e4b3e5d798b0de8391fbe420d50198d Mon Sep 17 00:00:00 2001 From: Robert Bailey Date: Thu, 7 May 2015 14:28:08 -0700 Subject: [PATCH] For GKE, only use the special kubeconfig location if the file exists. This will allow Jenkins to keep running after the next gcloud release without needing to make immediate modifications to this file. We can then remove the extra logic at our own convenience. --- cluster/kubectl.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index 35e4bbc30cb..b9b43855ee1 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -100,13 +100,20 @@ elif [[ ! -x "${KUBECTL_PATH}" ]]; then fi kubectl="${KUBECTL_PATH:-${kubectl}}" -# GKE stores it's kubeconfig in a separate location. if [[ "$KUBERNETES_PROVIDER" == "gke" ]]; then detect-project &> /dev/null config=( - "--kubeconfig=${HOME}/.config/gcloud/kubernetes/kubeconfig" "--context=gke_${PROJECT}_${ZONE}_${CLUSTER_NAME}" ) + # In gcloud versions prior to 0.9.59, GKE stores it's kubeconfig + # in a separate location. If the file doesn't exist, then use + # the default kubeconfig file. + # TODO(roberthbailey): Remove this once gcloud 0.9.59 is released. + if [[ ! -e "${HOME}/.config/gcloud/kubernetes/kubeconfig" ]]; then + config+=( + "--kubeconfig=${HOME}/.config/gcloud/kubernetes/kubeconfig" + ) + fi elif [[ "$KUBERNETES_PROVIDER" == "ubuntu" ]]; then detect-master > /dev/null config=(