Commit Graph

1403 Commits

Author SHA1 Message Date
Alejandro Pedraza 7efe385feb
Have the Webhook react to pod creation/update only (#2472)
Have the Webhook react to pod creation/update only

This was already working almost out-of-the-box, just had to:

- Change the webhook config so it watches pods instead of deployments
- Grant some extra ClusterRole permissions
- Add the piece that figures what's the OwnerReference and add the label
for it
- Manually inject service account mount paths
- Readd volumes tests

Fixes #2342 and #1751

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-03-26 11:53:56 -05:00
Oliver Gould 9c442f6885
Store install UUID in global config (#2561)
Currently, the install UUID is regenerated each time `install` is run.
When implementing cluster upgrades, it seems most appropriate to reuse
the prior UUID, rather than generate a new one.

To this end, this change stores an "Installation UUID" in the global
linkerd config.
2019-03-26 08:45:40 -07:00
Ivan Sim eafd7482f5
Use nested structure to organize workload and object data in ResourceConfig (#2530)
Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-03-22 20:53:29 -07:00
Carol A. Scott c1c1b3f0a3
Adding edge-19.3.3 updates (#2544)
This PR updates CHANGES.md with information about the newest edge release, 19.3.3.
2019-03-22 13:26:30 -07:00
Oliver Gould da0330743f
Provide peer Identities via the Destination API (#2537)
This change reintroduces identity hinting to the destination service.
The Get endpoint includes identities for pods that are injected with an
identity-mode of "default" and have the same linkerd control plane.

A `serviceaccount` label is now also added to destination response
metadata so that it's accessible in prometheus and tap.
2019-03-22 09:19:14 -07:00
Oliver Gould 34ea302a32
inject: Configure proxies to enable Identity (#2536)
This change adds a new `linkerd2-proxy-identity` binary to the `proxy`
container image as well as a `linkerd2-proxy-run` entrypoint script.

The inject process now sets environment variables on pods to support
identity, including identity names for the destination and identity
services.

As the proxy starts, the identity helper creates a key and CSR in a
tmpfs. As the proxy starts, it reads these files, as well as a
serviceaccount token, and provisions a certificate from controller.
The proxy's /ready endpoint will not succeed until a certificate has
been provisioned.

The proxy will not participate in identity with services other than the
controllers until the Destination controller is modified to provide
identities via discovery.
2019-03-21 18:39:05 -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
Alex Leong 63996e8b8a
Bump proxy version (#2539)
Picks up the following proxy change:

* Add a oneshot to notify the profiles daemon if the stream is dropped

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-03-21 15:17:52 -07:00
Oliver Gould 21796be354
install: Create linkerd-config before pods (#2538)
Because the linkerd-config resource is created after pods that require
it, they can be started before the files are mounted, causing the pods
to restart integration tests to fail.

If we extract the config into its own template file, it can be inserted
before pods are created.
2019-03-21 14:01:07 -07:00
Oliver Gould f02730a90d
Check the cluster's config for install & inject (#2535)
The introduction of identity in 0626fa37 created new state in the
control plane's configuration that must be considered when re-installing
the control plane or when injecting pods.

This change alters `install` to fail if it would seem to conflict with
an existing installation. This behavior may be disabled with the
`--ignore-cluster` flag.

Furthermore, `inject` now _requires_ that it can fetch a configuration
from the control plane in order to operate. Otherwise the
`--ignore-cluster` and `--disable-identity` flags must be specified.

This change does not actually instrument pods to use identity yet---it
lays the framework for proxy identity without changing the test fixture
output (besides a change to how identity HA is configured).

Fixes #2531
2019-03-21 12:49:46 -07:00
Thomas Rampelberg 4eb89bb8c2
Stop background processes on failure (#2478)
* Stop background processes on failure

* Exit successfully

* Move trap into dev only

* Move install linkerd up

* Fold dev into run
2019-03-20 10:25:36 -07:00
Oliver Gould 788d7c6dfa
cli: Consolidate the public API clients (#2527)
Currently, cli/cmd/root.go provides a couple of utilities for building
clients to Linkerd's Public API; however these utilities are infallible,
execute health checks, etc.

There are a class of API clients---for instance, when an inject command
wants to acquire configuration from the API---where these checks are
undesirable. The version CLI built such a client, for example.

This change consolidates the various utilities into a single file.
Furthermore, it renames these utilities to clarify they differ.
2019-03-19 20:52:39 -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
Oliver Gould 0626fa374a
install: Introduce the Identity controller (#2526)
https://github.com/linkerd/linkerd2/pull/2521 introduces an "Identity"
controller, but there is no way to include it in linkerd installation.

This change alters the `install` flow as follows:
- An Identity service is _always_ installed;
- Issuer credentials may be specified via the CLI;
- If no Issuer credentials are provided, they are generated each time `install` is called.
- Proxies are NOT configured to use the identity service.
- It's possible to override the credential generation logic---especially
  for tests---via install options that can be configured via the CLI.
2019-03-19 17:04:11 -07:00
Oliver Gould 91c5f07650
proxy: Upgrade to identity-capable proxy (#2524)
The new proxy has changed its configuration as follows:

- `LISTENER` urls are now `LISTEN_ADDR` addresses;
- `CONTROL_URL` is now `DESTINATION_SVC_ADDR`;
- `*_NAMESPACE` vars are no longer needed;
- The `PROXY_ID` is now the `DESTINATION_CONTEXT`;
- The "metrics" port is now the "admin" port, since it serves more than
  just metrics;
- A readiness probe now checks a dedicated /ready endpoint eagerly.

Identity injection is **NOT** configured by this branch.
2019-03-19 14:20:39 -07:00
Oliver Gould 790c13b3b2
Introduce the Identity controller implementation (#2521)
This change introduces a new Identity service implementation for the
`io.linkerd.proxy.identity.Identity` gRPC service.

The `pkg/identity` contains a core, abstract implementation of the service
(generic over both the CA and (Kubernetes) Validator interfaces).

`controller/identity` includes a concrete implementation that uses the
Kubernetes TokenReview API to validate serviceaccount tokens when
issuing certificates.

This change does **NOT** alter installation or runtime to include the
identity service. This will be included in a follow-up.
2019-03-19 13:58:45 -07:00
Oliver Gould 81f645da66
Remove `--tls=optional` and `linkerd-ca` (#2515)
The proxy's TLS implementation has changed to use a new _Identity_ controller.

In preparation for this, the `--tls=optional` CLI flag has been removed
from install and inject; and the `ca` controller has been deleted. Metrics
and UI treatments for TLS have **not** been removed, as they will continue to
be valuable for the new Identity system.

With the removal of the old identity scheme, the Destination service's proxy
ID field is now set with an opaque string (e.g. `ns:emojivoto`) to enable
locality awareness.
2019-03-18 17:40:31 -07:00
Carol A. Scott ff7603f292
Adding text wrap to expanded Tap request
Fixes #1932.

This PR adds text wrap to the tap details page so the full request path can be seen.
2019-03-18 17:27:22 -07:00
Gaurav Kumar 277e644f5a Fix Order of tables change unexpectedly in Top Routes Web UI
Fixes #2420.

Sorts the data returned from a Top Routes query before rendering the tables in the web UI. Previously we rendered the data tables without sorting, leading to inadvertent flipping of table order if the API returned data in a different order.

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-18 15:00:05 -07:00
Gaurav Kumar d0bdd4ffb4 Allow configuration of Prometheus log level (#2484) (#2487)
Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-18 10:34:58 -07:00
Gaurav Kumar 3d5e7eeb9d Fix Top query button behavior in Web UI
Fixes #2347

Previously, running a Top query for a namespace and resource that did not return
data would permanently disable the 'start query' button even if a user chose a
new namespace/resource combination. This allows the user to perform a new query
after their previous query does not return data.

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-14 15:44:23 -07:00
Gaurav Kumar cbcd201715 Add TCP stats to the Linkerd Pod Grafana dashboard (#2329) (#2477)
* Add TCP stats to the Linkerd Pod Grafana dashboard (#2329)
* Minimize tcp stats and link it to dashboard tcp tables
* Add rows to fix minimization issues

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
2019-03-14 14:49:13 -07:00
Kevin Lingerfelt 77e3b70d3e
Update CHANGES.md for the edge-19.3.2 release (#2495)
* Update CHANGES.md for the edge-19.3.2 release
* Fix typo
* Wordsmithing

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-03-14 11:00:36 -07:00
Andrew Seigner 024a77ec16
Use correct resource names for authz checks (#2496)
The `linkerd check` command was using TitleCase resource names (e.g.
"ConfigMaps") for SelfSubjectAccessReview requests. These were not
valid, they were only passing because SSARs requests return `allowed`
for unknown resource types unless explicitly restricted.

Modify the `linkerd check` authorization requests to use the correct
resource names.

Steps to reproduce:
- default AKS cluster
- running inside a pod

```bash
$ kubectl proxy
```

Fails:

```bash
$ curl -k -v -XPOST -d'{"kind":"SelfSubjectAccessReview","apiVersion":"authorization.k8s.io/v1","spec":{"resourceAttributes":{"namespace":"default","verb":"create","version":"v1","resource":
"Namespace"}}}'  -H "Accept: application/json, */*" -H "Content-Type: application/json" http://127.0.0.1:8001/apis/authorization.k8s.io/v1/selfsubjectaccessreviews

...

{
  "kind": "SelfSubjectAccessReview",
  "apiVersion": "authorization.k8s.io/v1",
  "metadata": {
    "creationTimestamp": null
  },
  "spec": {
    "resourceAttributes": {
      "namespace": "default",
      "verb": "create",
      "version": "v1",
      "resource": "Namespace"
    }
  },
  "status": {
    "allowed": false
  }
}
```

Works:

```bash
curl -k -v -XPOST -d'{"kind":"SelfSubjectAccessReview","apiVersion":"authorization.k8s.io/v1","spec":{"resourceAttributes":{"namespace":"default","verb":"create","version":"v1","resource":
"namespaces"}}}'  -H "Accept: application/json, */*" -H "Content-Type: application/json" http://127.0.0.1:8001/apis/authorization.k8s.io/v1/selfsubjectaccessreviews

...

{
  "kind": "SelfSubjectAccessReview",
  "apiVersion": "authorization.k8s.io/v1",
  "metadata": {
    "creationTimestamp": null
  },
  "spec": {
    "resourceAttributes": {
      "namespace": "default",
      "verb": "create",
      "version": "v1",
      "resource": "namespaces"
    }
  },
  "status": {
    "allowed": true,
    "reason": "RBAC: allowed by ClusterRoleBinding \"docker-build\" of ClusterRole \"docker-build\" to ServiceAccount \"docker-build/docker-build\""
  }
}
```

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-14 10:20:09 -07: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
Ivan Sim 468ad118f2
Support Auto-Inject Configs Overrides Via Annotations (#2471)
* Defined the config annotations as new constants in labels.go
* Introduced the getOverride() functions to override configs
* Introduced new accessors to abstract with type casting

Signed-off-by: Ivan Sim <ivan@buoyant.io>
2019-03-14 08:42:12 -07:00
Kevin Lingerfelt e862e98d1a
Bump proxy to 4ed4dcc (#2494)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2019-03-13 16:57:07 -07:00
Andrew Seigner 155c063348
Faster test cleanup (#2492)
`bin/test-cleanup` takes 48s on ci.

This change sets `kubectl --wait=false`, so the command should return
immediately rather than waiting for resources to be fully deleted.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-13 10:07:26 -07:00
Carol A. Scott 92b47ed29b
Specify a default port for the Linkerd dashboard (#2486)
The CLI now specifies a default port, 50750, for the Linkerd dashboard. 
If that port is not available, it resumes the original behavior of binding to a
free ephemeral port.
2019-03-12 15:58:13 -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
Andrew Seigner 52d44b6d4d
Generate .gitcookies during ci to fix rate-limits (#2485)
The ci job pulls Go code from googlesource.com, among other places.
These requests were regularly failing due to rate-limiting.

Introduce a script, from go.googlesource.com, to generate a .gitcookies
file. That script is stored in a `$GITCOOKIE_SH` environment variable in
ci, which is base64 decoded and executed during ci.

More info:
https://github.com/golang/go/issues/12933#issuecomment-199429151

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-11 14:24:55 -07:00
Kevin Leimkuhler 229e33e79e
cli: Always display stat tables for all routes (#2466)
## Problem

When an object has no previous route metrics, we do not generate a table for
that object.

The reasoning behind this was for reducing output of the following command:

```
$ linkerd routes deploy --to deploy/foo
```

For each deployment object, if it has no previous traffic to `deploy/foo`, then
a table would not be generated for it.

However, the behavior we see with that indicates there is an error even when a
Service Profile is installed:

```
$ linkerd routes deploy deploy/foo
Error: No Service Profiles found for selected resources
```

## Solution

Always generate a stat table for the queried resource object.

## Validation

I deployed [booksapp](https://github.com/buoyantIO/booksapp) with the `traffic`
deployment removed and Service Profiles installed.

Without the fix, `linkerd routes deploy/webapp` displays an error because there
has been no traffic to `deploy/webapp` without the `traffic` deployment.

With the fix, the following output is generated:

```
ROUTE                       SERVICE   SUCCESS      RPS   LATENCY_P50   LATENCY_P95   LATENCY_P99
GET /                        webapp     0.00%   0.0rps           0ms           0ms           0ms
GET /authors/{id}            webapp     0.00%   0.0rps           0ms           0ms           0ms
GET /books/{id}              webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /authors                webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /authors/{id}/delete    webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /authors/{id}/edit      webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /books                  webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /books/{id}/delete      webapp     0.00%   0.0rps           0ms           0ms           0ms
POST /books/{id}/edit        webapp     0.00%   0.0rps           0ms           0ms           0ms
[DEFAULT]                    webapp     0.00%   0.0rps           0ms           0ms           0ms
```

Closes #2328

Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
2019-03-11 14:17:20 -07:00
Andrew Seigner a42e8db45f
Quiet inject logging (#2483)
Manual and auto injection was logging the full patch JSON at the `Info`
level.

Modify injection to log the object type and name at the `Info` level,
and the full patch at the `Debug` level.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-11 10:39:10 -07:00
Risha Mars 3be5de1736
Fix name of default route to ensure DEFAULT route is sorted to the bottom (#2469)
Some time ago, I fixed sorting on these tables so that the default route ([default]) 
was sorted to the bottom. The name was changed to [DEFAULT] causing that sort 
to no longer put the default route at the bottom. Update to correct case.
2019-03-07 19:27:39 -04:00
Andrew Seigner d4fdbe4991
Fix web init to not check for ServiceProfiles (#2470)
linkerd/linkerd2#2428 modified SelfSubjectAccessReview behavior to no
longer paper-over failed ServiceProfile checks, assuming that
ServiceProfiles will be required going forward. There was a lingering
ServiceProfile check in the web's startup that started failing due to
this change, as the web component does not have (and should not need)
ServiceProfile access. The check was originally implemented to inform
the web component whether to expect "single namespace" mode or
ServiceProfile support.

Modify the web's initialization to always expect ServiceProfile support.

Also remove single namespace integration test

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-07 15:20:46 -08:00
Alejandro Pedraza 0da851842b
Public API endpoint `Config()` (#2455)
Public API endpoint `Config()`

Retrieves Global and Proxy configurations.
Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-03-07 17:37:46 -05:00
Andrew Seigner 38288b0688
README and test updates (#2467)
Add another known log error to the integration tests.
Also bump README copyright to 2019

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-07 14:36:41 -08:00
Risha Mars f2be6cb058
Surface TCP stats in more places in the dashboard (#2464)
Show the TCP stats table in Namespace Overview page (the landing page) 
as well as the Namespace pages.
2019-03-07 14:56:04 -04:00
Andrew Seigner f258cf0d3a
Introduce cli command to fetch proxy metrics (#2445)
It's sometimes helpful to spotcheck proxy metrics from a specific pod,
but doing so with kubectl requires a few steps.

Introduce a new `linkerd metrics` command. When given a pod name and
namespace, returns a dump of the proxy's /metrics endpoint.

Also modify the k8s.portforward module to accept initialized k8s config
and client objects, to enable testing.

Fixes #2350.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-07 10:24:38 -08:00
Andrew Seigner 8da2cd3fd4
Require cluster-wide k8s API access (#2428)
linkerd/linkerd2#2349 removed the `--single-namespace` flag, in favor of
runtime detection of cluster vs. namespace access, and also
ServiceProfile availability. This maintained control-plane support for
running in these two states.

This change requires control-plane components have cluster-wide
Kubernetes API access and ServiceProfile availability, and will error
out if not. Once #2349 merges, stage 1 install will be a requirement for
a successful stage 2 install.

Part of #2337

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-07 10:23:18 -08: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
Risha Mars a454662c3f
Edit CHANGES.md to remove a branch that isn't merged yet (#2463) 2019-03-06 18:59:38 -05:00
Aditya Sharma 3740aa238a Remove `--api-port` flag from the cli (#2429)
* Changed the protobuf definition to take out destinationApiPort entirely
* Store destinationAPIPort as a constant in pkg/inject.go

Fixes #2351

Signed-off-by: Aditya Sharma <hello@adi.run>
2019-03-06 15:54:12 -08:00
Risha Mars 1bb60e2bc5
Update CHANGES.md for the edge-19.3.1 release (#2458)
* Update CHANGES.md for the edge-19.3.1 release
2019-03-06 17:49:03 -05:00
Risha Mars 9cc9cc22af
Show TCP stats in `linkerd stat` when -o wide or -o json is used (#2408)
Show TCP stats in the linkerd stat output. They are not shown by default, but
will be queried when using -o wide or -o json.

Also display read/write bytes as bytes per sec in the CLI and dashboard.
2019-03-06 17:29:24 -05:00
Andrew Seigner a3d84eae7f
Add more known log errors to integration tests (#2457)
Relates to #2414, #2452

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2019-03-06 12:58:00 -08:00
Alejandro Pedraza 54f943a725
Uninject: remove labels at the top level (#2442)
Fixes #2377

In inject's ResourceConfig, renamed objMeta to podMeta since
it really points to the pod template metadata. And created a new field
workloadMeta that really points to the main workload (e.g. Deployment) metadata.

Refactored uninject to clean up the labels at both podMeta and
workloadMeta. Also it will remove all the labels and annotations that
start with "linkerd.io" except for the "linkerd.io/inject" annotation.

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-03-06 14:35:59 -05:00
Cody Vandermyn 670703700e add preStop and change sleep command; update yaml spacing (#2441)
Signed-off-by: Cody Vandermyn <cody.vandermyn@nordstrom.com>
2019-03-06 10:57:04 -08:00
Alejandro Pedraza f155fb9a8f
Have `NewFakeClientSets()` not swallow errors when parsing YAML (#2454)
This helps catching bad YAMLs in test resources

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
2019-03-06 13:53:04 -05:00