Skip to content

Commit f31ff2c

Browse files
laveryaSSvilen
andauthored
Prepend Kubernetes API path, if present (#5256)
* git push * add api path to the request --------- Co-authored-by: Svilen Sultanov <[email protected]>
1 parent 5727dfd commit f31ff2c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/k8sutil/portforward.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ func createDialer(cfg *rest.Config, namespace string, podName string) (httpstrea
360360
if err != nil {
361361
return nil, errors.Wrap(err, "failed to create roundtriper")
362362
}
363-
path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", namespace, podName)
364363
scheme := ""
365364
hostIP := cfg.Host
366365

@@ -373,6 +372,7 @@ func createDialer(cfg *rest.Config, namespace string, podName string) (httpstrea
373372
scheme = u.Scheme
374373
hostIP = u.Host
375374
}
375+
path := fmt.Sprintf("%s/api/v1/namespaces/%s/pods/%s/portforward", u.Path, namespace, podName)
376376

377377
serverURL := url.URL{Scheme: scheme, Path: path, Host: hostIP}
378378
return spdy.NewDialer(upgrader, &http.Client{Transport: roundTripper}, http.MethodPost, &serverURL), nil

0 commit comments

Comments
 (0)