Preserve path for cluster server endpoints (fixes virtctl with Rancher)
@@ -27,6 +27,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
+ "path"
"strconv"
"strings"
"time"
@@ -147,7 +148,10 @@ func RequestFromConfig(config *rest.Config, resource, name, namespace, subresour
return nil, fmt.Errorf("Unsupported Protocol %s", u.Scheme)
}
- u.Path = fmt.Sprintf("/apis/subresources.kubevirt.io/%s/namespaces/%s/%s/%s/%s", v1.ApiStorageVersion, namespace, resource, name, subresource)
+ u.Path = path.Join(
+ u.Path,
+ fmt.Sprintf("/apis/subresources.kubevirt.io/%s/namespaces/%s/%s/%s/%s", v1.ApiStorageVersion, namespace, resource, name, subresource),
+ )
req := &http.Request{
Method: http.MethodGet,
URL: u,
