kubeadm preflight checks: fix host URL construction

This commit is contained in:
Benjamin Elder
2025-10-08 16:45:53 -07:00
committed by Jordan Liggitt
parent ae85505eac
commit 9fddfce038

View File

@@ -479,11 +479,8 @@ func (subnet HTTPProxyCIDRCheck) Check() (warnings, errorList []error) {
return nil, []error{errors.Wrapf(err, "unable to get first IP address from the given CIDR (%s)", cidr.String())}
}
testIPstring := testIP.String()
if len(testIP) == net.IPv6len {
testIPstring = fmt.Sprintf("[%s]:1234", testIP)
}
url := fmt.Sprintf("%s://%s/", subnet.Proto, testIPstring)
testHostString := net.JoinHostPort(testIP.String(), "1234")
url := fmt.Sprintf("%s://%s/", subnet.Proto, testHostString)
req, err := http.NewRequest("GET", url, nil)
if err != nil {