From 7e7570d6ffc2076e1cbf54f69f7a46be64b53d2c Mon Sep 17 00:00:00 2001 From: Matt Matejczyk Date: Wed, 15 May 2019 15:26:46 +0200 Subject: [PATCH] Upload kubeconfig to master metadata in tests. Till a few days ago, it was possible to ssh into master and access cluster via insecure master port. Now, the master insecure port has been disabled, we're not able to do that anymore. This PR aims to fix that by uploading the kubeconfig to the master metadata during cluster setup in tests. --- cluster/gce/config-test.sh | 2 ++ cluster/gce/util.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 81ffb0bb09..b2ce6d5703 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -525,3 +525,5 @@ WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSche GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}" ETCD_LISTEN_CLIENT_IP=0.0.0.0 + +GCE_UPLOAD_KUBCONFIG_TO_MASTER_METADATA=true diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 775745bd0e..b7132c9b18 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -3016,6 +3016,11 @@ function check-cluster() { # ensures KUBECONFIG is set get-kubeconfig-basicauth + + if [[ ${GCE_UPLOAD_KUBCONFIG_TO_MASTER_METADATA:-} == "true" ]]; then + gcloud compute instances add-metadata "${MASTER_NAME}" --zone="${ZONE}" --metadata-from-file="kubeconfig=${KUBECONFIG}" || true + fi + echo echo -e "${color_green}Kubernetes cluster is running. The master is running at:" echo