Commit 9db0c68e authored by Robert Bailey's avatar Robert Bailey

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.
parent 42aa4ead
...@@ -100,13 +100,20 @@ elif [[ ! -x "${KUBECTL_PATH}" ]]; then ...@@ -100,13 +100,20 @@ elif [[ ! -x "${KUBECTL_PATH}" ]]; then
fi fi
kubectl="${KUBECTL_PATH:-${kubectl}}" kubectl="${KUBECTL_PATH:-${kubectl}}"
# GKE stores it's kubeconfig in a separate location.
if [[ "$KUBERNETES_PROVIDER" == "gke" ]]; then if [[ "$KUBERNETES_PROVIDER" == "gke" ]]; then
detect-project &> /dev/null detect-project &> /dev/null
config=( config=(
"--kubeconfig=${HOME}/.config/gcloud/kubernetes/kubeconfig"
"--context=gke_${PROJECT}_${ZONE}_${CLUSTER_NAME}" "--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 elif [[ "$KUBERNETES_PROVIDER" == "ubuntu" ]]; then
detect-master > /dev/null detect-master > /dev/null
config=( config=(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment