mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Exporting master and minion variables and calling detect methods in kube-up.
This commit is contained in:
parent
35301bbcfd
commit
5deef09178
@ -51,6 +51,8 @@ function kube-up() {
|
|||||||
fi
|
fi
|
||||||
# Sleep due to juju bug http://pad.lv/1432759
|
# Sleep due to juju bug http://pad.lv/1432759
|
||||||
sleep-status
|
sleep-status
|
||||||
|
detect-master
|
||||||
|
detect-minions
|
||||||
}
|
}
|
||||||
|
|
||||||
function kube-down() {
|
function kube-down() {
|
||||||
@ -64,14 +66,15 @@ function detect-master() {
|
|||||||
# Capturing a newline, and my awk-fu was weak - pipe through tr -d
|
# Capturing a newline, and my awk-fu was weak - pipe through tr -d
|
||||||
kubestatus=$(juju status --format=oneline kubernetes-master | awk '{print $3}' | tr -d "\n")
|
kubestatus=$(juju status --format=oneline kubernetes-master | awk '{print $3}' | tr -d "\n")
|
||||||
export KUBE_MASTER_IP=${kubestatus}
|
export KUBE_MASTER_IP=${kubestatus}
|
||||||
export KUBE_MASTER=$KUBE_MASTER_IP:8080
|
export KUBE_MASTER=${KUBE_MASTER_IP}
|
||||||
export KUBERNETES_MASTER=$KUBE_MASTER
|
export KUBERNETES_MASTER=http://${KUBE_MASTER}:8080
|
||||||
|
echo "Kubernetes master: " ${KUBERNETES_MASTER}
|
||||||
}
|
}
|
||||||
|
|
||||||
function detect-minions() {
|
function detect-minions() {
|
||||||
# Run the Juju command that gets the minion private IP addresses.
|
# Run the Juju command that gets the minion private IP addresses.
|
||||||
local ipoutput
|
local ipoutput
|
||||||
ipoutput=$(juju run --service kubernetes "unit-get private-address" --format=yaml)
|
ipoutput=$(juju run --service kubernetes "unit-get private-address" --format=json)
|
||||||
echo $ipoutput
|
echo $ipoutput
|
||||||
# Strip out the IP addresses
|
# Strip out the IP addresses
|
||||||
#
|
#
|
||||||
@ -84,10 +87,10 @@ function detect-minions() {
|
|||||||
# Stdout: |
|
# Stdout: |
|
||||||
# 10.202.146.124
|
# 10.202.146.124
|
||||||
# UnitId: kubernetes/1
|
# UnitId: kubernetes/1
|
||||||
KUBE_MINION_IP_ADDRESSES=($(echo $ipoutput | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'))
|
export KUBE_MINION_IP_ADDRESSES=($(${JUJU_PATH}/return-node-ips.py "${ipoutput}"))
|
||||||
echo ${KUBE_MINION_IP_ADDRESSES[@]}
|
echo "Kubernetes minions: " ${KUBE_MINION_IP_ADDRESSES[@]}
|
||||||
NUM_MINIONS=${#KUBE_MINION_IP_ADDRESSES[@]}
|
export NUM_MINIONS=${#KUBE_MINION_IP_ADDRESSES[@]}
|
||||||
MINION_NAMES=$KUBE_MINION_IP_ADDRESSES
|
export MINION_NAMES=$KUBE_MINION_IP_ADDRESSES
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup-logging-firewall() {
|
function setup-logging-firewall() {
|
||||||
|
Loading…
Reference in New Issue
Block a user