Unverified Commit 0cdd940f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #58815 from bart0sh/PR0002-join-checks

Automatic merge from submit-queue. 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>. Fix adding FileContentCheck **What this PR does / why we need it**: Current code adds FileContentCheck only for the first API Server mentioned in the command line. The test is never added as net.ParseIP always fails because address:port is passed to it instead of just an address. Fixed both issues by introducing a loop over all API Servers and splitting address:port before passing address to the net.ParseIP API. **Release note**: ```release-note NONE ```
parents 1150de9c d503b807
...@@ -1002,12 +1002,16 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.NodeConfigura ...@@ -1002,12 +1002,16 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.NodeConfigura
criCtlChecker) criCtlChecker)
} }
if len(cfg.DiscoveryTokenAPIServers) > 0 { for _, server := range cfg.DiscoveryTokenAPIServers {
if ip := net.ParseIP(cfg.DiscoveryTokenAPIServers[0]); ip != nil { ipstr, _, err := net.SplitHostPort(server)
if ip.To4() == nil && ip.To16() != nil { if err == nil {
checks = append(checks, if ip := net.ParseIP(ipstr); ip != nil {
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}}, if ip.To4() == nil && ip.To16() != nil {
) checks = append(checks,
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
)
break // Ensure that check is added only once
}
} }
} }
} }
......
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