Skip to content

Commit

Permalink
Fix GetNodeIP to get the first ip
Browse files Browse the repository at this point in the history
Signed-off-by: lrq619 <[email protected]>
  • Loading branch information
lrq619 committed May 8, 2024
1 parent a168c10 commit ae230c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ func InstallYQ() {
}

func GetNodeIP() (string, error) {
nodeIP, err := ExecShellCmd(`ip route | awk '{print $(NF)}' | awk '/^10\..*/'`)
// Choose the first ip address starting from 10.
nodeIP, err := ExecShellCmd(`ip route | awk '{print $(NF)}' | awk '/^10\..*/ {print; exit}'`)
if err == nil {
return nodeIP, nil
}
Expand Down

0 comments on commit ae230c1

Please sign in to comment.