Commit 40f147fe authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #41220 from errordeveloper/fix-hostname-preflight-check

Automatic merge from submit-queue (batch tested with PRs 41223, 40892, 41220, 41207, 41242) kubeadm: preflight should only warn about unresolvable hostnames **What this PR does / why we need it**: This is quite often the case on AWS, and we really don't care if the hostname is resolvable or not. It's not an easy requirement to ask user to fix, and there is no functional penalty at the Kubernetes level, also it's possible that users fixes their host resolution eventually, we don't have to make them do so. **Special notes for your reviewer**: @dmmcquay @luxas PTAL 👍 **Release note**: ```release-note NONE ```
parents 93bd6b3b 829c47f9
...@@ -239,18 +239,19 @@ type HostnameCheck struct{} ...@@ -239,18 +239,19 @@ type HostnameCheck struct{}
func (hc HostnameCheck) Check() (warnings, errors []error) { func (hc HostnameCheck) Check() (warnings, errors []error) {
errors = []error{} errors = []error{}
warnings = []error{}
hostname := node.GetHostname("") hostname := node.GetHostname("")
for _, msg := range validation.ValidateNodeName(hostname, false) { for _, msg := range validation.ValidateNodeName(hostname, false) {
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, msg)) errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, msg))
} }
addr, err := net.LookupHost(hostname) addr, err := net.LookupHost(hostname)
if addr == nil { if addr == nil {
errors = append(errors, fmt.Errorf("hostname \"%s\" could not be reached", hostname)) warnings = append(warnings, fmt.Errorf("hostname \"%s\" could not be reached", hostname))
} }
if err != nil { if err != nil {
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, err)) warnings = append(warnings, fmt.Errorf("hostname \"%s\" %s", hostname, err))
} }
return nil, errors return warnings, errors
} }
// HTTPProxyCheck checks if https connection to specific host is going // HTTPProxyCheck checks if https connection to specific host is going
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment