GoogleContainerTools / GoogleContainerTools/skaffold
Port forward: multiple localPort for a same resource
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
What I'm trying to do: forward a service port to two hosts ports so I have `localhost:XXX` and `localhost:YYY` binded to the same resource and port.
### Expected behavior
Being able to set the same `portForward` rule two times with just a different `localPort` (but same `namespace`, `resourceType`, `resourceName` and `port`).
### Actual behavior
Skaffold forwards only the first entry.
### Information
- Skaffold version: `1.26.1`
- Operating system: Fedora Silverblue 34 (`34.20210620.0`)
- Installed via: downloaded the binary release from Github
- Contents of skaffold.yaml:
```yaml
…
portForward:
- namespace: ambassador
resourceType: service
resourceName: ambassador
port: 443
localPort: 10000
- namespace: ambassador
resourceType: service
resourceName: ambassador
port: 443
localPort: 4200
…
```
### Steps to reproduce the behavior
1. setup a service which listen on a port (here, installed Ambassador Edge Stack)
2. setup `portForward` twice for this service and port but with two different local ports
3. run `skaffold dev`
4. try `curl localhost:XXX` and `curl localhost:YYY` for both ports, see only one is opened
### Logs
#### Expected
Seeing two ports forwarded.
```
Port forwarding service/ambassador in namespace ambassador, remote port 443 -> 127.0.0.1:10000
Port forwarding service/ambassador in namespace ambassador, remote port 443 -> 127.0.0.1:4200
```
#### Actual
Missing one forwarding.
```
Port forwarding service/ambassador in namespace ambassador, remote port 443 -> 127.0.0.1:10000
```
If I put the `4200` forward before the `10000` forward, the `4200` is used (so I guess Skaffold uses the first `portForward` rule when you have multiple rules with only a changing `localPort`).
Contributor guide
Assessment
This issue has not been assessed yet.