mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Minion->Node rename: KUBE_NODE_IP_ADDRESSES, KUBE_NODE_IP_ADDRESS
This commit is contained in:
parent
68539ae8a4
commit
ae314ad246
@ -199,8 +199,8 @@ function find-running-minions () {
|
|||||||
function detect-minions () {
|
function detect-minions () {
|
||||||
find-running-minions
|
find-running-minions
|
||||||
|
|
||||||
# This is inefficient, but we want MINION_NAMES / MINION_IDS to be ordered the same as KUBE_MINION_IP_ADDRESSES
|
# This is inefficient, but we want MINION_NAMES / MINION_IDS to be ordered the same as KUBE_NODE_IP_ADDRESSES
|
||||||
KUBE_MINION_IP_ADDRESSES=()
|
KUBE_NODE_IP_ADDRESSES=()
|
||||||
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
||||||
local minion_ip
|
local minion_ip
|
||||||
if [[ "${ENABLE_MINION_PUBLIC_IP}" == "true" ]]; then
|
if [[ "${ENABLE_MINION_PUBLIC_IP}" == "true" ]]; then
|
||||||
@ -209,10 +209,10 @@ function detect-minions () {
|
|||||||
minion_ip=$(get_instance_private_ip ${MINION_NAMES[$i]})
|
minion_ip=$(get_instance_private_ip ${MINION_NAMES[$i]})
|
||||||
fi
|
fi
|
||||||
echo "Found minion ${i}: ${MINION_NAMES[$i]} @ ${minion_ip}"
|
echo "Found minion ${i}: ${MINION_NAMES[$i]} @ ${minion_ip}"
|
||||||
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}")
|
KUBE_NODE_IP_ADDRESSES+=("${minion_ip}")
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z "$KUBE_MINION_IP_ADDRESSES" ]]; then
|
if [[ -z "$KUBE_NODE_IP_ADDRESSES" ]]; then
|
||||||
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'"
|
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -1113,11 +1113,11 @@ function check-cluster() {
|
|||||||
# Basic sanity checking
|
# Basic sanity checking
|
||||||
# TODO(justinsb): This is really not needed any more
|
# TODO(justinsb): This is really not needed any more
|
||||||
local rc # Capture return code without exiting because of errexit bash option
|
local rc # Capture return code without exiting because of errexit bash option
|
||||||
for (( i=0; i<${#KUBE_MINION_IP_ADDRESSES[@]}; i++)); do
|
for (( i=0; i<${#KUBE_NODE_IP_ADDRESSES[@]}; i++)); do
|
||||||
# Make sure docker is installed and working.
|
# Make sure docker is installed and working.
|
||||||
local attempt=0
|
local attempt=0
|
||||||
while true; do
|
while true; do
|
||||||
local minion_ip=${KUBE_MINION_IP_ADDRESSES[$i]}
|
local minion_ip=${KUBE_NODE_IP_ADDRESSES[$i]}
|
||||||
echo -n "Attempt $(($attempt+1)) to check Docker on node @ ${minion_ip} ..."
|
echo -n "Attempt $(($attempt+1)) to check Docker on node @ ${minion_ip} ..."
|
||||||
local output=`check-minion ${minion_ip}`
|
local output=`check-minion ${minion_ip}`
|
||||||
echo $output
|
echo $output
|
||||||
|
@ -229,11 +229,11 @@ function detect-minion-names {
|
|||||||
# ZONE
|
# ZONE
|
||||||
# Vars set:
|
# Vars set:
|
||||||
# MINION_NAMES
|
# MINION_NAMES
|
||||||
# KUBE_MINION_IP_ADDRESSES (array)
|
# KUBE_NODE_IP_ADDRESSES (array)
|
||||||
function detect-minions () {
|
function detect-minions () {
|
||||||
detect-project
|
detect-project
|
||||||
detect-minion-names
|
detect-minion-names
|
||||||
KUBE_MINION_IP_ADDRESSES=()
|
KUBE_NODE_IP_ADDRESSES=()
|
||||||
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
||||||
local minion_ip=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
|
local minion_ip=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
|
||||||
"${MINION_NAMES[$i]}" --fields networkInterfaces[0].accessConfigs[0].natIP \
|
"${MINION_NAMES[$i]}" --fields networkInterfaces[0].accessConfigs[0].natIP \
|
||||||
@ -242,10 +242,10 @@ function detect-minions () {
|
|||||||
echo "Did not find ${MINION_NAMES[$i]}" >&2
|
echo "Did not find ${MINION_NAMES[$i]}" >&2
|
||||||
else
|
else
|
||||||
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}"
|
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}"
|
||||||
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}")
|
KUBE_NODE_IP_ADDRESSES+=("${minion_ip}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ -z "${KUBE_MINION_IP_ADDRESSES-}" ]]; then
|
if [[ -z "${KUBE_NODE_IP_ADDRESSES-}" ]]; then
|
||||||
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -69,9 +69,9 @@ function detect-minions() {
|
|||||||
# ]
|
# ]
|
||||||
|
|
||||||
# Strip out the IP addresses
|
# Strip out the IP addresses
|
||||||
export KUBE_MINION_IP_ADDRESSES=($(${JUJU_PATH}/return-node-ips.py "${ipoutput}"))
|
export KUBE_NODE_IP_ADDRESSES=($(${JUJU_PATH}/return-node-ips.py "${ipoutput}"))
|
||||||
# echo "Kubernetes minions: " ${KUBE_MINION_IP_ADDRESSES[@]} 1>&2
|
# echo "Kubernetes minions: " ${KUBE_NODE_IP_ADDRESSES[@]} 1>&2
|
||||||
export NUM_MINIONS=${#KUBE_MINION_IP_ADDRESSES[@]}
|
export NUM_MINIONS=${#KUBE_NODE_IP_ADDRESSES[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get-password() {
|
function get-password() {
|
||||||
|
@ -29,9 +29,9 @@ function detect-minion-names {
|
|||||||
echo "MINION_NAMES: [${MINION_NAMES[*]}]" 1>&2
|
echo "MINION_NAMES: [${MINION_NAMES[*]}]" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get minion IP addresses and store in KUBE_MINION_IP_ADDRESSES[]
|
# Get minion IP addresses and store in KUBE_NODE_IP_ADDRESSES[]
|
||||||
function detect-minions {
|
function detect-minions {
|
||||||
echo "KUBE_MINION_IP_ADDRESSES: [${KUBE_MINION_IP_ADDRESSES[*]}]" 1>&2
|
echo "KUBE_NODE_IP_ADDRESSES: [${KUBE_NODE_IP_ADDRESSES[*]}]" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify prereqs on host machine
|
# Verify prereqs on host machine
|
||||||
|
@ -204,7 +204,7 @@ function detect-master {
|
|||||||
echo "KUBE_MASTER_IP: $KUBE_MASTER_IP" 1>&2
|
echo "KUBE_MASTER_IP: $KUBE_MASTER_IP" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get minion IP addresses and store in KUBE_MINION_IP_ADDRESSES[]
|
# Get minion IP addresses and store in KUBE_NODE_IP_ADDRESSES[]
|
||||||
# These Mesos slaves MAY host Kublets,
|
# These Mesos slaves MAY host Kublets,
|
||||||
# but might not have a Kublet running unless a kubernetes task has been scheduled on them.
|
# but might not have a Kublet running unless a kubernetes task has been scheduled on them.
|
||||||
function detect-minions {
|
function detect-minions {
|
||||||
@ -215,9 +215,9 @@ function detect-minions {
|
|||||||
fi
|
fi
|
||||||
while read -r docker_id; do
|
while read -r docker_id; do
|
||||||
local minion_ip=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${docker_id}")
|
local minion_ip=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${docker_id}")
|
||||||
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}")
|
KUBE_NODE_IP_ADDRESSES+=("${minion_ip}")
|
||||||
done <<< "$docker_ids"
|
done <<< "$docker_ids"
|
||||||
echo "KUBE_MINION_IP_ADDRESSES: [${KUBE_MINION_IP_ADDRESSES[*]}]" 1>&2
|
echo "KUBE_NODE_IP_ADDRESSES: [${KUBE_NODE_IP_ADDRESSES[*]}]" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify prereqs on host machine
|
# Verify prereqs on host machine
|
||||||
|
@ -25,10 +25,10 @@ function detect-master () {
|
|||||||
echo "KUBE_MASTER_IP: ${KUBE_MASTER_IP}" 1>&2
|
echo "KUBE_MASTER_IP: ${KUBE_MASTER_IP}" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get minion IP addresses and store in KUBE_MINION_IP_ADDRESSES[]
|
# Get minion IP addresses and store in KUBE_NODE_IP_ADDRESSES[]
|
||||||
function detect-minions {
|
function detect-minions {
|
||||||
echo "Minions already detected" 1>&2
|
echo "Minions already detected" 1>&2
|
||||||
KUBE_MINION_IP_ADDRESSES=("${MINION_IPS[@]}")
|
KUBE_NODE_IP_ADDRESSES=("${MINION_IPS[@]}")
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify prereqs on host machine Also sets exports USING_KUBE_SCRIPTS=true so
|
# Verify prereqs on host machine Also sets exports USING_KUBE_SCRIPTS=true so
|
||||||
|
@ -47,19 +47,19 @@ function detect-master {
|
|||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# MINION_NAMES
|
# MINION_NAMES
|
||||||
# Vars set:
|
# Vars set:
|
||||||
# KUBE_MINION_IP_ADDRESS (array)
|
# KUBE_NODE_IP_ADDRESS (array)
|
||||||
function detect-minions {
|
function detect-minions {
|
||||||
KUBE_MINION_IP_ADDRESSES=()
|
KUBE_NODE_IP_ADDRESSES=()
|
||||||
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
||||||
local minion_ip=$(govc vm.ip ${MINION_NAMES[$i]})
|
local minion_ip=$(govc vm.ip ${MINION_NAMES[$i]})
|
||||||
if [[ -z "${minion_ip-}" ]] ; then
|
if [[ -z "${minion_ip-}" ]] ; then
|
||||||
echo "Did not find ${MINION_NAMES[$i]}" >&2
|
echo "Did not find ${MINION_NAMES[$i]}" >&2
|
||||||
else
|
else
|
||||||
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}"
|
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}"
|
||||||
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}")
|
KUBE_NODE_IP_ADDRESSES+=("${minion_ip}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ -z "${KUBE_MINION_IP_ADDRESSES-}" ]]; then
|
if [[ -z "${KUBE_NODE_IP_ADDRESSES-}" ]]; then
|
||||||
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -315,7 +315,7 @@ function kube-up {
|
|||||||
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
||||||
printf "Waiting for ${MINION_NAMES[$i]} to become available..."
|
printf "Waiting for ${MINION_NAMES[$i]} to become available..."
|
||||||
until curl --max-time 5 \
|
until curl --max-time 5 \
|
||||||
--fail --output /dev/null --silent "http://${KUBE_MINION_IP_ADDRESSES[$i]}:10250/healthz"; do
|
--fail --output /dev/null --silent "http://${KUBE_NODE_IP_ADDRESSES[$i]}:10250/healthz"; do
|
||||||
printf "."
|
printf "."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
@ -349,7 +349,7 @@ function kube-up {
|
|||||||
local i
|
local i
|
||||||
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
|
||||||
# Make sure docker is installed
|
# Make sure docker is installed
|
||||||
kube-ssh "${KUBE_MINION_IP_ADDRESSES[$i]}" which docker > /dev/null || {
|
kube-ssh "${KUBE_NODE_IP_ADDRESSES[$i]}" which docker > /dev/null || {
|
||||||
echo "Docker failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely" >&2
|
echo "Docker failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely" >&2
|
||||||
echo "to work correctly. Please run ./cluster/kube-down.sh and re-create the" >&2
|
echo "to work correctly. Please run ./cluster/kube-down.sh and re-create the" >&2
|
||||||
echo "cluster. (sorry!)" >&2
|
echo "cluster. (sorry!)" >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user