Change:
What happened: Pick an OS image where python is python3 and the cluster will not come up. What you expected to happen: Cluster should come up. How to reproduce it (as minimally and precisely as possible): Switch the default OS image to use an OS which has python3 as the default python. Run cluster/kube- for GCE. Anything else we need to know?: Environment: Kubernetes version (use ): Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others:
/sig cloud-provider
/assign

Discussion:
# $5: pod name, which should be either etcd or etcd-events function prepare-etcd-manifest { local host_name=${ETCD_HOSTNAME:-$(hostname -s)} <del> local host_ip=$(python -c "import socket;print(socket.gethostbyname("${host_name}"))") </del> <ins> local host_ip=$(${PYTHON} -c "import socket;print(socket.gethostbyname("${host_name}"))") </ins> local etcd_cluster="" local cluster_state="new" local etcd_protocol="http"

KUBE_HOME="/home/kubernetes" KUBE_BIN=${KUBE_HOME}/bin <ins> PYTHON="python" </ins> CONTAINERIZED_MOUNTER_HOME="${KUBE_HOME}/containerized_mounter" PV_RECYCLER_OVERRIDE_TEMPLATE="${KUBE_HOME}/kube-manifests/kubernetes/pv-recycler-template.yaml" <ins> if [[ "$(python -V)" =~ "Python 3" ]]; then PYTHON="/usr/bin/python2.7" fi </ins> if [[ ! -e "${KUBE_HOME}/kube-env" ]]; then echo "The ${KUBE_HOME}/kube-env file does not exist!! Terminate cluster initialization." exit 1

source "${KUBE_HOME}/kube-env" if [[ -f "${KUBE_HOME}/kubelet-config.yaml" ]]; then echo "Found Kubelet config file at ${KUBE_HOME}/kubelet-config.yaml" KUBELET_CONFIG_FILE_ARG="--config ${KUBE_HOME}/kubelet-config.yaml"

-o "${tmp_kube_env}"  http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env # Convert the yaml format file into a shell-style file. <del> eval $(python -c ''' </del> <ins> eval $(${PYTHON} -c ''' </ins> import pipes,sys,yaml for k,v in yaml.load(sys.stdin).iteritems(): print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))

-o "${tmp_kube_master_certs}"  http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-master-certs # Convert the yaml format file into a shell-style file. <del> eval $(python -c ''' </del> <ins> eval $(${PYTHON} -c ''' </ins> import pipes,sys,yaml for k,v in yaml.load(sys.stdin).iteritems(): print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))

# Get default service account credentials of the VM. GCE_METADATA_INTERNAL="http://metadata.google.internal/computeMetadata/v1/instance" function get-credentials { <del> 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  </del> <ins> 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  </ins> 'import sys; import json; print(json.loads(sys.stdin.read())["access_token"])' }

KUBE_HOME="/home/kubernetes" KUBE_BIN="${KUBE_HOME}/bin" <ins> PYTHON="python" if [[ "$(python -V)" =~ "Python 3" ]]; then PYTHON="/usr/bin/python2.7" fi </ins> # download and source kube-env download-kube-env