Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The port number of the dashboard supports automatic selection. #863

Closed
1 task done
imneov opened this issue Dec 26, 2021 · 4 comments · Fixed by #874
Closed
1 task done

The port number of the dashboard supports automatic selection. #863

imneov opened this issue Dec 26, 2021 · 4 comments · Fixed by #874
Assignees
Milestone

Comments

@imneov
Copy link
Contributor

imneov commented Dec 26, 2021

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:

  • the --port flag could be set to 0, In this case, dashboard will server on a random port which is free.
@imneov
Copy link
Contributor Author

imneov commented Dec 27, 2021

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
}

@dapr-bot
Copy link
Collaborator

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.

@dapr-bot dapr-bot added the stale label Feb 14, 2022
@dapr-bot
Copy link
Collaborator

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.

@shubham1172
Copy link
Member

@mukundansundar can you please open this issue again? There is an associated PR to close it.

@artursouza artursouza reopened this Apr 18, 2022
@mukundansundar mukundansundar added this to the v1.8 milestone Apr 18, 2022
@mukundansundar mukundansundar modified the milestones: v1.8, v1.9 Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants