mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #82267 from kad/issue-1769
kubeadm: Form correct URL for IPv6 in HTTPProxy check
This commit is contained in:
commit
975d0736b3
@ -431,9 +431,12 @@ func (hst HTTPProxyCheck) Name() string {
|
||||
// Check validates http connectivity type, direct or via proxy.
|
||||
func (hst HTTPProxyCheck) Check() (warnings, errorList []error) {
|
||||
klog.V(1).Infoln("validating if the connectivity type is via proxy or direct")
|
||||
u := (&url.URL{Scheme: hst.Proto, Host: hst.Host}).String()
|
||||
u := &url.URL{Scheme: hst.Proto, Host: hst.Host}
|
||||
if utilsnet.IsIPv6String(hst.Host) {
|
||||
u.Host = net.JoinHostPort(hst.Host, "1234")
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", u, nil)
|
||||
req, err := http.NewRequest("GET", u.String(), nil)
|
||||
if err != nil {
|
||||
return nil, []error{err}
|
||||
}
|
||||
|
@ -590,6 +590,22 @@ func TestHTTPProxyCheck(t *testing.T) {
|
||||
}, // Expected to go via proxy, range is not in 2001:db8::/48
|
||||
expectWarnings: true,
|
||||
},
|
||||
{
|
||||
name: "IPv6 direct access, no brackets",
|
||||
check: HTTPProxyCheck{
|
||||
Proto: "https",
|
||||
Host: "2001:db8::1:15",
|
||||
}, // Expected to be accessed directly, part of 2001:db8::/48 in NO_PROXY
|
||||
expectWarnings: false,
|
||||
},
|
||||
{
|
||||
name: "IPv6 via proxy, no brackets",
|
||||
check: HTTPProxyCheck{
|
||||
Proto: "https",
|
||||
Host: "2001:db8:1::1:15",
|
||||
}, // Expected to go via proxy, range is not in 2001:db8::/48
|
||||
expectWarnings: true,
|
||||
},
|
||||
}
|
||||
|
||||
// Save current content of *_proxy and *_PROXY variables.
|
||||
|
Loading…
Reference in New Issue
Block a user