Commit Graph

1365 Commits

Author SHA1 Message Date
Andrew Seigner 7fa7e962cb
Fix hint URLs not display for RPC checks (#2361)
Hint URLs should display for all failed checks in `linkerd check`, but
were not displaying for RPC checks.

Fix `runCheckRPC` to pass along the hintAnchor to the check result.

Also rename the second `can query the control plane API` to
`control plane self-check`, as there were two checks with that name.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-23 13:35:32 -08:00
Andrew Seigner b9b8eb4510
Enable more linters (#2362)
Enables the following linters:
- `deadcode` finds unused code.
- `depguard` checks if package imports are in a list of acceptable
  packages.
- `misspell` finds commonly misspelled English words in comments.
- `nakedret` finds naked returns in functions greater than a specified
  function length.
- `varcheck` finds unused global variables and constants.

Our repo was already passing these linters so no fixes needed.

Also explicitly list all linters enabled by default, for reference.

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-23 13:34:36 -08:00
Andrew Seigner cc3ff70f29
Enable `unused` linter (#2357)
`unused` checks Go code for unused constants, variables, functions, and
types.

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-23 11:05: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
Andrew Seigner 43d29d629e
Bump base Docker images (#2241)
- `debian:jessie-slim` -> `stretch-20190204-slim`
- `golang:1.10.3` -> `1.11.5`
- `gcr.io/linkerd-io/base:2017-10-30.01` -> `2019-02-19.01`
- bump `golangci-lint` to 1.15.0
- use `GOCACHE` in travis

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-22 15:59:18 -08:00
Ivan Sim 1e2e2bf53c
Install the Linkerd global and proxy config maps (#2344)
Also, some protobuf updates:

* Rename `api_port` to match recent changes in CLI code.
* Remove the `cni` message because it won't be used.
* Remove `registry` field from proto types. This helps to avoid having to workaround edge cases like fully-qualified image name in different format, and overriding user-specified Linkerd version etc.

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-22 15:28:21 -08:00
Oliver Gould 2640943c67
pkg/tls: Make it possible to load a CA from disk (#2335)
In preparation for creating an Identity service that can chain off of an
existing CA, it's necessary to both (1) be able to create an
intermediate CA that can be used by the identity service and (2) be able
to load a CA from existing key material.

This changes the public API of the `tls` package to deal in actual key
types (rather than opaque blobs) and provides a set of helpers that can
be used to convert these credentials between common formats.
2019-02-22 15:13:50 -08:00
Carol A. Scott 9861adea5d
Removing 'Help' hierarchy and surfacing links on navigation sidebar (#2346)
Fixes #2326.

Removes the 'Help' sub-menu from the navigation sidebar, surfacing the mailing list, Slack and GitHub links.
2019-02-21 17:50:26 -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
Andrew Seigner 31f5181492
Make test-cleanup delete clusterrole[binding]s (#2343)
The `bin/test-cleanup` script was correctly deleting all namespaces
created by `bin/test-run`, but was leaving behind clusterroles and
clusterrolebindings, defined cluster-wide.

Update `test-cleanup` to delete clusterroles and clusterrolebindings
created by `test-run`.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-21 11:01:15 -08:00
Ivan Sim c86b2b8148
Update proxy injector webhook to pick up deployment UPDATE events (#2332)
Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-21 08:25:02 -08:00
Andrew Seigner 6a1ca2cc95
Fix build-cli-bin to use generated templates (#2341)
The `bin/build-cli-bin` script, intended to build a local `linkerd` cli
binary, was compiling the binary configured to read template files out
of the local machine's GOPATH.

This change modifies `build-cli-bin` to build a `linkerd` binary the
same way `docker-build-cli-bin` does. Specifically, by generating static
template files for inclusion in the build, and adding the `-tags prod`
flag to ensure those files are compiled in.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-20 19:02:52 -08:00
Kevin Lingerfelt 1fc25e1f70
Add release notes for stable-2.2.1 release (#2340)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-20 18:11:28 -08:00
Alejandro Pedraza 249b5aed62
Update CHANGES.md for the edge-19.2.4 release (#2336)
* Update CHANGES.md for the edge-19.2.4 release

Signed-off-by: Alejandro Pedraza <alejandro.pedraza@gmail.com>
2019-02-20 19:09:44 -05:00
TwiN 5dcb9086f5 Implement resource limit (#2307)
Add options in CLI for setting proxy CPU and memory limits

- Deprecated `proxy-cpu` and `proxy-memory` in favor of `proxy-cpu-limit` and `proxy-memory-limit`
- Updated validations and tests to reflect new options

Signed-off-by: TwinProduction <twin@twinnation.org>
2019-02-20 15:07:10 -05:00
Nguyen Quang Huy 2fbe644ab2 Fix colliding with builtin function. (#2333)
Fix colliding with builtin function for controller_test.go

Signed-off-by: Nguyen Quang Huy <huynq0911@gmail.com>
2019-02-20 08:28:30 -08:00
Andrew Seigner 8384f1eb56
Ensure shared tooltips in Linkerd Health dashboard (#2324)
All Grafana graphs use shared tooltips (display all series in the
tooltip rather than the one currently moused-over), except for 3 graphs
in the Linkerd Health dashboard.

This change ensures all tooltips are shared.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-19 15:55:36 -08:00
Andrew Seigner 0b55936f85
Fix egress integration test to accomodate httpbin (#2330)
The httpbin responses recently started returning `url` fields starting
with `https`, regardless of the protocol used in the request.

This change modifies the egress integration test to always expect
`https` in the `url` response field.

This is a workaround until #2316 is implemented.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-19 14:42:39 -08:00
Risha Mars ee18a7fe31
Modify the grafana variable queries to use a tcp-based metric (#2272)
Currently, we use request_total for the variable query to determine the names in
the grafana dropdowns. We should use a non-http-based metric instead, so that if
there is only TCP traffic, the dropdowns will still be populated.

This branch uses process_start_time_seconds instead of the http-based
request_total to query for grafana variables
2019-02-19 13:46:02 -08:00
Oliver Gould fc82e2caf5
test: Support the -update and -pretty-diff flags (#2315)
When changing templates, it's can be pretty time-intensive to
repair all test fixtures.

This change instruments CLI tests with two flags, `-update` and
`-pretty-diff` that control how test fixtures are diffed. When the
`-update` flag is set, the tests fixtures are overwritten as tests
execute. The `-pretty-diff` flag causes the full text of the fixture
to be printed on mismatch.
2019-02-19 13:06:12 -08:00
Ivan Sim 9084615710
CLI install/inject config protobuf (#2291)
Define the global and proxy configs protobuf types that will be used by CLI install, inject and the proxy-injector.

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-19 12:28:30 -08:00
Tarun Pothulapati 42b3595f57 Ignoring resources with empty kind field. (#2292)
Update CLI inject/uninject commands to report warnings when resource `kind` is missing.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2019-02-19 11:44:28 -08:00
Kevin Lingerfelt 98c2686c95
CLI help updates: unhide install-cni (#2321)
* Un-hide linkerd-cni command and flags
* Tweak install-cni and install-sp descriptions

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-18 18:13:26 -08:00
Kevin Lingerfelt b1a6b6ca66
Fix handling of kubeconfig server urls that include paths (#2305)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-18 17:57:27 -08:00
Kevin Lingerfelt 5384ca8c97
Add discovery package for managing discovery API (#2317)
* Add discovery package for managing discovery API
* Fix typo in destination server comment

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-18 16:38:04 -08:00
Kevin Lingerfelt 25e46a3e74
CLI help updates: non-experimental auto-inject; unhide install-cni (#2319)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-18 15:32:46 -08:00
Oliver Gould 4ed84f0c0a
Split install template into component-specific files (#2313)
chart/templates/base.yaml is nearly 800 lines and contains the
kubernetes configurations for the marjority of the control plane.
Furthermore, its contents are not particularly organized (for example,
the prometheus RBAC bindings are in the middle of the controller's
configuration).

The size and complexity of this file makes it especially daunting to
introduce new functionality.

In order to make the situation easier to understand and change, this
splits base.yaml into several new template files: namespace, controller,
serviceprofile, and prometheus, and grafana. The `tls.yaml` template has
been renamed `ca.yaml`, since it installs the `linkerd-ca` resources.

This change also makes the comments uniform, adding a "header" to each
logical component.

Fixes #2154
2019-02-18 15:31:17 -08:00
Thomas Rampelberg 12527169b8
Update profile to match other CLI doc outputs (#2318)
* Update profile to match other CLI doc outputs

* Fix typo
2019-02-18 13:47:41 -08:00
Oliver Gould 5374ec0629
gitignore: Fix invalid glob (#2314)
66070c26 introduced an invalid glob, causing tools like rg(1) to emit
warnings like:

    ./.gitignore: line 17: error parsing glob '**.gogen*': invalid use of **; must be one path component
2019-02-18 10:31:10 -08:00
Andrew Seigner 1df1683b6a
Instrument k8s clients (#2243)
The control-plane's clients, specifically the Kubernetes clients, did
not provide telemetry information.

Introduce a `prometheus.ClientWithTelemetry` wrapper to instrument
arbitrary clients. Apply this wrapper to Kubernetes clients.

Fixes #2183

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-18 09:10:02 -08:00
Carol A. Scott 57315b83b3
Fix broken link in Linkerd2 BUILD.md (#2303)
Fixes a broken link to the CLI documentation in the "Generating CLI Docs" section of the Linkerd2 Development Guide.
2019-02-15 16:46:51 -08:00
Oliver Gould 71ce786dd3
Rename linkerd-proxy-api to linkerd-destination (#2281)
Up until now, the proxy-api controller service has been the sole service
that the proxy communicates with, implementing the majoriry of the API
defined in the `linkerd2-proxy-api` repo. But this is about to change:
linkerd/linkerd2-proxy-api#25 introduces a new Identity service; and
this service must be served outside of the existing proxy-api service
in the linkerd-controller deployment (so that it may run under a
distinct service account).

With this change, the "proxy-api" name becomes less descriptive. It's no
longer "the service that serves the API for the proxy," it's "the
service that serves the Destination API to the proxy." Therefore, it
seems best to bite the bullet and rename this to be the "destination"
service (i.e. because it only serves the
`io.linkerd.proxy.destination.Destination` service).

Co-authored-by: Kevin Lingerfelt <kl@buoyant.io>
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-15 15:11:04 -08:00
Thomas Rampelberg f9d353ea22
Generate CLI docs for usage by the website (#2296)
* Generate CLI docs for usage by the website

* Update description to match existing commands

* Remove global
2019-02-15 13:28:31 -08:00
Tarun Pothulapati df0357505c Added ep Alias for endpoints command (#2293)
Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2019-02-14 17:36:55 -08:00
Kevin Leimkuhler b2bbeb05ef
Issue 2276: Do not log error when timeout is blank (#2279)
# Problem

When a route does not specify a timeout, the proxy-api defaults to the default
timeout and logs an error:

```
time="2019-02-13T16:29:12Z" level=error msg="failed to parse duration for route POST /io.linkerd.proxy.destination.Destination/GetProfile: time: invalid duration"
```

# Solution

We now check if a route timeout is blank. If it is not set, it is set to
`DefaultRouteTimeout`. If it is set, we try to parse it into a `Duration`.

A request was made to improve logging to include the service profile and
namespace as well.

# Validation

With valid service profiles installed, edit the `.yaml` to include an invalid
`timeout`:

```
...
name: GET /
timeout: foo
```

We should now see the following errors:

```
proxy-api time="2019-02-13T22:27:32Z" level=error msg="failed to parse duration for route 'GET /' in service profile 'webapp.default.svc.cluster.local' in namespace 'default': time: invalid duration foo"
```

This error does not show up when `timeout` is blank.

Fixes #2276

Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
2019-02-14 17:09:02 -08:00
Andrew Seigner 044e0a5bb4 Fix golangci-lint config to use default golint (#2284)
golangci-lint disables some checks for golint, including checks for
well-formed comments on all exported symbols

This change disables the golangci-lint's `exclude-use-default` setting,
to run golint with default settings.

Also introduce a `.golangci.yml` file to centralize config.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-14 13:55:30 -08:00
Ivan Sim f383c9e1f2
Remove auto proxy inject 'Mutate' function tests (#2257)
The way these tests compare the hard-coded base64-encoded JSON
patches with those generated by the proxy injector, is extremely
brittle. Changing any of the proxy configuration causes these tests
to break, even though the proxy injector itself isn't affected.

Also, the AdmissionRequest and AdmissionResponse types are "boundary
objects" that are largely irrelevant to our code.

Fixes #2201 

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-14 11:55:19 -08:00
Alejandro Pedraza c78f105350
Upgrade Spinner to fix race condition (#2265)
Fixes #2264

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-02-14 09:51:25 -05:00
Alejandro Pedraza 0c4039a671
Add integration tests for single-namespace mode (#2247)
Add integration tests for single-namespace mode

Fixes #2127

Signed-off-by: Alejandro Pedraza <alejandro.pedraza@gmail.com>
2019-02-14 09:19:11 -05:00
Alejandro Pedraza 0c50749990
Add validator for proxy log-level (#2256)
Add validator for proxy log-level

Follow-up to #2249

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-02-13 15:33:22 -05:00
William Morgan a0ae089e89 remove Brian from maintainers (#2244)
Signed-off-by: William Morgan <william@buoyant.io>
2019-02-13 11:48:26 -08:00
Andrew Seigner f84469b25e
Fix Dockerfile-proxy to error out if fetch fails (#2252)
`Dockerfile-proxy` executes several commands following
`bin/fetch-proxy`, but the subsequent commands were separated by
semicolon, so the overall RUN command would succeed regardless of what
`bin/fetch-proxy` returned. This meant that if `bin/docker-build-proxy`
was run on a proxy SHA prior to it being available, it would fail the
build, but cache the unsuccessful `fetch-proxy` command, and continue to
fail after the proxy becomes available.

This change concatenates `fetch-proxy` and subsequent commands using
ampersands, failing the build if `fetch-proxy` fails.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-13 11:27:40 -08:00
Andrew Seigner a9b9908908
Bump Prometheus to v2.7.1, Grafana to 5.4.3 (#2242)
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-13 11:27:15 -08:00
Andrew Seigner e81be7fd12
Add Go code coverage to ci and docs (#2240)
Add a `-cover` param to the Go tests in ci, along with instructions in
`TEST.md` for manually evaluating test coverage.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-13 11:26:25 -08:00
Andrew Seigner 2305974202
Introduce golangci-lint tooling, fixes (#2239)
`golangci-lint` performs numerous checks on Go code, including golint,
ineffassign, govet, and gofmt.

This change modifies `bin/lint` to use `golangci-lint`, and replaces
usage of golint and govet.

Also perform a one-time gofmt cleanup:
- `gofmt -s -w controller/`
- `gofmt -s -w pkg/`

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-13 11:16:28 -08:00
Kevin Lingerfelt 1cde1f083c
Update CHANGES.md for the stable-2.2.0 release (#2263)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-12 13:14:43 -08:00
Kevin Lingerfelt 121cd59656
Update CHANGES.md for edge-19.2.3 release (#2268)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-12 11:29:03 -08:00
Kevin Lingerfelt 56c5ce6a31
Update auto-inject to set LINKERD2_PROXY_ID in all cases (#2267)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-12 11:08:06 -08:00
Carol A. Scott 0e25c680ca
Kubernetes health check no longer triggers warning in web UI Top view (#2261)
Fixes #2255.

When Kubernetes periodically pinged booksapp to perform a health check, the 
lack of namespace violated the `TapLink` component's propTypes requirement.
This triggered a warning in the browser console when on the web UI Top view.
Working with @rmars, I removed the namespace requirement from propTypes and
moved the check for an empty namespace to the top of the component to avoid an
unnecessary queryString construction.
2019-02-12 10:41:29 -08:00
Andrew Seigner db747eec8a
Retroactively update edge-19.2.1 release notes (#2259)
edge-19.2.1 included a breaking change related to the namespace where
`ServiceProfile`s are defined.

This change updates the release notes for that release to indicate the
breaking change.

Relates to linkerd/website#156

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-11 16:39:07 -08:00