cli
cli copied to clipboard
The port number of the dashboard supports automatic selection.
Describe the proposal
The port of the dashboard should support automatic selection. When the --port
flag is set to 0
, a free port will be randomly found to start the dashboard to ensure that there will be no port conflicts.
Release Note
RELEASE NOTE:
- [x] the
--port
flag could be set to0
, In this case, dashboard will server on a random port which is free.
We can update portforward.LocalPort
use fw.GetPorts()
when portforward
is Ready
.
failure := make(chan error)
go func() {
if err := fw.ForwardPorts(); err != nil {
failure <- err
}
}()
select {
// if `fw.ForwardPorts()` succeeds, block until terminated
case <-pf.ReadyCh:
ports, err := fw.GetPorts()
if err == nil && len(ports) > 0{
pf.LocalPort = int(ports[0].Local)
pf.RemotePort = int(ports[0].Remote)
}
// if failure, causing a receive `<-failure` and returns the error
case err := <-failure:
return err
}
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.
@mukundansundar can you please open this issue again? There is an associated PR to close it.