Commit Graph

431 Commits

Author SHA1 Message Date
Oliver Gould cb276032f5
Require go 1.12.9 for controller builds (#3297)
Netflix recently announced a security advisory that identified several
Denial of Service attack vectors that can affect server implementations
of the HTTP/2 protocol, and has issued eight CVEs. [1]

Go is affected by two of the vulnerabilities (CVE-2019-9512 and
CVE-2019-9514) and so Linkerd components that serve HTTP/2 traffic are
also affected. [2]

These vulnerabilities allow untrusted clients to allocate an unlimited
amount of memory, until the server crashes. The Kubernetes Product
Security Committee has assigned this set of vulnerabilities with a CVSS
score of 7.5. [3]

[1] https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-002.md
[2] https://golang.org/doc/devel/release.html#go1.12
[3] https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
2019-08-21 10:03:29 -07:00
Ivan Sim 183e42e4cd
Merge the CLI 'installValues' type with Helm 'Values' type (#3291)
* Rename template-values.go
* Define new constructor of charts.Values type
* Move all Helm values related code to the pkg/charts package
* Bump dependency
* Use '/' in filepath to remain compatible with VFS requirement
* Add unit test to verify Helm YAML output
* Alejandro's feedback
* Add unit test for Helm YAML validation (HA)

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-08-20 19:26:38 -07:00
cpretzer 4e92064f3b
Add a flag to install-cni command to configure iptables wait flag (#3066)
Signed-off-by: Charles Pretzer <charles@buoyant.io>
2019-08-15 12:58:18 -07:00
Alex Leong 98b6b9e9ba
Check in gen deps (#3245)
Go dependencies which are only used by generated code had not previously been checked into the repo.  Because `go generate` does not respect the `-mod=readonly` flag, running `bin/linkerd` will add these dependencies and dirty the local repo.  This can interfere with the way version tags are generated.

To avoid this, we simply check these deps in.

Note that running `go mod tidy` will remove these again.  Thus, it is not recommended to run `go mod tidy`. 

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-08-13 17:02:52 -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
Andrew Seigner 18b74aa8a8
Introduce Go modules support (#2481)
The repo relied on `dep` for managing Go dependencies. Go 1.11 shipped
with Go modules support. Go 1.13 will be released in August 2019 with
module support enabled by default, deprecating GOPATH.

This change replaces `dep` with Go modules for dependency management.
All scripts, including Docker builds and ci, should work without any dev
environment changes.

To execute `go` commands directly during development, do one of the
following:
1. clone this repo outside of `GOPATH`; or
2. run `export GO111MODULE=on`

Summary of changes:
- Docker build scripts and ci set `-mod=readonly`, to ensure
  dependencies defined in `go.mod` are exactly what is used for the
  builds.
- Dependency updates to `go.mod` are accomplished by running
 `go build` and `go test` directly.
- `bin/go-run`, `bin/build-cli-bin`, and `bin/test-run` set
  `GO111MODULE=on`, permitting usage inside and outside of GOPATH.
- `gcr.io/linkerd-io/go-deps` tags hashed from `go.mod`.
- `bin/update-codegen.sh` still requires running from GOPATH,
  instructions added to BUILD.md.

Fixes #1488

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-07-25 14:41:38 -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
dependabot[bot] 811d173174 Bump lodash from 4.17.11 to 4.17.13 in /web/app (#3086)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13 due to
security issue.

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-15 10:51:04 -07:00
dependabot[bot] 928d222a9c Bump lodash.merge from 4.6.1 to 4.6.2 in /web/app (#3073)
Bumps lodash.merge from 4.6.1 to 4.6.2 to fix security vulnerability.

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-12 11:08:12 -07:00
Alex Leong 92ddffa3c2
Add prometheus metrics for watchers (#3022)
To give better visibility into the inner workings of the kubernetes watchers in the destination service, we add some prometheus metrics.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-07-08 11:50:26 -07:00
Carol A. Scott a504e8c2d8
Expand and improve edges API endpoint (#3007)
Updates functionality of `linkerd edges`, including a new `--all-namespaces`
flag and returning namespace information for SRC and DST resources.
2019-06-28 15:46:04 -07:00
Alex Leong 27373a8b78
Add traffic splitting to destination profiles (#2931)
This change implements the DstOverrides feature of the destination profile API (aka traffic splitting).

We add a TrafficSplitWatcher to the destination service which watches for TrafficSplit resources and notifies subscribers about TrafficSplits for services that they are subscribed to.  A new TrafficSplitAdaptor then merges the TrafficSplit logic into the DstOverrides field of the destination profile.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-06-28 13:19:47 -07:00
Carol A. Scott 210ab81fed
Improve UI for Edges table in dashboard (#2995)
This PR improves the UI for the Edges table in the dashboard, including changing column names, adding a "Secured" icon and showing an empty Edges table in the case of no returned edges.
2019-06-26 16:57:18 -07:00
dependabot[bot] 2ca8fbcb8c Bump eslint from 4.12.1 to 4.18.2 in /web/app (#2978)
Bumps [eslint](https://github.com/eslint/eslint) from 4.12.1 to 4.18.2.

Signed-off-by: dependabot[bot] <support@github.com>
2019-06-25 10:55:53 -07:00
Carol A. Scott 2fe056f2bc
Adding context to log warning (#2977)
Adding context to UUID log warning when running web server in development mode.
Fixes #2974
2019-06-21 11:45:45 -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 1ec9058f85
Importing specific font-awesome icons instead of the full CSS stylesheet and webfonts (#2917)
This PR allows components to import specific FontAwesome icons using the
@fortawesome/react-fontawesome library. This cuts down on package size and the
number of files loaded.
2019-06-17 11:41:44 -07:00
Risha Mars a46e69ce6e
Fix BaseTable ignoring sorting order (#2923)
I noticed that the tables weren't maintaining sort order.
This branch fixes sorting by using lodash orderBy.

Before: Look at the tables, for example in the Service Mesh page, the meshed
resource table, or in Top Routes. Note that both these tables have a default
sort order, but do not appear sorted.

After: These tables should be sorted by their default order.
2019-06-12 13:35:41 -07:00
Alex Leong c698d6bca1
Add support for TrafficSplits (#2897)
Add support for querying TrafficSplit resources through the common API layer. This is done by depending on the TrafficSplit client bindings from smi-sdk-go.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-06-11 10:04:42 -07:00
Carol A. Scott 47718c508a
Upgrade packages and fix package security vulnerability (#2903)
Updates and pins package version numbers in `package.json` to reflect the actual
versions in `yarn.lock`. Pins `react-iframe` to `1.7.16` and `jest` to `23.6.0`
- in both cases, there are later versions but they include breaking changes.
Modifies `webpack.config.js` to work with the updated `css-loader` library.
Fixes #2908.
2019-06-10 16:45:51 -07:00
Alex Leong 06a69f69c5
Refactor destination service (#2786)
This is a major refactor of the destination service.  The goals of this refactor are to simplify the code for improved maintainability.  In particular:

* Remove the "resolver" interfaces.  These were a holdover from when our decision tree was more complex about how to handle different kinds of authorities.  The current implementation only accepts fully qualified kubernetes service names and thus this was an unnecessary level of indirection.
* Moved the endpoints and profile watchers into their own package for a more clear separation of concerns.  These watchers deal only in Kubernetes primitives and are agnostic to how they are used.  This allows a cleaner layering when we use them from our gRPC service.
* Renamed the "listener" types to "translator" to make it more clear that the function of these structs is to translate kubernetes updates from the watcher to gRPC messages.

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-06-04 15:01:16 -07:00
Alejandro Pedraza 74ca92ea25
Split proxy-init into separate repo (#2824)
Split proxy-init into separate repo

Fixes #2563

The new repo is https://github.com/linkerd/linkerd2-proxy-init, and I
tagged the latest there `v1.0.0`.

Here, I've removed the `/proxy-init` dir and pinned the injected
proxy-init version to `v1.0.0` in the injector code and tests.

`/cni-plugin` depends on proxy-init, so I updated the import paths
there, and could verify CNI is still working (there is some flakiness
but unrelated to this PR).

For consistency, I added a `--init-image-version` flag to `linkerd
inject` along with its corresponding override config annotation.

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-06-03 16:24:05 -05:00
cpretzer 8bb67b4820
2817 enable shorthands for lodash (#2818)
* * Update webpack-dev-server to "^3.2.0" in package.json with generated yarn.lock file

* * Update webpack-dev-server to "^3.2.0" in package.json with generated yarn.lock file

Signed-off-by: cpretzer <charles@buoyant.io>

* * #2817 enable shorthands for lodash

Signed-off-by: cpretzer <charles@buoyant.io>

* * #2817 enable shorthands for lodash

Signed-off-by: cpretzer <charles@buoyant.io>

* Pin webpack-dev-server to version 3.3.1

Signed-off-by: Charles Pretzer <charles@buoyant.io>

* Subject:
Remove unnecessary linting configs and rules for lodash

Problem:
Work related to supporting newer versions of node allows for the removal of lodash linting

Solution:
Remove lodash lint rules
Remove eslint-plugin-lodash from package.json
Remove lodash from plugins section of .eslintrc

Validation:
Ran all build commands (setup, dev, and run) with node versions 12 and 10

Fixes #2817 #2809

Signed-off-by: Charles Pretzer <charles@buoyant.io>

* Signed-off-by: Charles Pretzer <charles@buoyant.io>

Update yarn.lock after merge with master
2019-05-30 17:30:58 +02:00
Carol A. Scott 13f2698033
Hide Authorities table and Authorities sidebar link on dashboard (#2856)
Fixes #2103. Hides the Authorities table in the Overview and Namespace views on
the dashboard, and removes the link to Authorities in the Resources sidebar.
This change makes way for a future dashboard view incorporating traffic split
data and communicating Authority data in a more understandable way.
2019-05-29 15:38:48 -07:00
dependabot[bot] 36be71fd9e Bump webpack-bundle-analyzer from 3.0.3 to 3.3.2 in /web/app (#2857)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 3.0.3 to 3.3.2. This PR was generated by GitHub's Dependabot: https://github.com/apps/dependabot
2019-05-28 15:23:26 -07:00
Dennis Adjei-Baah a0fa1dff59
Move tap service into its own pod. (#2773)
* Split tap into its own pod in the control plane

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2019-05-15 16:28:44 -05:00
Andrew Seigner 0cfc8c6f1c
Introduce k8s apiextensions support (#2759)
CustomResourceDefinition parsing and retrieval is not available via
client-go's `kubernetes.Interface`, but rather via a separate
`k8s.io/apiextensions-apiserver` package.

Introduce support for CustomResourceDefintion object parsing and
retrieval. This change facilitates retrieval of CRDs from the k8s API
server, and also provides CRD resources as mock objects.

Also introduce a `NewFakeAPI` constructor, deprecating
`NewFakeClientSets`. Callers need no longer be concerned with discreet
clientsets (for k8s resources vs. CRDs vs. (eventually)
ServiceProfiles), and can instead use the unified `KubernetesAPI`.

Part of #2337, in service to multi-stage check.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-04-28 18:55:22 -07:00
Gaurav Kumar aaeb8a7df3 Add Font Awesome stylesheet locally (#2620)
Makes the Font Awesome CSS stylesheet available offline. Users loading the dashboard with no/limited internet will see both the Font Awesome and Material-UI sidebar icons consistently. Before, only the Material-UI icons were available offline.

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-04-24 17:23:47 -07:00
Andrew Seigner 72287ae121
Don't use spinner in cli when run without a tty (#2716)
In some non-tty environments, the `linkerd check` spinner can render
unexpected control characters.

Disable the spinner when run without a tty.

Fixes #2700

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-04-18 09:31:56 -07:00
Carol A. Scott b98ce335db
Making "overview" view of dashboard functional on mobile devices (#2678)
Makes the "overview" view of the Linkerd dashboard functional on mobile devices, with responsive tables and a minimized sidebar. 
Also lines up the sidebar icons and makes them a uniform size on both desktop and mobile views.
This is a first step towards a fully-responsive dashboard.
2019-04-11 12:00:21 -07:00
Alex Leong 98a74bccc3
Rename proxy-api to destination on debug page (#2652)
Signed-off-by: Alex Leong <alex@buoyant.io>
2019-04-10 15:06:57 -07:00
Kevin Lingerfelt e395803ce2
Allow web server to load without install config (#2668)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-04-08 13:24:44 -07:00
Carol A. Scott d4e955f805
Updating webdriverio libraries (#2665)
Updates the WebdriverIO libraries used in the front-end integration tests so that officially-supported libraries are used where possible.
2019-04-08 13:19:50 -07:00
Katerina 938d64a16f Web server updated to read the UUID from the linkerd-config ConfigMap. (#2603)
Signed-off-by: Kateryna Melnyk <kattymelnyk@gmail.com>
2019-04-08 12:56:00 -07:00
Oliver Gould ba65bd8039
Switch UUID implementation (#2667)
The UUID implementation we use to generate install IDs is technically
not random enough for secure uses, which ours is not. To prevent
security scanners like SNYK from flagging this false-positive, let's
just switch to the other UUID implementation (Already in our
dependencies).
2019-04-08 10:58:02 -07:00
Alejandro Pedraza edb225069c
Add validation webhook for service profiles (#2623)
Add validation webhook for service profiles

Fixes #2075

Todo in a follow-up PRs: remove the SP check from the CLI check.

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-04-05 16:10:47 -05:00
Risha Mars 4b3d21aa27
Fix check for empty metrics that always returned false (#2645)
Problem:
In #2532 I removed the Tap/Top tables if there was no http traffic, but the
check I used depended on a stats object being present in the processed metrics
(spoiler: it isn't present in the processed metrics). 

Solution:
Use a better check for no traffic. 
The new check checks for both no requests (so nil request rate) and
also no latency (in the case that the service is http but receiving no traffic).

Fixes #2641
2019-04-05 12:15:43 -07:00
Carol A. Scott 05a899fc21
Fixing bin/web test (#2621)
Fixes bin/web test by restoring a preset to the Babel config file.
2019-04-02 17:02:15 -07:00
Carol A. Scott 982d629552
Removing TLS columns from tables in dashboard (#2611)
This PR closes #2608. It removes the TLS columns from the dashboard tables and updates the associated tests.
2019-04-02 16:54:39 -07:00
Carol A. Scott 0251f50fa4
Adding local and cloud integration testing for dashboard (#2586)
Adds local and cloud integration testing for the dashboard using WebdriverIO and
SauceLabs. Includes documentation on how to set up and run the Sauce Connect
proxy locally. Adds a `bin/web integration` script that takes `local` or `cloud`
arguments to run the tests. 

Note: for web development, the web server launched by `bin/web run` and `bin/web
dev` is now 7777, not 8084, because the Sauce Connect proxy can only tunnel to
certain ports.
2019-03-29 15:48:00 -07:00
Gaurav Kumar 23454d248d Add validation to the Service Profile form (#2490) (#2514)
Fixes #2490

The following PR adds validation to the New Service Profile popup form in the linkerd dashboard for the service and namespace user input.

* Add validation to the Service Profile form (#2490)

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Change RegExp to handle all cases

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Fix link and error msg issue

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Refactor code

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Revert to onBlur and remove warning on field clear

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Refactor code to make it more readable

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>

* Reset state to initialstate on form close

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-29 14:57:52 -07:00
Oliver Gould 655632191b
config: Store install parameters with global config (#2577)
When installing Linkerd, a user may override default settings, or may
explicitly configure defaults. Consider install options like `--ha
--controller-replicas=4` -- the `--ha` flag sets a new default value for
the controller-replicas, and then we override it.

When we later upgrade this cluster, how can we know how to configure the
cluster?

We could store EnableHA and ControllerReplicas configurations in the
config, but what if, in a later upgrade, the default value changes? How
can we know whether the user specified an override or just used the
default?

To solve this, we add an `Install` message into a new config.
This message includes (at least) the CLI flags used to invoke
install.

upgrade does not specify defaults for install/proxy-options fields and,
instead, uses the persisted install flags to populate default values,
before applying overrides from the upgrade invocation.

This change breaks the protobuf compatibility by altering the
`installation_uuid` field introduced in 9c442f6885.
Because this change was not yet released (even in an edge release), we
feel that it is safe to break.

Fixes https://github.com/linkerd/linkerd2/issues/2574
2019-03-29 10:04:20 -07:00
Risha Mars 408cffdc23
Better handle TCP only resources in the dashboard (#2532)
When a resource only has TCP traffic and no HTTP traffic, the dashboard looks
weird in a bunch of places.

This branch:
- updates the main resource card in the Octopus graph to show TCP stats if no HTTP
stats are available 
- cleans up the resource detail page to show fewer blank
tables if the resource only has TCP traffic.
2019-03-26 14:39:54 -07:00
Carol A. Scott 384acf2731
Replacing native sort with lodash stable sortBy in Web UI (#2501)
Replaces native JS `sort()` with lodash stable `_sortBy` for table rows so that rows are always sorted consistently.
2019-03-21 16:21:30 -07:00
Kevin Lingerfelt 0d4eb02835
Add identity pod to check, web, and integration tests (#2529)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-03-19 20:49:31 -07:00