Merge pull request #58812 from bart0sh/PR0001-join-checks

Automatic merge from submit-queue (batch tested with PRs 59653, 58812, 59582, 59665, 59511). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add   HTTPProxyCheck to preflight checks for 'kubeadm join' subcommand

**What this PR does / why we need it:**

Add HTTPProxyCheck for API servers
    
It makes sense to check API servers and print warnings if they're
going to be accessed through proxy. This is similar to what's
already done for 'kubeadm init'.
This commit is contained in:
Kubernetes Submit Queue 2018-02-13 11:12:44 -08:00 committed by GitHub
commit f7e5757380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1000,19 +1000,27 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.NodeConfigura
criCtlChecker)
}
var bridgenf6Check Checker
for _, server := range cfg.DiscoveryTokenAPIServers {
ipstr, _, err := net.SplitHostPort(server)
if err == nil {
if ip := net.ParseIP(ipstr); ip != nil {
if ip.To4() == nil && ip.To16() != nil {
checks = append(checks,
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
)
break // Ensure that check is added only once
checks = append(checks,
HTTPProxyCheck{Proto: "https", Host: ipstr},
)
if bridgenf6Check == nil {
if ip := net.ParseIP(ipstr); ip != nil {
if ip.To4() == nil && ip.To16() != nil {
// This check should be added only once
bridgenf6Check = FileContentCheck{Path: bridgenf6, Content: []byte{'1'}}
}
}
}
}
}
if bridgenf6Check != nil {
checks = append(checks, bridgenf6Check)
}
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
}