Commit Graph

1503 Commits

Author SHA1 Message Date
Andrew Seigner 756a1312fd
Add more known log errors to integration tests (#2452)
linkerd/linkerd2#2414 introduced integration tests to ensure logs did
not contain unexpected errors. Additional errors are not being caught,
causing ci to fail.

This change adds more known log errors to the log regex.

Also temporarily enable integration tests in ci for this PR.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-06 10:16:48 -08:00
Andrew Seigner d850b02b66
Introduce logging and restart integration tests (#2414)
The integration tests deploy complete Linkerd environments into
Kubernetes, but do not check if the components are logging errors or
restarting.

Introduce integration tests to validation that all expected
control-plane containers (including `linkerd-proxy` and `linkerd-init`)
are found, logging no errors, and not restarting.

Fixes #2348

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-05 19:49:38 -08:00
Kevin Lingerfelt 0dcd69c465
Re-add pre-install permission checks (#2451)
* Re-add pre-install permission checks
* Fix ordering in check.go

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-03-05 19:17:21 -08:00
Andrew Seigner d90fa16727
Introduce NET_ADMIN cli check (#2421)
The `linkerd-init` container requires the NET_ADMIN capability to modify
iptables. The `linkerd check` command was not verifying this.

Introduce a `has NET_ADMIN capability` check, which does the following:
1) Lists all available PodSecurityPolicies, if none found, returns
success
2) For each PodSecurityPolicy, validate one exists that:
    - the user has `use` access AND
    - provides `*` or `NET_ADMIN` capability

A couple limitations to this approach:
- It is testing whether the user running `linkerd check` has NET_ADMIN,
  but during installation time it will be the `linkerd-init` pod that
  requires NET_ADMIN.
- It assumes the presense of PodSecurityPolicies in the cluster means
  the PodSecurityPolicy admission controller is installed. If the
  admission controller is not installed, but PSPs exists that restrict
  NET_ADMIN, `linkerd check` will incorrectly report the user does not
  have that capability.

This PR also fixes the `can create CustomResourceDefinitions` check to
not specify a namespace when doing a `create` check, as CRDs are
cluster-wide.

Fixes #1732

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-05 17:19:11 -08:00
Gaurav Kumar 3ea5c6d59a Refactor code to make sidebar in sync with the main view (#2134) (#2440)
* Refactor code to make sidebar in sync with the main view (#2134)

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

* Remove redundancy and cleanup code

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

* Remove extra space and add new line

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-05 16:43:18 -08:00
Ivan Sim 8f9473fbd7
Recreate the MWC when the proxy injector is restarted (#2431)
This ensures that the MWC always picks up the latest config template during version upgrade.
The removed `update()` method and RBAC permissions are superseded by @2163.

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-03-05 15:53:37 -08:00
Kevin Leimkuhler 4fba211b98
proxy: Bump pinned version to 6d10dd6 (#2448)
This picks up the following:
* [dc00685](https://github.com/linkerd/linkerd2-proxy/commit/dc00685) Increase
  inbound/outbound router capacity
* [6d10dd6](https://github.com/linkerd/linkerd2-proxy/commit/6d10dd6) Set
  `l5d-remote-ip` on inbound requests and outbound responses

Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
2019-03-05 15:09:59 -08:00
Andrew Seigner 206ff685e2
Bump Prometheus client to v0.9.2 (#2388)
We were depending on an untagged version of prometheus/client_golang
from Feb 2018.

This bumps our dependency to v0.9.2, from Dec 2018.

Also, this is a prerequisite to #1488.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-05 10:31:16 -08:00
Andrew Seigner 2f89a64abd
Remove GOPATH dependency from cli dev environment (#2444)
The `linkerd install` output relies on Helm templates in the `chart`
directory. In production cli builds, these templates are compiled into
the binary. In development, they are read from the file system. This
development code path relied on GOPATH to determine the location of the
`chart` directory. In anticipation of Go Modules support (#1488), we
cannot assume the repo is within the GOPATH.

This change removes the GOPATH dependency, and instead relies on
`runtime.Caller` to determine the root of the code repo. This change
only affects development (!prod) builds.

Prerequisite to #1488.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-05 10:25:14 -08:00
Alejandro Pedraza ddf2e729ac
Injection consolidation (#2334)
- Created the pkg/inject package to hold the new injection shared lib.
- Extracted from `/cli/cmd/inject.go` and `/cli/cmd/inject_util.go`
the core methods doing the workload parsing and injection, and moved them into
`/pkg/inject/inject.go`. The CLI files should now deal only with
strictly CLI concerns, and applying the json patch returned by the new
lib.
- Proceeded analogously with `/cli/cmd/uninject.go` and
`/pkg/inject/uninject.go`.
- The `InjectReport` struct and helping methods were moved into
`/pkg/inject/report.go`
- Refactored webhook to use the new injection lib
- Removed linkerd-proxy-injector-sidecar-config ConfigMap
- Added the ability to add pod labels and annotations without having to
specify the already existing ones

Fixes #1748, #2289

Signed-off-by: Alejandro Pedraza <alejandro.pedraza@gmail.com>
2019-03-05 08:38:56 -05:00
Ivan Sim 28fb725901
Revert "Mark HA as non-experimental (#2430)" (#2436)
This reverts commit ec51ccf317.

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-03-04 08:27:43 -08:00
Aditya Sharma ec51ccf317 Mark HA as non-experimental (#2430)
Closes #2419

Signed-off-by: Aditya Sharma <hello@adi.run>
2019-03-02 23:02:20 -08:00
Tarun Pothulapati 2184928813 Wire up stats for Jobs (#2416)
Support for Jobs in stat/tap/top cli commands

Part of #2007

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
2019-03-01 17:16:54 -08:00
Carol A. Scott 1ff04af024
Adding filter feature to web UI (#2297)
Fixes #1792.

This PR adds filter functionality to the web UI via an optional Material-UI <Toolbar> on the top of the table which contains the table's title and a filter icon. The toolbar only shows if the enableFilter={true} prop is passed down from the parent component. The PR modifies the MetricsTable test and adds tests for BaseTable and TopRoutesTable.

Note: The previous Ant-based UI allowed certain tables to be filtered by individual table column; this capacity is not part of this PR but can be added later if useful.
2019-03-01 13:47:42 -08:00
Yan 4cd1f99e89 Check kubectl version as part of checks (#2358)
Fixes #2354

Signed-off-by: Yan Babitski <yan.babitski@gmail.com>
2019-03-01 10:03:59 -08:00
Ivan Sim d805cb9a2b
Changelog for edge-19.2.5 release (#2412)
Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-27 16:06:33 -08:00
Andrew Seigner d08dcb0a37
Skip outbound port 443 in control-plane (#2411)
linkerd/linkerd2#2349 introduced a `SelfSubjectAccessReview` check at
startup, to determine whether each control-plane component should
establish Kubernetes watches cluster-wide or namespace-wide. If this
check occurs before the linkerd-proxy sidecar is ready, it fails, and
the control-plane component restarts.

This change configures each control-plane pod to skip outbound port 443
when injecting the proxy, allowing the control-plane to connect to
Kubernetes regardless of the `linkerd-proxy` state.

A longer-term fix should involve a more robust control-plane startup,
that is resilient to failed Kubernetes API requests. An even longer-term
fix could involve injecting `linkerd-proxy` as a Kubernetes "sidecar"
container, when that becomes available.

Workaround for #2407

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-27 15:23:19 -08:00
Kevin Lingerfelt 40076c4de2
Remove namespace from serviceprofile CRD in install config (#2409)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-02-27 14:29:47 -08:00
Eliza Weisman 9c0537c318 Signed-off-by: Eliza Weisman <eliza@buoyant.io> (#2410)
proxy: bump pinned version to 7e55196

This picks up the following commit:

* 7e55196 Bump tower-grpc (linkerd/linkerd2-proxy#202)

The new `tower-grpc` version (tower-rs/tower-grpc#115) improves the
messages attached to internal gRPC issues. This will aid significantly
in debugging the proxy's gRPC communication with the control plane.
2019-02-27 14:17:17 -08:00
Ivan Sim c5b905281c
Proxy: bump pinned version to 0fe8063 (#2406)
This picks up the following commits:

* 0fe8063 replace `Error::cause` with `Error::source` (#2370) (linkerd/linkerd2-proxy#201)
* 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188)
* d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197)
* c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195)
* 23e02a6 Update Router to wait for inner poll_ready before calling inner call
* 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24
* d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193)
* 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192)
* 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191)

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-02-27 12:55:01 -08:00
Oliver Gould ab90263461
destination: Only return TLS identities when appropriate (#2371)
As described in #2217, the controller returns TLS identities for results even
when the destination pod may not be able to participate in identity
requester: specifically, the other pod may not have the same controller
namespace or it may not be injected with identity.

This change introduces a new annotation, linkerd.io/identity-mode that is set
when injecting pods (via both CLI and webhook). This annotation is always
added.

The destination service now only returns TLS identities when this annotation
is set to optional on a pod and the destination pod uses the same controller.
These semantics are expected to change before the 2.3 release.

Fixes #2217
2019-02-27 12:18:39 -08:00
Andrew Seigner 9f748d2d2e
lint: Enable unparam (#2369)
unparam reports unused function parameters:
https://github.com/mvdan/unparam

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-27 10:34:02 -08:00
Andrew Seigner 10d9b7e493
Revert integration test check wait (#2400)
linkerd/linkerd2#2360 modified the `linkerd check --wait` param from `0`
to `1m`. Waiting on a check command causes spinner control characters in
the output, making output validation non-trivial.

Instead, revert the wait param back to `0`, and use
`TestHelper.RetryFor`.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-26 16:37:29 -08:00
Andrew Seigner 48e161f012
Revert CRD deletion in integration test-cleanup (#2399)
linkerd/linkerd#2349 introduced ServiceProfile CRD deletion to
`bin/test-cleanup`. Unfortunately that CRD is cluster-wide and shared
across any Linkerd's currently installed.

Revert CRD deletion.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-26 16:37:17 -08:00
Oliver Gould d03014aed6
Lessen klog for security (#2386)
We currently set klog to maximum verbosity when debug logging is
enabled. This causes control plane components, however, to log their
serviceaccount tokens, leaking secret information into logs.

By setting the klog level to 6, we avoid this logging.

Fixes #2383
2019-02-26 16:00:26 -08:00
Oliver Gould 2f91a9d1f2
Fix compilation with Go 1.12 (#2398)
One format string breaks when using go-1.12.
2019-02-26 15:36:04 -08:00
Oliver Gould c3f9ff8e32
Consolidate endpointListener.Update with logging (#2389)
Previously, the update-handling logic was spread across several very
small functions that were only called within this file. I've
consolidated this logic into endpointListener.Update so that all of the
debug logging can be instrumented in one place without having to iterate
over lists multiple times.

Also, I've fixed the formatting of IP addresses in some places.

Logs now look as follows:

    msg="Establishing watch on endpoint linkerd-prometheus.linkerd:9090" component=endpoints-watcher
    msg="Subscribing linkerd-prometheus.linkerd:9090 exists=true" component=service-port id=linkerd-prometheus.linkerd target-port=admin-http
    msg="Update: add=1; remove=0" component=endpoint-listener namespace=linkerd service=linkerd-prometheus
    msg="Update: add: addr=10.1.1.160; pod=linkerd-prometheus-7bbc899687-nd9zt; addr:<ip:<ipv4:167838112 > port:9090 > weight:1 metric_labels:<key:\"control_plane_ns\" value:\"linkerd\" > metric_labels:<key:\"deployment\" value:\"linkerd-prometheus\" > metric_labels:<key:\"pod\" value:\"linkerd-prometheus-7bbc899687-nd9zt\" > metric_labels:<key:\"pod_template_hash\" value:\"7bbc899687\" > protocol_hint:<h2:<> > " component=endpoint-listener namespace=linkerd service=linkerd-prometheus
2019-02-26 15:05:23 -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 6ef33e8955
Add note about brew dependency in `build-cli-bin` (#2381)
Homebrew/homebrew-core#36957 introduces a brew formula for the linkerd
cli. It depends on `bin/build-cli-bin` to build a local linkerd cli
binary.

This change adds a note to `bin/build-cli-bin`, to consider brew when
making changes to that script.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 16:08:32 -08:00
Andrew Seigner b77b577767
Align dashboard nav items (#2380)
The `Overview` and `Resources` nav items were slightly out of alignment
with the other nav items.

Add paddingRight to the other nav items, to compensate for their
shrunken icons.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 16:08:11 -08:00
Andrew Seigner ad0d0b72a0
lint: Enable unconvert (#2368)
unconvert removes unnecessary type conversions:
https://github.com/mdempsky/unconvert

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 16:07:42 -08:00
Andrew Seigner 25e462352d
lint: Enable goimports (#2366)
goimports checks import lines, adding missing ones and removing
unreferenced ones:
https://godoc.org/golang.org/x/tools/cmd/goimports

It also requires named imports for packages whose
import paths don't match their package names:
- https://github.com/golang/go/issues/28428
- https://go-review.googlesource.com/c/tools/+/145699/

Also standardized named imports of common Kubernetes packaages.

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 15:51:10 -08:00
Oliver Gould 9e67bcb1bc
inject: Refactor report-checking from inject logic (#2379)
The inject logic combines the modification of a pod spec and the
creation of a "report" detailing problems with the pod spec.

This change extracts the report-creation-and-checking logic from the
injection logic to make the contracts of each of these functions
clearer.

No functional changes are intended.
2019-02-25 14:18:22 -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
Andrew Seigner 35a0b652f2
lint: Enable goconst (#2365)
goconst finds repeated strings that could be replaced by a constant:
https://github.com/jgautheron/goconst

Part of #217

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-25 12:00:03 -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
Oliver Gould f7435800da
lint: Enable scopelint (#2364)
[scopelint][scopelint] detects a nasty reference-scoping issue in loops.

[scopelint]: https://github.com/kyoh86/scopelint
2019-02-24 08:59:51 -08:00
Andrew Seigner e300309af5
Increase integration test timeouts (#2360)
The integration tests occasionally timeout in ci when talking to
Kubernetes and Linkerd:
https://travis-ci.org/linkerd/linkerd2/jobs/497300669#L972
https://travis-ci.org/linkerd/linkerd2/jobs/497329339#L7284

Increase `linkerd check --wait` from `0` to `30s`.
Increase `HTTPGetURL` timeout from 30s to 1 minute.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-02-23 13:54:02 -08:00
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