Re: Remove dependency of metadata service
This changes were merged into upstream once[1], but lost now. So I added this changes again. And this fixes issues which occurs if "KUBE_API_PUBLIC_ADDRESS" or "KUBE_API_PRIVATE_ADDRESS" are blank. [1]: Idb30971e205e8fd94a478ef7d0bc6a30f5cab534 Change-Id: I0c320ef392fb424755730d4572e744f9c3852c87 Closes-Bug: #1599680
This commit is contained in:
parent
98f79b056a
commit
d5616dc6fe
@ -49,10 +49,10 @@ write_files:
|
||||
fi
|
||||
|
||||
sans="IP:${KUBE_NODE_PUBLIC_IP},IP:${KUBE_NODE_IP}"
|
||||
if [[ "${KUBE_NODE_PUBLIC_IP}" != "${KUBE_API_PUBLIC_ADDRESS}" ]]; then
|
||||
if [[ "${KUBE_NODE_PUBLIC_IP}" != "${KUBE_API_PUBLIC_ADDRESS}" ]] && [[ "${KUBE_API_PUBLIC_ADDRESS}"]]; then
|
||||
sans="${sans},IP:${KUBE_API_PUBLIC_ADDRESS}"
|
||||
fi
|
||||
if [[ "${KUBE_NODE_IP}" != "${KUBE_API_PRIVATE_ADDRESS}" ]]; then
|
||||
if [[ "${KUBE_NODE_IP}" != "${KUBE_API_PRIVATE_ADDRESS}" ]] && [[ "${KUBE_API_PRIVATE_ADDRESS}"]]; then
|
||||
sans="${sans},IP:${KUBE_API_PRIVATE_ADDRESS}"
|
||||
fi
|
||||
MASTER_HOSTNAME=${MASTER_HOSTNAME:-}
|
||||
|
@ -24,12 +24,25 @@ if [ "$TLS_DISABLED" == "True" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cert_ip=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
||||
sans="IP:${cert_ip},IP:${KUBE_API_PUBLIC_ADDRESS},IP:${KUBE_API_PRIVATE_ADDRESS},IP:127.0.0.1"
|
||||
if [[ -z "${KUBE_NODE_PUBLIC_IP}" ]]; then
|
||||
KUBE_NODE_PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
||||
fi
|
||||
if [[ -z "${KUBE_NODE_IP}" ]]; then
|
||||
KUBE_NODE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
|
||||
fi
|
||||
|
||||
sans="IP:${KUBE_NODE_PUBLIC_IP},IP:${KUBE_NODE_IP}"
|
||||
if [[ "${KUBE_NODE_PUBLIC_IP}" != "${KUBE_API_PUBLIC_ADDRESS}" ]] && [[ "${KUBE_API_PUBLIC_ADDRESS}" ]]; then
|
||||
sans="${sans},IP:${KUBE_API_PUBLIC_ADDRESS}"
|
||||
fi
|
||||
if [[ "${KUBE_NODE_IP}" != "${KUBE_API_PRIVATE_ADDRESS}" ]] && [[ "${KUBE_API_PRIVATE_ADDRESS}" ]]; then
|
||||
sans="${sans},IP:${KUBE_API_PRIVATE_ADDRESS}"
|
||||
fi
|
||||
MASTER_HOSTNAME=${MASTER_HOSTNAME:-}
|
||||
if [[ -n "${MASTER_HOSTNAME}" ]]; then
|
||||
sans="${sans},DNS:${MASTER_HOSTNAME}"
|
||||
sans="${sans},DNS:${MASTER_HOSTNAME}"
|
||||
fi
|
||||
sans="${sans},IP:127.0.0.1"
|
||||
|
||||
cert_dir=/srv/kubernetes
|
||||
cert_conf_dir=${cert_dir}/conf
|
||||
|
@ -8,6 +8,7 @@ write_files:
|
||||
KUBE_API_PUBLIC_ADDRESS="$KUBE_API_PUBLIC_ADDRESS"
|
||||
KUBE_API_PRIVATE_ADDRESS="$KUBE_API_PRIVATE_ADDRESS"
|
||||
KUBE_API_PORT="$KUBE_API_PORT"
|
||||
KUBE_NODE_PUBLIC_IP="$KUBE_NODE_PUBLIC_IP"
|
||||
KUBE_NODE_IP="$KUBE_NODE_IP"
|
||||
KUBE_ALLOW_PRIV="$KUBE_ALLOW_PRIV"
|
||||
DOCKER_VOLUME="$DOCKER_VOLUME"
|
||||
|
@ -8,6 +8,7 @@ write_files:
|
||||
KUBE_ALLOW_PRIV="$KUBE_ALLOW_PRIV"
|
||||
KUBE_MASTER_IP="$KUBE_MASTER_IP"
|
||||
KUBE_API_PORT="$KUBE_API_PORT"
|
||||
KUBE_NODE_PUBLIC_IP="$KUBE_NODE_PUBLIC_IP"
|
||||
KUBE_NODE_IP="$KUBE_NODE_IP"
|
||||
ETCD_SERVER_IP="$ETCD_SERVER_IP"
|
||||
DOCKER_VOLUME="$DOCKER_VOLUME"
|
||||
|
Loading…
Reference in New Issue
Block a user