Skip to content

Commit 21a8d08

Browse files
authored
Merge pull request kubernetes#71258 from bart0sh/PR0042-kubeadm-1159-improve-hostport-error-messages
kubeadm: improve hostport parsing error messages
2 parents 27fca55 + bab556f commit 21a8d08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/kubeadm/app/util/endpoint.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func ParseHostPort(hostport string) (string, string, error) {
9595
// if port is defined, parse and validate it
9696
if port != "" {
9797
if _, err := ParsePort(port); err != nil {
98-
return "", "", errors.New("port must be a valid number between 1 and 65535, inclusive")
98+
return "", "", errors.Errorf("hostport %s: port %s must be a valid number between 1 and 65535, inclusive", hostport, port)
9999
}
100100
}
101101

@@ -109,7 +109,7 @@ func ParseHostPort(hostport string) (string, string, error) {
109109
return host, port, nil
110110
}
111111

112-
return "", "", errors.New("host must be a valid IP address or a valid RFC-1123 DNS subdomain")
112+
return "", "", errors.Errorf("hostport %s: host '%s' must be a valid IP address or a valid RFC-1123 DNS subdomain", hostport, host)
113113
}
114114

115115
// ParsePort parses a string representing a TCP port.

0 commit comments

Comments
 (0)