mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #7967 from yujuhong/uname_n
Don't use the first token `uname -n` as the hostname
This commit is contained in:
commit
2c0a047f62
@ -30,10 +30,7 @@ func GetHostname(hostnameOverride string) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Couldn't determine hostname: %v", err)
|
glog.Fatalf("Couldn't determine hostname: %v", err)
|
||||||
}
|
}
|
||||||
chunks := strings.Split(string(nodename), ".")
|
hostname = string(nodename)
|
||||||
// nodename could be a fully-qualified domain name or not. Take the first
|
|
||||||
// word of nodename as the hostname for consistency.
|
|
||||||
hostname = chunks[0]
|
|
||||||
}
|
}
|
||||||
return strings.ToLower(strings.TrimSpace(hostname))
|
return strings.ToLower(strings.TrimSpace(hostname))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user