GCI: Fix a cluster initialization failure caused by gce.conf

This commit is contained in:
Andy Zheng 2016-05-19 21:48:17 -07:00
parent f31c4f6d69
commit 914c1d61e9
2 changed files with 11 additions and 8 deletions

View File

@ -114,14 +114,12 @@ function create-master-auth {
echo "${KUBELET_TOKEN},kubelet,kubelet" >> "${known_tokens_csv}"
echo "${KUBE_PROXY_TOKEN},kube_proxy,kube_proxy" >> "${known_tokens_csv}"
fi
# Do not create /etc/gce.conf unless specified.
if [[ -z ${CLOUD_CONFIG:-} ]]; then
return
fi
local use_cloud_config="false"
cat <<EOF >/etc/gce.conf
[global]
EOF
if [[ -n "${PROJECT_ID:-}" && -n "${TOKEN_URL:-}" && -n "${TOKEN_BODY:-}" && -n "${NODE_NETWORK:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf
token-url = ${TOKEN_URL}
token-body = ${TOKEN_BODY}
@ -130,15 +128,20 @@ network-name = ${NODE_NETWORK}
EOF
fi
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf
node-tags = ${NODE_INSTANCE_PREFIX}
EOF
fi
if [[ -n "${MULTIZONE:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf
multizone = ${MULTIZONE}
EOF
fi
if [[ "${use_cloud_config}" != "true" ]]; then
rm -f /etc/gce.conf
fi
}
function create-kubelet-kubeconfig {

View File

@ -29,12 +29,12 @@ Broken (or in progress) Kubernetes node setup! Check the cluster initialization
using the following commands.
Master instance:
- systemctl status kube-master-installation
- systemctl status kube-master-configuration
- sudo systemctl status kube-master-installation
- sudo systemctl status kube-master-configuration
Node instance:
- systemctl status kube-node-installation
- systemctl status kube-node-configuration
- sudo systemctl status kube-node-installation
- sudo systemctl status kube-node-configuration
EOF
}