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 "${KUBELET_TOKEN},kubelet,kubelet" >> "${known_tokens_csv}"
echo "${KUBE_PROXY_TOKEN},kube_proxy,kube_proxy" >> "${known_tokens_csv}" echo "${KUBE_PROXY_TOKEN},kube_proxy,kube_proxy" >> "${known_tokens_csv}"
fi fi
# Do not create /etc/gce.conf unless specified. local use_cloud_config="false"
if [[ -z ${CLOUD_CONFIG:-} ]]; then
return
fi
cat <<EOF >/etc/gce.conf cat <<EOF >/etc/gce.conf
[global] [global]
EOF EOF
if [[ -n "${PROJECT_ID:-}" && -n "${TOKEN_URL:-}" && -n "${TOKEN_BODY:-}" && -n "${NODE_NETWORK:-}" ]]; then if [[ -n "${PROJECT_ID:-}" && -n "${TOKEN_URL:-}" && -n "${TOKEN_BODY:-}" && -n "${NODE_NETWORK:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf cat <<EOF >>/etc/gce.conf
token-url = ${TOKEN_URL} token-url = ${TOKEN_URL}
token-body = ${TOKEN_BODY} token-body = ${TOKEN_BODY}
@ -130,15 +128,20 @@ network-name = ${NODE_NETWORK}
EOF EOF
fi fi
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf cat <<EOF >>/etc/gce.conf
node-tags = ${NODE_INSTANCE_PREFIX} node-tags = ${NODE_INSTANCE_PREFIX}
EOF EOF
fi fi
if [[ -n "${MULTIZONE:-}" ]]; then if [[ -n "${MULTIZONE:-}" ]]; then
use_cloud_config="true"
cat <<EOF >>/etc/gce.conf cat <<EOF >>/etc/gce.conf
multizone = ${MULTIZONE} multizone = ${MULTIZONE}
EOF EOF
fi fi
if [[ "${use_cloud_config}" != "true" ]]; then
rm -f /etc/gce.conf
fi
} }
function create-kubelet-kubeconfig { 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. using the following commands.
Master instance: Master instance:
- systemctl status kube-master-installation - sudo systemctl status kube-master-installation
- systemctl status kube-master-configuration - sudo systemctl status kube-master-configuration
Node instance: Node instance:
- systemctl status kube-node-installation - sudo systemctl status kube-node-installation
- systemctl status kube-node-configuration - sudo systemctl status kube-node-configuration
EOF EOF
} }