Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Danny Froberg
microk8s
Commits
804fb4fb
Commit
804fb4fb
authored
Feb 01, 2019
by
Nick Sandford
Committed by
Konstantinos Tsakalozos
Jan 31, 2019
Browse files
Use netstat to get the default interface name (#279)
parent
0207ff3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
microk8s-resources/wrappers/apiservice-kicker
View file @
804fb4fb
...
...
@@ -22,7 +22,7 @@ do
systemctl is-active
--quiet
snap.microk8s.daemon-apiserver.service
then
# Get current IP
DEFAULT_INTERFACE
=
"
$(
ip route
|
g
awk
'
/default/ {
print $
5
}'
|
head
-1
)
"
DEFAULT_INTERFACE
=
"
$(
netstat
-rn
|
grep
'^0.0.0.0'
|
awk
'
{
print $
NF
}'
|
head
-1
)
"
IP_ADDR
=
"
$(
ifconfig
"
$DEFAULT_INTERFACE
"
|
grep
'inet '
| gawk
'{print $2}'
|
sed
-e
's/addr://'
)
"
USED_IP_ADDR
=
$(
cat
"
${
SNAP_DATA
}
"
/external_ip.txt
)
if
!
[
"
$IP_ADDR
"
==
"
$USED_IP_ADDR
"
]
...
...
microk8s-resources/wrappers/run-with-config-args
View file @
804fb4fb
...
...
@@ -45,7 +45,7 @@ then
if
ip route |
grep
default &> /dev/null
then
DEFAULT_INTERFACE
=
"
$(
ip route
|
g
awk
'
/default/ {
print $
5
}'
|
head
-1
)
"
DEFAULT_INTERFACE
=
"
$(
netstat
-rn
|
grep
'^0.0.0.0'
|
awk
'
{
print $
NF
}'
|
head
-1
)
"
IP_ADDR
=
"
$(
ifconfig
"
$DEFAULT_INTERFACE
"
|
grep
'inet '
| gawk
'{print $2}'
|
sed
-e
's/addr://'
)
"
mkdir
-p
${
SNAP_DATA
}
/var
echo
${
IP_ADDR
}
>
${
SNAP_DATA
}
/external_ip.txt
...
...
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