From 3ecc49daaa344d3e0d90ac73adfed1c47536db63 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Wed, 31 Jan 2018 22:50:58 +0200 Subject: [PATCH] Add HTTPProxyCheck for API servers It makes sense to check all API servers mentioned in the command line and print warnings if they're going to be accessed through proxy. This is similar to what's already done for 'kubeadm init'. --- cmd/kubeadm/app/preflight/checks.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index 9add920416f..3c1e12e671b 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -999,19 +999,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) }