Commit Graph

85 Commits

Author SHA1 Message Date
Tarun Pothulapati 2be43a5f9d
Add Jaeger links to the Linkerd dashboard (#4177)
* Add Jaeger reverse proxy
* add jaegerLink to the metrics table
* update MetricsTable tests
* Add optional jaeger link
* rename grafana_proxy to reverse_proxy

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2020-05-07 16:35:56 -05:00
Tarun Pothulapati 2a95d373c4
make grafana optional in linkerd-web (#4319)
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2020-05-07 22:14:55 +05:30
Kevin Leimkuhler 63c8c65ec7
Ensure cache does not store index_bundle.js (#3891)
## Motivation

Full background: #2074

#2074 was recently reopened because a user reported an error that occurs when
refreshing an already opened dashboard after the dashboard build has changed.
This can occur when upgrading or downgrading.

#2074 explores a larger issue about a redirection that occurs when loading the
dashboard JS. However, the actual issue that users are experiencing happens
because `index_bundle.js` is being cached when it should not be.

Even if the hash of the JS bundle changes, users can see (on the current edge)
that browsers do in fact cache `index_bundle.js`.

The easiest way I reproduced this was:
1. Install `edge-19.12.3`
2. `linkerd dashboard` (and keep the tab open)
2. Uninstall `edge-19.12.3`
3. Install `stable-2.5.0`
4. `linkerd dashboard`
5. Refresh in all browsers: Users will observe the `edge-19.12.3` dashboard
   still renders (with all of it's new additions) even though `stable-2.5.0` is
   installed with it's older theme.

Below are screenshots of Safari and Firefox caching the file. Chrome was not as
easy to reproduce:

*Safari*
![Screen Shot 2020-01-07 at 5 39 00 PM](https://user-images.githubusercontent.com/4572153/71944121-9d691400-3177-11ea-9d36-e173e0b7138e.png)

*Firefox*
![Screen Shot 2020-01-07 at 5 39 21 PM](https://user-images.githubusercontent.com/4572153/71944161-c25d8700-3177-11ea-9cd4-796dd0a4900e.png)

## Solution

This change only changes the response header when requesting `index_bundle.js`
from the server to ensure caching does not take place; mainly `no-cache` is
changed to `no-store` and `must-revalidate` is now included.

`no-store` and `must-revalidate` are redundant on some browsers but both
required to cover all browsers (and versions).

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2020-01-08 09:56:40 -08:00
Alejandro Pedraza 419b9f1502
Fix race condition in web service (#3883)
Fixes #3859, followup to #3769

The addition of the web service's `statCache` introduced a race condition on the `h.statCache` variable, that is read and written in `handleAPIStat()` without mutext guards. I've moved the `statCache` initialization into `/web/srv/server.go` to avoid this problem.

The issue can be easily reproduced with
```bash
$ bin/web dev

$ for run in {1..2}; do curl 'http://localhost:7777/api/tps-reports?resource_type=deployment&namespace=linkerd&tcp_stats=true&resource_name=linkerd-destination&window=1m' &  done
[1] 11672
[2] 11673
{"ok":{"statTables":[{"podGroup":{"rows":[{"resource":{"namespace":"linkerd","type":"deployment","name":"linkerd-destination"},"timeWindow":"1m","status":"","meshedPodCount":"1","runningPodCount":"1","failedPodCount":"0","stats":{"successCount":"18","failureCount":"0","latencyMsP50":"1","latencyMsP95":"9","latencyMsP99":"10","actualSuccessCount":"0","actualFailureCount":"0"},"tcpStats":{"openConnections":"7","readBytesTotal":"23174","writeBytesTotal":"22946"},"tsStats":null,"errorsByPod":{}}]}}]}}{"ok":{"statTables":[{"podGroup":{"rows":[{"resource":{"namespace":"linkerd","type":"deployment","name":"linkerd-destination"},"timeWindow":"1m","status":"","meshedPodCount":"1","runningPodCount":"1","failedPodCount":"0","stats":{"successCount":"18","failureCount":"0","latencyMsP50":"1","latencyMsP95":"9","latencyMsP99":"10","actualSuccessCount":"0","actualFailureCount":"0"},"tcpStats":{"openConnections":"7","readBytesTotal":"23174","writeBytesTotal":"22946"},"tsStats":null,"errorsByPod":{}}]}}]}}[1]-  Done                    curl 'http://localhost:7777/api/tps-reports?resource_type=deployment&namespace=linkerd&tcp_stats=true&resource_name=linkerd-destination&window=1m'
[2]+  Done                    curl 'http://localhost:7777/api/tps-reports?resource_type=deployment&namespace=linkerd&tcp_stats=true&resource_name=linkerd-destination&window=1m'

==================
WARNING: DATA RACE
Read at 0x00c000192308 by goroutine 58:
  github.com/linkerd/linkerd2/web/srv.(*handler).handleAPIStat()
      /home/alpeb/src/linkerd2/web/srv/api_handlers.go:140 +0x61
  github.com/linkerd/linkerd2/web/srv.(*handler).handleAPIStat-fm()
      /home/alpeb/src/linkerd2/web/srv/api_handlers.go:138 +0x7d
  github.com/julienschmidt/httprouter.(*Router).ServeHTTP()
      /home/alpeb/go/pkg/mod/github.com/julienschmidt/httprouter@v1.2.0/router.go:334 +0x10b7
  github.com/linkerd/linkerd2/web/srv.(*Server).ServeHTTP()
      /home/alpeb/src/linkerd2/web/srv/server.go:69 +0x4c0
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:100 +0xf8
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:196 +0x104
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:68 +0x13c
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  go.opencensus.io/plugin/ochttp.(*Handler).ServeHTTP()
      /home/alpeb/go/pkg/mod/go.opencensus.io@v0.22.0/plugin/ochttp/server.go:86 +0x3f9
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2802 +0xce
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1890 +0x837

Previous write at 0x00c000192308 by goroutine 56:
  github.com/linkerd/linkerd2/web/srv.(*handler).handleAPIStat()
      /home/alpeb/src/linkerd2/web/srv/api_handlers.go:141 +0xd5e
  github.com/linkerd/linkerd2/web/srv.(*handler).handleAPIStat-fm()
      /home/alpeb/src/linkerd2/web/srv/api_handlers.go:138 +0x7d
  github.com/julienschmidt/httprouter.(*Router).ServeHTTP()
      /home/alpeb/go/pkg/mod/github.com/julienschmidt/httprouter@v1.2.0/router.go:334 +0x10b7
  github.com/linkerd/linkerd2/web/srv.(*Server).ServeHTTP()
      /home/alpeb/src/linkerd2/web/srv/server.go:69 +0x4c0
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:100 +0xf8
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:196 +0x104
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1()
      /home/alpeb/go/pkg/mod/github.com/prometheus/client_golang@v1.2.1/prometheus/promhttp/instrument_server.go:68 +0x13c
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2007 +0x51
  go.opencensus.io/plugin/ochttp.(*Handler).ServeHTTP()
      /home/alpeb/go/pkg/mod/go.opencensus.io@v0.22.0/plugin/ochttp/server.go:86 +0x3f9
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:2802 +0xce
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1890 +0x837

Goroutine 58 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/go/src/net/http/server.go:2927 +0x5be
  net/http.(*Server).ListenAndServe()
      /usr/local/go/src/net/http/server.go:2825 +0x102
  main.main.func1()
      /home/alpeb/src/linkerd2/web/main.go:105 +0xdd

Goroutine 56 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/go/src/net/http/server.go:2927 +0x5be
  net/http.(*Server).ListenAndServe()
      /usr/local/go/src/net/http/server.go:2825 +0x102
  main.main.func1()
      /home/alpeb/src/linkerd2/web/main.go:105 +0xdd
```
2020-01-07 17:21:45 -05:00
Sergio C. Arteaga a1141fc507 Cache StatSummary responses in dashboard web server (#3769)
Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
2019-12-17 09:15:00 -05:00
Sergio C. Arteaga cee8e3d0ae Add CronJobs and ReplicaSets to dashboard and CLI (#3687)
This PR adds support for CronJobs and ReplicaSets to `linkerd inject`, the web
dashboard and CLI. It adds a new Grafana dashboard for each kind of resource. 

Closes #3614 
Closes #3630 
Closes #3584 
Closes #3585

Signed-off-by: Sergio Castaño Arteaga tegioz@icloud.com
Signed-off-by: Cintia Sanchez Garcia cynthiasg@icloud.com
2019-12-11 10:02:37 -08:00
Sergio C. Arteaga 78ed5f8883 Make resource definition available to dashboard (#3666)
This PR allows the dashboard to query for a resource's definition in YAML
format, if the boolean `queryForDefinition` in the `ResourceDetail` component is
set to true. 

This change to the web API and the dashboard component was made for a future
redesigned dashboard detail page. At present, `queryForDefinition` is set to
false and there is no visible change to the user with this PR. 

Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com> Signed-off-by: Cintia
Sanchez Garcia <cynthiasg@icloud.com>
2019-12-03 10:25:20 -08:00
Sergio C. Arteaga eff1714a08 Add `linkerd check` to dashboard (#3656)
`linkerd check` can now be run from the dashboard in the `/controlplane` view.
Once the check results are received, they are displayed in a modal in a similar
style to the CLI output.

Closes #3613
2019-11-12 12:37:36 -08:00
Alejandro Pedraza bd8d47226d
DNS rebinding protection for the dashboard (#3644)
* DNS rebinding protection for the dashboard

Fixes #3083 and replacement for #3629

This adds a new parameter to the `linkerd-web` container `enforcedHost`
that establishes the regexp that the Host header must enforce, otherwise
it returns an error.

This parameter will be hard-coded for now, in `linkerd-web`'s deployment
yaml.

Note this also protects the dashboard because that's proxied from
`linkerd-web`.

Also note this means the usage of `linkerd dashboard --address` will
require the user to change that parameter in the deployment yaml (or
have Kustomize do it).

How to test:
- Run `linkerd dashboard`
- Go to http://rebind.it:8080/manager.html and change the target port to
50750
- Click on “Start Attack” and wait for a minute.
- The response from the dashboard will be returned, showing an 'Invalid
Host header' message returned by the dashboard. If the attack would have
succeeded then the dashboard's html would be shown instead.

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-10-31 11:51:25 -05:00
Alex Leong 4799baa8e2
Revert "Trace Control Plane components using OC (#3461)" (#3484)
This reverts commit edd3b1f6d4.

This is a temporary revert of #3461 while we sort out some details of how this should configured and how it should interact with configuring a trace collector on the Linkerd proxy.  We will reintroduce this change once the config plan is straightened out.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-09-26 11:56:44 -07:00
Tarun Pothulapati edd3b1f6d4 Trace Control Plane components using OC (#3461)
* add exporter config for all components

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add cmd flags wrt tracing

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add ochttp tracing to web server

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add flags to the tap deployment

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add trace flags to install and upgrade command

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add linkerd prefix to svc names

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add ochttp trasport to API Internal Client

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* fix goimport linting errors

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add ochttp handler to tap http server

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* review and fix tests

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* update test values

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* use common template

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* update tests

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* use Initialize

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* fix sample flag

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* add verbose info reg flags

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2019-09-26 08:11:48 -07:00
Carol A. Scott 9d18de5e62
Dashboard sidebar redesign (#3467)
This PR fixes #3400 and redesigns the dashboard to minimize load on Prometheus.
2019-09-25 16:54:11 -07:00
Carol A. Scott d4f3f210ce
Add trafficsplit to dashboard (#3333)
Fixes #3261.

Adds trafficsplit data to the dashboard via the Resources sidebar.
2019-09-03 12:41:29 -07:00
Kevin Leimkuhler e41986e255
Remove redundant `HTTPError` cast check in web server (#3222)
* Clean up HTTPError cast check

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2019-08-09 11:06:50 -07:00
Kevin Leimkuhler db381a007a
Check for 403 status code when preparing tap error (#3215)
* Check for 403 to pass to websocketError

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2019-08-08 12:09:54 -07:00
Kevin Leimkuhler 5d7662fd90
Update web server to use tap APIService (#3208)
### Motivation

PR #3167 introduced the tap APIService and migrated `linkerd tap` to use it.
Subsequent PRs (#3186 and #3187) updated `linkerd top` and `linkerd profile
--tap` to use the tap APIService. This PR moves the web's Go server to now also
use the tap APIService instead of the public API. It also ensures an error
banner is shown to the user when unauthorized taps fail via `linkerd top`
command in *Overview* and *Top*, and `linkerd tap` command in *Tap*.

### Details

The majority of these changes are focused around piping through the HTTP error
that occurs and making sure the error banner generated displays the error
message explaining to view the tap RBAC docs.

`httpError` is now public (`HTTPError`) and the error message generated is short
enough to fit in a control frame (explained [here](https://github.com/linkerd/linkerd2/blob/kleimkuhler%2Fweb-tap-apiserver/web/srv/api_handlers.go#L173-L175)).

### Testing

The error we are testing for only occurs when the linkerd-web service account is
not authorzied to tap resources. Unforutnately that is not the case on Docker
For Mac (assuming that is what you use locally), so you'll need to test on a
different cluster. I chose a GKE cluster made through the GKE console--not made
through cluster-utils because it adds cluster-admin.

Checkout the branch locally and `bin/docker-build` or `ares-build` if you have
it setup. It should produce a linkerd with the version `git-04e61786`. I have
already pushed the dependent components, so you won't need to `bin/docker-push
git-04e61786`.

Install linkerd on this GKE cluster and try to run `tap` or `top` commands via
the web. You should see the following errors:

### Tap

![web-tap-unauthorized](https://user-images.githubusercontent.com/4572153/62661243-51464900-b925-11e9-907b-29d7ca3f815d.png)

### Top

![web-top-unauthorized](https://user-images.githubusercontent.com/4572153/62661308-894d8c00-b925-11e9-9498-6c9d38b371f6.png)

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
2019-08-08 10:18:32 -07:00
arminbuerkle e3d68da1dc Allow setting custom cluster domain in service profiles (#3148)
Continue of #2950.

I decided to check for the `clusterDomain` in the config map in web server main for the same reasons as as pointed out here https://github.com/linkerd/linkerd2/pull/3113#discussion_r306935817

It decouples the server implementations from the config.

Signed-off-by: Armin Buerkle <armin.buerkle@alfatraining.de>
2019-08-07 09:49:54 -07:00
Andrew Seigner 484c404d29
Set HTTP security headers on dashboard (#3138)
Set the following headers on every dashboard response:
- `X-Content-Type-Options: nosniff`
- `X-Frame-Options: SAMEORIGIN`
- `X-XSS-Protection: 1; mode=block`

Fixes #3082

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-07-25 16:01:42 -07:00
Alex Leong d6ef9ea460
Update ServiceProfile CRD to version v1alpha2 and remove validation (#3078)
The openAPIV3Schema validation in the ServiceProfiles CRD is very limited in what it can validate and is obviated by more sophisticated validation done by the validating admission controller.  Therefore, we would like to remove the openAPIV3Schema validation to reduce the size and complexity of the CRD object.

To do so, we must also bump the version of the ServiceProfile custom resource from v1alpha1 to v1alpha2.  This ensures that when the controller is upgraded, it will attempt to watch the v1alpha2 resource.  If it cannot (because, for example, the controller pod started before the ServiceProfile CRD was updated and therefore the v1alpha2 version does not exist) then it will go into a crash loop backoff until it can.  This essentially means that the controller will wait for the CRD to be upgraded to include v1alpha2 before it will start.  

Bumping the version is necessary because if we did not, it would be possible for the controller to start before the CRD is updated (removing the validation).  In this case, when the CRD is edited, the controller will lose its list watch on ServiceProfiles and will stop getting updates.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-07-23 11:46:31 -07:00
Carol A. Scott dce462acd9
Add Edges table to resource detail view of dashboard (#2965)
Adds an Edges table to the resource detail view that shows the source,
destination name and identity for proxied connections to and from the resource
shown.
2019-06-20 10:50:11 -07:00
Alejandro Pedraza 928d4cb522
Remove unimplemented debug page on dashboard (#2952)
* Remove unimplemented debug page on dashboard

Fixes #2895

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-06-17 14:43:09 -05:00
Carol A. Scott a2e63de966
Add "Community" menu item to dashboard that displays linkerd.io content (#2476)
Closes #2327.

This PR creates a "Community" menu item on the dashboard sidebar that, when clicked, displays an iFrame of a page on linkerd.io. A yellow badge appears on the menu item if there has been an update since the user last clicked the "Community" menu item. This is calculated by comparing a date in the user's localStorage to a JSON feed at linkerd.io.
2019-03-14 09:55:09 -07:00
Gaurav Kumar e9287cc8c8 Fix service profiles quoted filename download issue (#2473) (#2479)
* Fix service profiles quoted filename download issue (#2473)
* Change the tests accordingly to fix quotes in filename

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-12 15:49:17 -07:00
Andrew Seigner e5d2460792
Remove single namespace functionality (#2474)
linkerd/linkerd2#1721 introduced a `--single-namespace` install flag,
enabling the control-plane to function within a single namespace. With
the introduction of ServiceProfiles, and upcoming identity changes, this
single namespace mode of operation is becoming less viable.

This change removes the `--single-namespace` install flag, and all
underlying support. The control-plane must have cluster-wide access to
operate.

A few related changes:
- Remove `--single-namespace` from `linkerd check`, this motivates
  combining some check categories, as we can always assume cluster-wide
  requirements.
- Simplify the `k8s.ResourceAuthz` API, as callers no longer need to
  make a decision based on cluster-wide vs. namespace-wide access.
  Components either have access, or they error out.
- Modify the web dashboard to always assume ServiceProfiles are enabled.

Reverts #1721
Part of #2337

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-12 00:17:22 -07:00
Tarun Pothulapati 8f6c63d5ea Added Jobs Resource to Linkerd Dashboard along with grafana. (#2439)
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2019-03-06 17:06:46 -08:00
Andrew Seigner ec5a0ca8d9
Authorization-aware control-plane components (#2349)
The control-plane components relied on a `--single-namespace` param,
passed from `linkerd install` into each individual component, to
determine which namespaces they were authorized to access, and whether
to support ServiceProfiles. This command-line flag was redundant given
the authorization rules encoded in the parent `linkerd install` output,
via [Cluster]Role[Binding]s.

Modify the control-plane components to query Kubernetes at startup to
determine which namespaces they are authorized to access, and whether
ServiceProfile support is available. This allows removal of the
`--single-namespace` flag on the components.

Also update `bin/test-cleanup` to cleanup the ServiceProfile CRD.

TODO:
- Remove `--single-namespace` flag on `linkerd install`, part of #2164

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-26 11:54:52 -08:00
Andrew Seigner bc735ebdc2
Fix goconst linter breakage following master merge (#2378)
linkerd/linkerd2#2365 introduced the goconst linter and fixes, but additional lint
errors had been introduced to master.

This change fixes the one remaining goconst issue.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 12:57:27 -08:00
Risha Mars 80b6e41d5d
Modify StatSummary to also return TCP stats (#2262)
Adds a flag, tcp_stats to the StatSummary request, which queries prometheus for TCP stats.
This branch returns TCP stats at /api/tps-reports when this flag is true.

TCP stats are now displayed on the Resource Detail pages.

The current queried TCP stats are:
tcp_open_connections
tcp_read_bytes_total
tcp_write_bytes_total
2019-02-25 10:37:39 -08:00
Andrew Seigner 4b6f6aeedd
Enable gosimple linter, fix issues (#2356)
gosimple is a Go linter that specializes in simplifying code

Also fix one spelling error in `cred_test.go`

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-22 17:19:07 -08:00
Risha Mars 3e9c7d2132
Add an Endpoints view to the web dashboard (#2275)
In #2195 we introduced `linkerd endpoints` on the CLI. I would like similar
information to be on the web.

This PR adds an api endpoint at `/api/endpoints`, and introduces a new debugging
pagethat shows a table of endpoints, available at `/debug`
2019-02-21 11:57:51 -08:00
Ivan Sim f6e75ec83a
Add statefulsets to the dashboard and CLI (#2234)
Fixes #1983

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-08 15:37:44 -08:00
Alex Leong 5b054785e5
Read service profiles from client or server namespace instead of control namespace (#2200)
Fixes #2077 

When looking up service profiles, Linkerd always looks for the service profile objects in the Linkerd control namespace.  This is limiting because service owners who wish to create service profiles may not have write access to the Linkerd control namespace.

Instead, we have the control plane look for the service profile in both the client namespace (as read from the proxy's `proxy_id` field from the GetProfiles request and from the service's namespace.  If a service profile exists in both namespaces, the client namespace takes priority.  In this way, clients may override the behavior dictated by the service.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-02-07 14:51:43 -08:00
Andrew Seigner 907f01fba6
Improve ServiceProfile validation in linkerd check (#2218)
The `linkerd check` command was doing limited validation on
ServiceProfiles.

Make ServiceProfile validation more complete, specifically validate:
- types of all fields
- presence of required fields
- presence of unknown fields
- recursive fields

Also move all validation code into a new `Validate` function in the
profiles package.

Validation of field types and required fields is handled via
`yaml.UnmarshalStrict` in the `Validate` function. This motivated
migrating from github.com/ghodss/yaml to a fork, sigs.k8s.io/yaml.

Fixes #2190
2019-02-07 14:35:47 -08:00
zak 8c413ca38b Wire up stats commands for daemonsets (#2006) (#2086)
DaemonSet stats are not currently shown in the cli stat command, web ui
or grafana dashboard. This commit adds daemonset support for stat.

Update stat command's help message to reference daemonsets.
Update the public-api to support stats for daemonsets.
Add tests for stat summary and api.

Add daemonset get/list/watch permissions to the linkerd-controller
cluster role that's created using the install command.
Update golden expectation test files for install command
yaml manifest output.

Update web UI with daemonsets
Update navigation, overview and pages to list daemonsets and the pods
associated to them.
Add daemonset paths to server, and ui apps.

Add grafana dashboard for daemonsets; a clone of the deployment
dashboard.

Update dependencies and dockerfile hashes

Add DaemonSet support to tap and top commands

Fixes of #2006

Signed-off-by: Zak Knill <zrjknill@gmail.com>
2019-01-24 14:34:13 -08:00
Risha Mars cce6183c4a
Update Top Routes in dashboard to use new API, add `to` query options (#2112)
The recent routes API changes caused the Top Routes tab to stop working, as it
wasn't looking for the changed structure of the response. This PR updates that
page to accept the new API response.

This PR also adds to fields to the Top Routes query form, so that the equivalent
of linkerd routes deploy --to deploy/authors will work in the dashboard.
2019-01-23 14:29:27 -08:00
Alena Varkockova 28f662c9c6 Introduce resource selector and deprecate namespace field for ListPods (#2025)
* Introduce resource selector and deprecate namespace field for ListPods
* Changes from code review
* Properly deprecate the field
* Do not check for nil
* Fix the mockProm usage
* Protoc changes revert
* Changed from code review

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>
2019-01-23 10:35:55 -08:00
Andrew Seigner af47232eda
Hash JS bundle to expire cache (#2058)
JavaScript assets could be cached across Linkerd releases, showing an
out of date ui, or a broken page.

Modify the webpack build pipeline to add a hash to the JS bundle
filename. Move all logic around webpack-dev-server state from Go into
JS, via a templatized index_bundle.js file, generated at build time.
Disable caching of index_bundle.js in Go, via a `Cache-Control` header.

Fixes #1996

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-01-16 12:59:30 -08:00
Kevin Lingerfelt a27bb2e0ce
Proxy grafana requests through web service (#2039)
* Proxy grafana requests through web service
* Fix -grafana-addr default, clarify -api-addr flag
* Fix version check in grafana dashboards
* Fix comment typo

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-01-04 16:07:57 -08:00
Andrew Seigner 1c302182ef
Enable lint check for comments (#2023)
Commit 1: Enable lint check for comments

Part of #217. Follow up from #1982 and #2018.

A subsequent commit will fix the ci failure.

Commit 2: Address all comment-related linter errors.

This change addresses all comment-related linter errors by doing the
following:
- Add comments to exported symbols
- Make some exported symbols private
- Recommend via TODOs that some exported symbols should should move or
  be removed

This PR does not:
- Modify, move, or remove any code
- Modify existing comments

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-01-02 14:03:59 -08:00
Radu M 07cbfe2725 Fix most golint issues that are not comment related (#1982)
Signed-off-by: Radu Matei <radu@radu-matei.com>
2018-12-20 10:37:47 -08:00
Kevin Lingerfelt 86e95b7ad3
Disable serivce profiles in single-namespace mode (#1980)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-12-13 14:37:18 -08:00
Alejandro Pedraza 8c67bfbcc6 Add parameter to stats API to skip retrieving Prometheus stats (#1871)
* Add parameter to stats API to skip retrieving Prometheus stats

Used by the dashboard to populate list of resources.

Fixes #1022

Signed-off-by: Alejandro Pedraza <alejandro.pedraza@gmail.com>

* Prometheus queries check results were being ignored
* Refactor verifyPromQueries() to also test when no prometheus queries
should be generated

* Add test for SkipStats=true

Includes adding ability to public.GenStatSummaryResponse to not generate
basicStats

* Fix previous test
2018-12-10 16:48:12 -08:00
Alex Leong 380ec52a39
Rework routes command to accept any resource (#1921)
We rework the routes command so that it can accept any Kubernetes resource, making it act much more similarly to the stat command.

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-12-05 11:11:34 -08:00
Risha Mars e8a39cd17e
Add ability to download a service profile template from the web UI (#1893)
Adds an endpoint, at /profiles/new that allows you to input a service name and
namespace, and download a service profile yaml template. 

This will enable future work, where we can add more of the yaml customization via 
a form in the dashboard, and use that data to help the user configure routes.
2018-12-03 16:48:43 -08:00
Risha Mars d9539bcb37
Add the top routes feature to the dashboard UI (#1868)
Adds a (currently not displayed in sidebar, but available at /routes) page to
mirror the current functionality of `linkerd routes <service>`. So far, this is just a
barebones form and table, but it works.

Adds a /api/routes path and handler to the api to receive TopRoutes requests from the web.
2018-11-27 16:53:10 -08:00
Risha Mars f8583df4db
Add ListServices to controller public api (#1876)
Add a barebones ListServices endpoint, in support of autocomplete for services.
As we develop service profiles, this endpoint could probably be used to describe
more aspects of services (like, if there were some way to check whether a
service profile was enabled or not).

Accessible from the web UI via http://localhost:8084/api/services
2018-11-27 11:34:47 -08:00
Alex Leong 7a7f6b6ecb
Add TopRoutes method the the public api and route CLI command to consume it (#1860)
Add a routes command which displays per-route stats for services that have service profiles defined.

This change has three parts:
* A new public-api RPC called `TopRoutes` which serves per-route stat data about a service
* An implementation of TopRoutes in the public-api service.  This implementation reads per-route data from Prometheus.  This is very similar to how the StatSummaries RPC and much of the code was able to be refactored and shared.
* A new CLI command called `routes` which displays the per-route data in a tabular or json format.  This is very similar to the `stat` command and much of the code was able to be refactored and shared.

Note that as of the currently targeted proxy version, only outbound route stats are supported so the `--from` flag must be included in order to see data.  This restriction will be lifted in an upcoming change once we add support for inbound route stats as well.

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-11-19 12:20:30 -08:00
Kevin Lingerfelt 3811c3f7f7
Fix web rendering when errors are encountered (#1710)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-09-25 10:22:55 -07:00
Dennis Adjei-Baah d23103111c
Move grpc tapClient initialization to goroutine (#1686)
When a resource has no tap events being streamed to the Tap UI, and a user hits the "Stop" button in the Tap page, the tap stream is left open due to the WebSocket connection not being closed.

It looks like the web server's tap client that is created to stream events from the tap server blocks the main request thread in the web server. This causes the web server to stop receiving any subsequent close frames from the UI i.e. when the "Stop" button is clicked.

This PR moves the tapClient initialization code to a separate goroutine, specifically, the goroutine that reads tap events from the incoming grpc tap stream. This allows the main thread to continue reading messages from the WebSocket connection and allow it to receive close frames.

fixes #1665

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-09-19 13:06:57 -07:00
Risha Mars 761d8453a8
Add a new namespace overview page with expandable sections (#1605)
Adds a new page that shows all namespaces in an accordion. This will replace
ServiceMesh as the default landing page.

The page will request stats for all namespaces, and then pick the first meshed
namespace that's not the linkerd namespace to auto-expand in the accordion.

This branch also updates the definition of "added to the mesh" in the frontend
to be runningPodCount > 0 && meshedPodCount > 0 (previously, it was
runningPodCount === meshedPodCount, which would count resources with no pods as
"added").

I've also moved the link to /namespaces out of the top-level sidebar and into
the Resources sub-menu.
2018-09-07 13:30:52 -07:00