Skip to content

Commit

Permalink
Use a better shell command to grab the IP address (#241)
Browse files Browse the repository at this point in the history
Verified the command on the following distros:
ubuntu - trusty,xenial,artful,bionic
photon - 2.0,3.0

Resolves #239

Change-Id: I99a915874a894baea067983e62950fc4745073b8
  • Loading branch information
sidharthsurana authored and k8s-ci-robot committed Mar 28, 2019
1 parent ad7197a commit 3982436
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cloud/vsphere/provisioner/common/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ systemctl start docker || true
sysctl net.bridge.bridge-nf-call-iptables=1
` +
"PUBLICIP=`ip route get 8.8.8.8 | awk '{printf \"%s\", $NF; exit}'`" + `
"PUBLICIP=`ip route get 8.8.8.8 | awk '{for(i=1; i<=NF; i++) if($i~/src/) print $(i+1)}'`" + `
cat > /etc/systemd/system/kubelet.service.d/20-cloud.conf << EOF
[Service]
Expand Down Expand Up @@ -540,10 +540,10 @@ systemctl enable docker
systemctl start docker
` +
"PRIVATEIP=`ip route get 8.8.8.8 | awk '{printf \"%s\", $NF; exit}'`" + `
"PRIVATEIP=`ip route get 8.8.8.8 | awk '{for(i=1; i<=NF; i++) if($i~/src/) print $(i+1)}'`" + `
echo $PRIVATEIP > /tmp/.ip
` +
"PUBLICIP=`ip route get 8.8.8.8 | awk '{printf \"%s\", $NF; exit}'`" + `
"PUBLICIP=`ip route get 8.8.8.8 | awk '{for(i=1; i<=NF; i++) if($i~/src/) print $(i+1)}'`" + `
cat > /etc/systemd/system/kubelet.service.d/20-cloud.conf << EOF
[Service]
Expand Down

0 comments on commit 3982436

Please sign in to comment.