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

Added new CLI command dapr dashboard #383

Merged
merged 8 commits into from
Jun 29, 2020

Conversation

gdhuper
Copy link
Member

@gdhuper gdhuper commented Jun 25, 2020

Description

Extended dapr cli to launch dapr dashboard in kubernetes.

Runs the Dapr dashboard on a Kubernetes cluster

Usage:
  dapr dashboard [flags]

Flags:
  -h, --help         help for dashboard
  -k, --kubernetes   Start Dapr dashboard in local browser
  -p, --port int     The local port on which to serve dashboard (default 8080)

Issue reference

This PR will close: #341

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Added code comments
  • Created/updated tests
  • Extended the documentation

@yaron2 yaron2 self-requested a review June 25, 2020 02:25
@gdhuper gdhuper changed the title Gdhuper/dapr dashboard Added new CLI command dapr dashboard Jun 25, 2020
"k8s.io/client-go/transport/spdy"
)

type PortForward struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments for exported methods. It is applicable for other methods.

host string, localPort, remotePort int,
emitLogs bool,
) (*PortForward, error) {
time.Sleep(10 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this sleep is not needed here, almost it is quite long 10 secs.

Copy link
Member Author

@gdhuper gdhuper Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, 10 secs feel a bit long. I had to introduce this 10 secs delay because portforwarding would fail since the pod takes couple of seconds to be up and running. Any ideas how to do this idiomatically using client API?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the way to do it. Sleep is not needed.

Generally, we should only connect if the dashboard pod is in Ready status.


func InitDashboard() error {

var dashboardManifestPath string = "https://raw.githubusercontent.com/dapr/dashboard/master/deploy/dashboard.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to create const and use that const.

cmd/dashboard.go Outdated
false,
)
if err != nil {
print.FailureStatusEvent(os.Stderr, "Failed to initialize port forwarding: %s\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if either you can change the error message here to "creating.." or change Line 70 to "error in port forwarding.."
because both messages conveying the same message for 2 different related things..

Copy link
Contributor

@shalabhms shalabhms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution !

cmd/dashboard.go Outdated

func init() {
DashboardCmd.Flags().BoolVarP(&kubernetesMode, "kubernetes", "k", false, "Deploy Dapr dashboard to a Kubernetes cluster")
DashboardCmd.Flags().BoolVarP(&open, "open", "o", false, "Open Dapr dashboard in a browser")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change "open" to "start" .

@shalabhms
Copy link
Contributor

@gdhuper , will you also be considering in your changes for invoking dashboard in standalone mode ?

@yaron2
Copy link
Member

yaron2 commented Jun 25, 2020

@gdhuper , will you also be considering in your changes for invoking dashboard in standalone mode ?

We discussed this in the issue, this PR will tackle Kubernetes first. Once we agree on a packaging and distribution format of the dashboard for self-hosted mode, we can later enable it in the CLI.

@yaron2
Copy link
Member

yaron2 commented Jun 25, 2020

This overall looks great!

Yesterday in a maintainers meeting, the following decisions were made:

  1. The dashboard will be installed by default with Helm
  2. The dashboard will be installed by default with dapr init.

Thus, I think we can remove the deployment of the dashboard from this PR, and have dapr dashboard -k open the browser locally IF the dashboard pod is located in the cluster and is in a Ready state.

/cc @gdhuper @shalabhms @willdavsmith

@gdhuper
Copy link
Member Author

gdhuper commented Jun 25, 2020

@gdhuper , will you also be considering in your changes for invoking dashboard in standalone mode ?

yeah so that was the plan initially to support both standalone and kubernetes mode, but turns out standalone mode is a bit tricky with containers. However, as Yaron mentioned in this comment, we can download dashboard as a zip and spin it up in a local dir. IIRC, dapr/dashboard does not have a release pipeline. Any plans on setting one up for dashboard so standalone mode could be supported?

EDIT: I think my question was answered as I was writing this :). I'll go ahead an remove dashboard deployment from this PR. Thanks

@shalabhms
Copy link
Contributor

shalabhms commented Jun 25, 2020

This overall looks great!

Yesterday in a maintainers meeting, the following decisions were made:

  1. The dashboard will be installed by default with Helm
  2. The dashboard will be installed by default with dapr init.

Thus, I think we can remove the deployment of the dashboard from this PR, and have dapr dashboard -k open the browser locally IF the dashboard pod is located in the cluster and is in a Ready state.

/cc @gdhuper @shalabhms @willdavsmith

@yaron2 , that's right. We can remove deployment from dapr dashboard --k but we need to have similar changes in dapr init for kubernetes also for development mode. I think @gdhuper can still bring changes directly in dapr init code path.
Thoughts ?

@shalabhms
Copy link
Contributor

This overall looks great!
Yesterday in a maintainers meeting, the following decisions were made:

  1. The dashboard will be installed by default with Helm
  2. The dashboard will be installed by default with dapr init.

Thus, I think we can remove the deployment of the dashboard from this PR, and have dapr dashboard -k open the browser locally IF the dashboard pod is located in the cluster and is in a Ready state.
/cc @gdhuper @shalabhms @willdavsmith

@yaron2 , that's right. We can remove deployment from dapr dashboard --k but we need to have similar changes in dapr init for kubernetes also for development mode. I think @gdhuper can still bring changes directly in dapr init code path.
Thoughts ?

@gdhuper , dapr init -k will take care of deploying dashboard.yaml. So yes, you can remove dashboard deployment from this PR.

Thanks @yaron2 for clarification.

@gdhuper gdhuper requested a review from shalabhms June 29, 2020 08:47
Copy link
Contributor

@willdavsmith willdavsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for doing this.

Copy link
Contributor

@shalabhms shalabhms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your valuable contribution !

Copy link
Member

@yaron2 yaron2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you for this.

@yaron2 yaron2 merged commit 0a1a0bd into dapr:master Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New CLI command dashboard
4 participants