mirror of
https://github.com/kubernetes/client-go.git
synced 2025-12-25 14:12:27 +00:00
When setting up a port forwarding with the client-go library (using the `k8s.io/client-go/tools/portforward.PortForwarder`) with a non-defined local port (i.e. passing `:80` as `ports` parameter to `portforward.New(...)`), a local port will be assigned dynamically. Currently, the local port will be _always_ 0 if it was not specified initially. This is because the assigned local port is only set on a _copy_ of the actual `ForwardedPort` type that is obtained in a `range` loop. This PR changes this behaviour to set the local port at the correct instance by passing a pointer instead of a copy to the relevant functions. Kubernetes-commit: bbddd27f0dfffe6623763afe2c02c876ba925a7c