vendor: Better deal with failures under golang 1.8beta1
If minikube is built with go 1.8 or newer, localkube panics immediately
with the following message:
```
Feb 21 15:04:05 minikube localkube[3566]: I0221 15:04:05.712095 3566 services.go:51] Setting service IP to "10.0.0.1" (read-write).
Feb 21 15:04:05 minikube localkube[3566]: panic: parse 127.0.0.1:8080: first path segment in URL cannot contain colon
Feb 21 15:04:05 minikube localkube[3566]: goroutine 151 [running]:
Feb 21 15:04:05 minikube localkube[3566]: k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion.NewForConfigOrDie(0xc420c75380, 0xc420d04d40)
```
This issue was already reported to Kubernetes,
https://github.com/kubernetes/kubernetes/issues/38380. That was already
fixed in Kubernetes, but it's not included in Minikube yet.
So let's cherry-pick the commit to minikube, to avoid the panic.
Original commit message from
https://github.com/kubernetes/kubernetes/pull/38519
```
If there is any error in the initial parsing then we should just try
adding the scheme.
url.Parse(base) has changed in 1.8. Please see the following change
c5ccbdd22b
Fixes https://github.com/kubernetes/kubernetes/issues/38380
```
/cc @dims
pull/1164/head
parent
213857032a
commit
f9bfe65fc8
|
@ -33,10 +33,7 @@ func DefaultServerURL(host, apiPath string, groupVersion unversioned.GroupVersio
|
|||
}
|
||||
base := host
|
||||
hostURL, err := url.Parse(base)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if hostURL.Scheme == "" || hostURL.Host == "" {
|
||||
if err != nil || hostURL.Scheme == "" || hostURL.Host == "" {
|
||||
scheme := "http://"
|
||||
if defaultTLS {
|
||||
scheme = "https://"
|
||||
|
|
Loading…
Reference in New Issue