Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1d3b52fd
Commit
1d3b52fd
authored
Aug 04, 2016
by
Matt Bruzek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing identification script and adding output to ignore.
parent
b9ac078b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
.gitignore
.gitignore
+1
-0
identify-leaders.py
cluster/juju/identify-leaders.py
+8
-6
util.sh
cluster/juju/util.sh
+3
-3
No files found.
.gitignore
View file @
1d3b52fd
...
@@ -88,6 +88,7 @@ network_closure.sh
...
@@ -88,6 +88,7 @@ network_closure.sh
# Juju Stuff
# Juju Stuff
/cluster/juju/charms/*
/cluster/juju/charms/*
/cluster/juju/bundles/local.yaml
# Downloaded Kubernetes binary release
# Downloaded Kubernetes binary release
/kubernetes/
/kubernetes/
...
...
cluster/juju/identify-leaders.py
View file @
1d3b52fd
...
@@ -17,13 +17,15 @@
...
@@ -17,13 +17,15 @@
from
subprocess
import
check_output
from
subprocess
import
check_output
import
yaml
import
yaml
out
=
check_output
([
'juju'
,
'status'
,
'kubernetes'
,
'--format=yaml'
])
cmd
=
[
'juju'
,
'run'
,
'--application'
,
'kubernetes'
,
'--format=yaml'
,
'is-leader'
]
out
=
check_output
(
cmd
)
try
:
try
:
parsed_output
=
yaml
.
safe_load
(
out
)
parsed_output
=
yaml
.
safe_load
(
out
)
model
=
parsed_output
[
'services'
][
'kubernetes'
][
'units'
]
for
unit
in
parsed_output
:
for
unit
in
model
:
standard_out
=
unit
[
'Stdout'
]
.
rstrip
()
if
'workload-status'
in
model
[
unit
]
.
keys
():
unit_id
=
unit
[
'UnitId'
]
if
'leader'
in
model
[
unit
][
'workload-status'
][
'message'
]
:
if
'True'
in
standard_out
:
print
(
unit
)
print
(
unit_id
)
except
:
except
:
pass
pass
cluster/juju/util.sh
View file @
1d3b52fd
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
set
-o
errexit
set
-o
errexit
set
-o
nounset
set
-o
nounset
set
-o
pipefail
set
-o
pipefail
set
-o
xtrace
#
set -o xtrace
UTIL_SCRIPT
=
$(
readlink
-m
"
${
BASH_SOURCE
}
"
)
UTIL_SCRIPT
=
$(
readlink
-m
"
${
BASH_SOURCE
}
"
)
JUJU_PATH
=
$(
dirname
${
UTIL_SCRIPT
})
JUJU_PATH
=
$(
dirname
${
UTIL_SCRIPT
})
...
@@ -54,7 +54,7 @@ function detect-master() {
...
@@ -54,7 +54,7 @@ function detect-master() {
function
detect-nodes
()
{
function
detect-nodes
()
{
# 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
=
json
)
ipoutput
=
$(
juju run
--
application
kubernetes
"unit-get private-address"
--format
=
json
)
# [
# [
# {"MachineId":"2","Stdout":"192.168.122.188\n","UnitId":"kubernetes/0"},
# {"MachineId":"2","Stdout":"192.168.122.188\n","UnitId":"kubernetes/0"},
# {"MachineId":"3","Stdout":"192.168.122.166\n","UnitId":"kubernetes/1"}
# {"MachineId":"3","Stdout":"192.168.122.166\n","UnitId":"kubernetes/1"}
...
@@ -91,7 +91,7 @@ function kube-up() {
...
@@ -91,7 +91,7 @@ function kube-up() {
tar
xfz
${
KUBECTL_DIR
}
/kubectl_package.tar.gz
-C
${
KUBECTL_DIR
}
tar
xfz
${
KUBECTL_DIR
}
/kubectl_package.tar.gz
-C
${
KUBECTL_DIR
}
)
)
# Export the location of the kubectl configuration file.
# Export the location of the kubectl configuration file.
export
KUBECONFIG
=
"
${
KUBECTL_DIR
}
/config"
export
KUBECONFIG
=
"
${
KUBECTL_DIR
}
/
kube
config"
}
}
function
kube-down
()
{
function
kube-down
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment