mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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.
This commit is contained in:
parent
42aa4ead7e
commit
9db0c68e3e
@ -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=(
|
||||||
|
Loading…
Reference in New Issue
Block a user