@@ -64,7 +64,7 @@ function download-kube-env {
64
64
-o " ${tmp_kube_env} " \
65
65
http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env
66
66
# Convert the yaml format file into a shell-style file.
67
- eval $( python -c ' ' '
67
+ eval $( ${PYTHON} -c ' ' '
68
68
import pipes,sys,yaml
69
69
for k,v in yaml.load(sys.stdin).iteritems():
70
70
print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
@@ -103,7 +103,7 @@ function download-kube-master-certs {
103
103
-o " ${tmp_kube_master_certs} " \
104
104
http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-master-certs
105
105
# Convert the yaml format file into a shell-style file.
106
- eval $( python -c ' ' '
106
+ eval $( ${PYTHON} -c ' ' '
107
107
import pipes,sys,yaml
108
108
for k,v in yaml.load(sys.stdin).iteritems():
109
109
print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
@@ -126,7 +126,7 @@ function validate-hash {
126
126
# Get default service account credentials of the VM.
127
127
GCE_METADATA_INTERNAL=" http://metadata.google.internal/computeMetadata/v1/instance"
128
128
function get-credentials {
129
- curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error " ${GCE_METADATA_INTERNAL} /service-accounts/default/token" -H " Metadata-Flavor: Google" -s | python -c \
129
+ curl --fail --retry 5 --retry-delay 3 ${CURL_RETRY_CONNREFUSED} --silent --show-error " ${GCE_METADATA_INTERNAL} /service-accounts/default/token" -H " Metadata-Flavor: Google" -s | ${PYTHON} -c \
130
130
' import sys; import json; print(json.loads(sys.stdin.read())["access_token"])'
131
131
}
132
132
@@ -471,6 +471,11 @@ set-broken-motd
471
471
472
472
KUBE_HOME=" /home/kubernetes"
473
473
KUBE_BIN=" ${KUBE_HOME} /bin"
474
+ PYTHON=" python"
475
+
476
+ if [[ " $( python -V) " =~ " Python 3" ]]; then
477
+ PYTHON=" /usr/bin/python2.7"
478
+ fi
474
479
475
480
# download and source kube-env
476
481
download-kube-env
0 commit comments