mirror of https://github.com/k3s-io/k3s
Changed the kube-up logic to use local bundles and charms.
Implemented a feature of kube-down Corrected a bug on bootstrap of Juju environment.pull/6/head
parent
8f038a82a4
commit
89043414f6
|
@ -20,7 +20,9 @@ set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
source $KUBE_ROOT/cluster/juju/prereqs/ubuntu-juju.sh
|
source $KUBE_ROOT/cluster/juju/prereqs/ubuntu-juju.sh
|
||||||
KUBE_BUNDLE_URL='https://raw.githubusercontent.com/whitmo/bundle-kubernetes/master/bundles.yaml'
|
export JUJU_REPOSITORY=${KUBE_ROOT}/cluster/juju/charms
|
||||||
|
#KUBE_BUNDLE_URL='https://raw.githubusercontent.com/whitmo/bundle-kubernetes/master/bundles.yaml'
|
||||||
|
KUBE_BUNDLE_PATH=${KUBE_ROOT}/cluster/juju/bundles/local.yaml
|
||||||
function verify-prereqs() {
|
function verify-prereqs() {
|
||||||
gather_installation_reqs
|
gather_installation_reqs
|
||||||
}
|
}
|
||||||
|
@ -30,6 +32,11 @@ function get-password() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function kube-up() {
|
function kube-up() {
|
||||||
|
if [[ -d "~/.juju/current-env" ]]; then
|
||||||
|
juju quickstart -i --no-browser
|
||||||
|
else
|
||||||
|
juju quickstart --no-browser
|
||||||
|
fi
|
||||||
# If something were to happen that I'm not accounting for, do not
|
# If something were to happen that I'm not accounting for, do not
|
||||||
# punish the user by making them tear things down. In a perfect world
|
# punish the user by making them tear things down. In a perfect world
|
||||||
# quickstart should handle this situation, so be nice in the meantime
|
# quickstart should handle this situation, so be nice in the meantime
|
||||||
|
@ -37,17 +44,17 @@ function kube-up() {
|
||||||
envstatus=$(juju status kubernetes-master --format=oneline)
|
envstatus=$(juju status kubernetes-master --format=oneline)
|
||||||
|
|
||||||
if [[ "" == "${envstatus}" ]]; then
|
if [[ "" == "${envstatus}" ]]; then
|
||||||
if [[ -d "~/.juju/current-env" ]]; then
|
juju deployer -c ${KUBE_BUNDLE_PATH}
|
||||||
juju quickstart -i --no-browser -i $KUBE_BUNDLE_URL
|
|
||||||
else
|
|
||||||
juju quickstart --no-browser ${KUBE_BUNDLE_URL}
|
|
||||||
fi
|
|
||||||
sleep 60
|
|
||||||
fi
|
fi
|
||||||
# Sleep due to juju bug http://pad.lv/1432759
|
# Sleep due to juju bug http://pad.lv/1432759
|
||||||
sleep-status
|
sleep-status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function kube-down() {
|
||||||
|
local jujuenv
|
||||||
|
jujuenv=$(cat ~/.juju/current-environment)
|
||||||
|
juju destroy-environment $jujuenv
|
||||||
|
}
|
||||||
|
|
||||||
function detect-master() {
|
function detect-master() {
|
||||||
local kubestatus
|
local kubestatus
|
||||||
|
@ -56,7 +63,6 @@ function detect-master() {
|
||||||
export KUBE_MASTER_IP=${kubestatus}
|
export KUBE_MASTER_IP=${kubestatus}
|
||||||
export KUBE_MASTER=$KUBE_MASTER_IP:8080
|
export KUBE_MASTER=$KUBE_MASTER_IP:8080
|
||||||
export KUBERNETES_MASTER=$KUBE_MASTER
|
export KUBERNETES_MASTER=$KUBE_MASTER
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function detect-minions(){
|
function detect-minions(){
|
||||||
|
@ -72,10 +78,10 @@ function detect-minions(){
|
||||||
# Stdout: '10.202.146.124
|
# Stdout: '10.202.146.124
|
||||||
# '
|
# '
|
||||||
# UnitId: kubernetes/1
|
# UnitId: kubernetes/1
|
||||||
|
KUBERNETES_JSON=$(juju run --service kubernetes \
|
||||||
KUBE_MINION_IP_ADDRESSES=($(juju run --service kubernetes \
|
"unit-get private-address" --format=json)
|
||||||
"unit-get private-address" --format=yaml \
|
KUBE_MINION_IP_ADDRESSES=($(${KUBE_ROOT}/cluster/juju/return-node-ips.py $KUBERNETES_JSON))
|
||||||
| awk '/Stdout/ {gsub(/'\''/,""); print $2}'))
|
echo $KUBE_MINION_IP_ADDRESSES
|
||||||
NUM_MINIONS=${#KUBE_MINION_IP_ADDRESSES[@]}
|
NUM_MINIONS=${#KUBE_MINION_IP_ADDRESSES[@]}
|
||||||
MINION_NAMES=$KUBE_MINION_IP_ADDRESSES
|
MINION_NAMES=$KUBE_MINION_IP_ADDRESSES
|
||||||
}
|
}
|
||||||
|
@ -88,7 +94,6 @@ function teardown-logging-firewall(){
|
||||||
echo "TODO: teardown logging and firewall rules"
|
echo "TODO: teardown logging and firewall rules"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sleep-status(){
|
function sleep-status(){
|
||||||
local i
|
local i
|
||||||
local maxtime
|
local maxtime
|
||||||
|
@ -109,4 +114,3 @@ function sleep-status(){
|
||||||
echo "Sleeping an additional minute to allow the cluster to settle"
|
echo "Sleeping an additional minute to allow the cluster to settle"
|
||||||
sleep 60
|
sleep 60
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue