mirror of https://github.com/k3s-io/k3s
Fixing identification script and adding output to ignore.
parent
b9ac078be7
commit
1d3b52fd9f
|
@ -88,6 +88,7 @@ network_closure.sh
|
|||
|
||||
# Juju Stuff
|
||||
/cluster/juju/charms/*
|
||||
/cluster/juju/bundles/local.yaml
|
||||
|
||||
# Downloaded Kubernetes binary release
|
||||
/kubernetes/
|
||||
|
|
|
@ -17,13 +17,15 @@
|
|||
from subprocess import check_output
|
||||
import yaml
|
||||
|
||||
out = check_output(['juju', 'status', 'kubernetes', '--format=yaml'])
|
||||
|
||||
cmd = ['juju', 'run', '--application', 'kubernetes', '--format=yaml', 'is-leader']
|
||||
out = check_output(cmd)
|
||||
try:
|
||||
parsed_output = yaml.safe_load(out)
|
||||
model = parsed_output['services']['kubernetes']['units']
|
||||
for unit in model:
|
||||
if 'workload-status' in model[unit].keys():
|
||||
if 'leader' in model[unit]['workload-status']['message']:
|
||||
print(unit)
|
||||
for unit in parsed_output:
|
||||
standard_out = unit['Stdout'].rstrip()
|
||||
unit_id = unit['UnitId']
|
||||
if 'True' in standard_out:
|
||||
print(unit_id)
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
#set -o xtrace
|
||||
|
||||
UTIL_SCRIPT=$(readlink -m "${BASH_SOURCE}")
|
||||
JUJU_PATH=$(dirname ${UTIL_SCRIPT})
|
||||
|
@ -54,7 +54,7 @@ function detect-master() {
|
|||
function detect-nodes() {
|
||||
# Run the Juju command that gets the minion private IP addresses.
|
||||
local ipoutput
|
||||
ipoutput=$(juju run --service kubernetes "unit-get private-address" --format=json)
|
||||
ipoutput=$(juju run --application kubernetes "unit-get private-address" --format=json)
|
||||
# [
|
||||
# {"MachineId":"2","Stdout":"192.168.122.188\n","UnitId":"kubernetes/0"},
|
||||
# {"MachineId":"3","Stdout":"192.168.122.166\n","UnitId":"kubernetes/1"}
|
||||
|
@ -91,7 +91,7 @@ function kube-up() {
|
|||
tar xfz ${KUBECTL_DIR}/kubectl_package.tar.gz -C ${KUBECTL_DIR}
|
||||
)
|
||||
# Export the location of the kubectl configuration file.
|
||||
export KUBECONFIG="${KUBECTL_DIR}/config"
|
||||
export KUBECONFIG="${KUBECTL_DIR}/kubeconfig"
|
||||
}
|
||||
|
||||
function kube-down() {
|
||||
|
|
Loading…
Reference in New Issue