summaryrefslogtreecommitdiff
path: root/cloud/cmd
diff options
context:
space:
mode:
authorblackdobb <64015779+blackdobb@users.noreply.github.com>2021-08-20 16:19:38 +0800
committerGitHub <noreply@github.com>2021-08-20 16:19:38 +0800
commitd2cbad777ae00a444e193a18a3cbbc00a7317d33 (patch)
treea121076db1e8fb518e4c80ffd3b5b90374358284 /cloud/cmd
parentsync the response message unconditionally (#3014) (diff)
downloadkubeedge-d2cbad777ae00a444e193a18a3cbbc00a7317d33.tar.gz
add the validation of hostname due to the problem caused by long name (#3044)
Signed-off-by: blackdobb <xinxin.wan@daocloud.io>
Diffstat (limited to 'cloud/cmd')
-rw-r--r--cloud/cmd/cloudcore/app/server.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/cloud/cmd/cloudcore/app/server.go b/cloud/cmd/cloudcore/app/server.go
index ae41ba604..7d1890eca 100644
--- a/cloud/cmd/cloudcore/app/server.go
+++ b/cloud/cmd/cloudcore/app/server.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"math/rand"
- "os"
"time"
"github.com/spf13/cobra"
@@ -145,7 +144,8 @@ func NegotiateTunnelPort() (*int, error) {
return nil, err
}
- localIP := getLocalIP()
+ hostnameOverride := util.GetHostname()
+ localIP, _ := util.GetLocalIP(hostnameOverride)
var record iptables.TunnelPortRecord
if err == nil {
@@ -227,12 +227,3 @@ func negotiatePort(portRecord map[int]bool) int {
}
}
}
-
-func getLocalIP() string {
- hostnameOverride, err := os.Hostname()
- if err != nil {
- hostnameOverride = constants.DefaultHostnameOverride
- }
- localIP, _ := util.GetLocalIP(hostnameOverride)
- return localIP
-}