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

Setup port-forwarding for linkerd dashboard command #2052

Merged
merged 2 commits into from
Jan 10, 2019
Merged

Conversation

klingerf
Copy link
Member

@klingerf klingerf commented Jan 8, 2019

This branch switches the linkerd dashboard command from using the kubernetes service proxy to access the web UI, to instead using port-forward to access the web pod directly. This simplifies the URLs displayed in the dashboard, and it removes our direct dependency on "k8s.io/kubernetes" 🎉

As part of this change, I fixed a bug with linkerd dashboard, where the proxy would not start until after the dashboard had been successfully loaded in a browser (relates to #2047). And I've updated the integration tests to use port-forwarding instead of proxying to access pods running in the test environment.

Fixes #1696.

@klingerf klingerf self-assigned this Jan 8, 2019
@klingerf klingerf requested a review from siggy January 8, 2019 23:50
@grampelberg
Copy link
Contributor

Woah, now that's an awesome PR.

@klingerf
Copy link
Member Author

klingerf commented Jan 9, 2019

Note that there's still a lot of code in the web/ directory for loading the web UI through the service proxy. If we decide that we're not going to support viewing the web UI via kubectl proxy, then we could rip all of that out and it would clean things up a lot. @grampelberg, do you have a preference one way or another?

@grampelberg
Copy link
Contributor

@klingerf I'm totally behind removing support for viewing the dashboard it via kubectl proxy.

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

awesome change! a few tioli comments but looks great!

screen shot 2019-01-08 at 5 06 35 pm👏

Gopkg.toml Show resolved Hide resolved
cli/cmd/dashboard.go Show resolved Hide resolved
pkg/k8s/portforward.go Show resolved Hide resolved
pkg/k8s/portforward.go Show resolved Hide resolved
ports := []string{fmt.Sprintf("%d:%d", pf.localPort, pf.remotePort)}
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, pf.method, pf.url)

fw, err := portforward.New(dialer, ports, pf.stopCh, pf.readyCh, ioutil.Discard, ioutil.Discard)
Copy link
Member

Choose a reason for hiding this comment

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

consider os.Stdout, os.Stderr, perhaps when verbose is enabled?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea! Have added that in the latest commit.

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

👍 🚢

ports := []string{fmt.Sprintf("%d:%d", pf.localPort, pf.remotePort)}
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, pf.method, pf.url)

fw, err := portforward.New(dialer, ports, pf.stopCh, pf.readyCh, ioutil.Discard, ioutil.Discard)
fw, err := portforward.New(dialer, ports, pf.stopCh, pf.readyCh, out, errOut)
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Forwarding from 127.0.0.1:51328 -> 8084
Forwarding from [::1]:51328 -> 8084
Linkerd dashboard available at:
http://127.0.0.1:51328
Grafana dashboard available at:
http://127.0.0.1:51328/grafana
Handling connection for 51328

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
@klingerf klingerf merged commit ed3fbd7 into master Jan 10, 2019
@klingerf klingerf deleted the kl/port-forward branch January 10, 2019 18:16
codeman9 pushed a commit to Nordstrom/linkerd2 that referenced this pull request Jan 11, 2019
* Setup port-forwarding for linkerd dashboard command
* Output port-forward logs when --verbose flag is set

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
Signed-off-by: Cody Vandermyn <cody.vandermyn@nordstrom.com>
codeman9 pushed a commit to Nordstrom/linkerd2 that referenced this pull request Jan 11, 2019
* Setup port-forwarding for linkerd dashboard command
* Output port-forward logs when --verbose flag is set

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
Signed-off-by: Cody Vandermyn <cody.vandermyn@nordstrom.com>
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.

use port-forward for linkerd dashboard
3 participants