File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
cmd/kubeadm/app/preflight Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -431,9 +431,12 @@ func (hst HTTPProxyCheck) Name() string {
431
431
// Check validates http connectivity type, direct or via proxy.
432
432
func (hst HTTPProxyCheck ) Check () (warnings , errorList []error ) {
433
433
klog .V (1 ).Infoln ("validating if the connectivity type is via proxy or direct" )
434
- u := (& url.URL {Scheme : hst .Proto , Host : hst .Host }).String ()
434
+ u := & url.URL {Scheme : hst .Proto , Host : hst .Host }
435
+ if utilsnet .IsIPv6String (hst .Host ) {
436
+ u .Host = net .JoinHostPort (hst .Host , "1234" )
437
+ }
435
438
436
- req , err := http .NewRequest ("GET" , u , nil )
439
+ req , err := http .NewRequest ("GET" , u . String () , nil )
437
440
if err != nil {
438
441
return nil , []error {err }
439
442
}
Original file line number Diff line number Diff line change @@ -590,6 +590,22 @@ func TestHTTPProxyCheck(t *testing.T) {
590
590
}, // Expected to go via proxy, range is not in 2001:db8::/48
591
591
expectWarnings : true ,
592
592
},
593
+ {
594
+ name : "IPv6 direct access, no brackets" ,
595
+ check : HTTPProxyCheck {
596
+ Proto : "https" ,
597
+ Host : "2001:db8::1:15" ,
598
+ }, // Expected to be accessed directly, part of 2001:db8::/48 in NO_PROXY
599
+ expectWarnings : false ,
600
+ },
601
+ {
602
+ name : "IPv6 via proxy, no brackets" ,
603
+ check : HTTPProxyCheck {
604
+ Proto : "https" ,
605
+ Host : "2001:db8:1::1:15" ,
606
+ }, // Expected to go via proxy, range is not in 2001:db8::/48
607
+ expectWarnings : true ,
608
+ },
593
609
}
594
610
595
611
// Save current content of *_proxy and *_PROXY variables.
You can’t perform that action at this time.
0 commit comments