Commit Graph

235 Commits

Author SHA1 Message Date
Ray Tung 1d7b4e40de Fixed build rust doc (#481)
BUILD.md included a command with an invalid environment variable,
which prevented the proxy from starting.

The IP address `0` is no longer considered valid by the proxy, so the
doc now refers to `0.0.0.0` instead.

Signed-off-by: Ray Tung <rtung@thoughtworks.com>
2018-02-28 13:05:12 -08:00
Igor Zibarev 0f6db6efc0 cli: refactor k8s config to support $KUBECONFIG with multiple paths (#482)
Kubernetes $KUBECONFIG environment variable is a list of paths to
configuration files, but conduit assumes that it is a single path.

Changes in this commit introduce a straightforward way to discover and
load config file(s).

Complete list of changes:

- Use k8s.io/client-go/tools/clientcmd to deal with kubernetes
configuration file
- rename k8s API and k8s proxy constructors to get rid of redundancy
- remove shell package as it is not needed anymore

Signed-off-by: Igor Zibarev <zibarev.i@gmail.com>
2018-02-28 12:13:09 -08:00
Andrew Seigner d50c8b4ac8
Add Grafana to conduit install (#444)
`conduit install` deploys prometheus, but lacks a general-purpose way to
visualize that data.

This change adds a Grafana container to the `conduit install` command. It
includes two sample dashboards, viz and health, in their own respective
source files.

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-28 11:36:21 -08:00
Eliza Weisman 41bef41eb5
Refactor FullyQualifiedAuthority::normalize to always return authority (#476)
As requested by @briansmith in https://github.com/runconduit/conduit/issues/415#issuecomment-369026560 and https://github.com/runconduit/conduit/issues/415#issuecomment-369032059, I've refactored `FullyQualifiedAuthority::normalize` to _always_ return a `FullyQualifiedAuthority`, along with a boolean value indicating whether or not the Destination service should be used for that authority. 

This is in contrast to returning an `Option<FullyQualifiedAuthority>` where `None` indicated that the Destination service should not be used, which is what this function did previously.

This is required for further progress on #415.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-02-27 17:38:43 -08:00
Andy Hume 1e611c21c6 cli: add check for latest version of cli and control plane (#460)
As part of `conduit check` command, warn the user if they are
running an outdated version of the cli client or the control
plane components.

Fixes #314

Signed-off-by: Andy Hume <andyhume@gmail.com>
2018-02-27 16:11:38 -08:00
Alex Leong 84ba1f3017
Ensure tap requests at least 1rps from each pod (#459)
When attempting to tap N pods when N is greater than the target rps, a rounding error occurs that requests 0 rps from each pod and no tap data is returned.

Ensure that tap requests at least 1 rps from each target pod.

Tested in Kubernetes on docker-for-desktop with a 15 replica deployment and a maxRps of 10.

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-02-27 16:03:47 -08:00
Eliza Weisman 9ffe8b7970
Skip flaky tests in non-Docker CI builds (#474)
@briansmith pointed out in https://github.com/runconduit/conduit/pull/441#discussion_r170816351 that I forgot to add `--no-default-features` to the Travis CI non-Docker test step in PR #441, to actually skip the timing dependent tests on CI.

This fixes that.
2018-02-27 14:05:57 -08:00
Brian Smith b788daf429
Update abstract-ns and tempdir dependencies to use rand 0.4. (#468)
```
cargo update -p tempdir
cargo update -p abstract-ns
```

The new version of tempdir actually adds a new dependency, but
apparently that is to fix a bug.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 19:40:03 -10:00
Brian Smith 0d14c196f5
Proxy: Upgrade from ordermap 0.2 crate to indexmap 0.4. (#466)
Currently we have to download and build two different versions of
the ordermap crate.

I will submit similar PRs for the dependent crates so that we will
eventually all be using the same version of indexmap.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 19:29:22 -10:00
Brian Smith d993820cb3
Fix intermittent outbound_times_out failure. (#471)
This was caused by the fact that a new instance of `env_logger::init()`
was added after the PR that rewrote them all to `env_logger::try_init()`
was added.

Fixes #469

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 19:07:36 -10:00
Brian Smith 6b4d294a40
Reduce memory allocations during logging. (#445)
Stop initializing env_logger in every test. In env_logger 0.5, it
may only be initialized once per process.

Also, Prost will soon upgrade to env_logger 0.5 and this will
(eventually) help reduce the number of versions of env_logger we
have to build. Turning off the regex feature will (eventually) also
reduce the number of dependencies we have to build. Unfortunately,
as it is now, the number of dependencies has increased because
env_logger increased its dependencies in 0.5.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 18:32:47 -10:00
Brian Smith 578cffca22
Turn off the `use_logging` default feature of quickcheck. (#465)
Turning off the default features of quickcheck removes its
`env_logger` and `log` dependencies. It uses older versions of
those packages than conduit-proxy will use, so this will
(eventually) reduce the number of versions of those packages that
get downloaded and built.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 16:04:58 -10:00
Brian Smith 617d7da894
Remove the unused tokio-proto build dependency. (#451)
Hyper depends on tokio-proto with a default feature. By turning off
its default features, we can avoid that dependency. That reduces the
number of dependencies by 4.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 08:56:05 -10:00
Brian Smith 8607875267
Stop using the url crate in the proxy. (#450)
Version 1.7.0 of the url crate seems to be broken which means we cannot
`cargo update` the proxy without locking url to version 1.6. Since we only
use it in a very limited way anyway, and since we use http::uri for parsing
much more, just switch all uses of the url crate to use http::uri for parsing
instead.

This eliminates some build dependencies.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-26 08:55:48 -10:00
Eliza Weisman 694f691b71
Add timeout to Outbound::bind_service (#436)
Closes #403.

When the Destination service does not return a result for a service, the proxy connection for that service will hang indefinitely waiting for a result from Destination. If, for example, the requested name doesn't exist, this means that the proxy will wait forever, rather than responding with an error.

I've added a timeout wrapping the service returned from `<Outbound as Recognize>::bind_service`. The timeout can be configured by setting the `CONDUIT_PROXY_BIND_TIMEOUT` environment variable, and defaults to 10 seconds (because that's the default value for [a similar configuration in Linkerd](https://linkerd.io/config/1.3.5/linkerd/index.html#router-parameters)).

Testing with @klingerf's reproduction from #403:
```
curl -sIH 'Host: httpbin.org' $(minikube service proxy-http --url)/get | head -n1
HTTP/1.1 500 Internal Server Error
```
proxy logs:
```rust
proxy-5698f79b66-8rczl conduit-proxy INFO conduit_proxy using controller at HostAndPort { host: Domain("proxy-api.conduit.svc.cluster.local"), port: 8086 }
proxy-5698f79b66-8rczl conduit-proxy INFO conduit_proxy routing on V4(127.0.0.1:4140)
proxy-5698f79b66-8rczl conduit-proxy INFO conduit_proxy proxying on V4(0.0.0.0:4143) to None
proxy-5698f79b66-8rczl conduit-proxy INFO conduit_proxy::transport::connect "controller-client", DNS resolved proxy-api.conduit.svc.cluster.local to 10.0.0.240
proxy-5698f79b66-8rczl conduit-proxy ERR! conduit_proxy::map_err turning service error into 500: Inner(Timeout(Duration { secs: 10, nanos: 0 }))
```
2018-02-26 10:18:35 -08:00
Eliza Weisman 6309741ae7
Add flaky_tests feature for skipping some tests on CI (#441)
This PR adds a `flaky_tests` cargo feature to control whether or not to ignore tests that are timing-dependent. This feature is enabled by default in local builds, but disabled on CI and in all Docker builds.

Closes #440
2018-02-26 10:17:53 -08:00
Dennis Adjei-Baah 893bacf8d6
Make prometheus URL in config fully qualified DNS name (#443)
The telemetry service in the controller pod uses a non-fully qualified URL to connect to the prometheus pod in the control plane. This PR changes the URL the telemetry's prometheus URL to be fully qualified to be consistent with other URLs in the control plane. This change was tested in minikube. The logs report no errors and looking at the prometheus dashboard shows that stats are being recorded from all conduit proxies.

fixes #414

Signed-off-by: Dennis Adjei-Baah dennis@buoyant.io
2018-02-26 09:40:31 -08:00
Sean McArthur 381fb3800e
proxy: don't send transfer-encoding for empty GET requests (#410)
This is fixed in hyper v0.11.19.

Closes #402
2018-02-23 16:22:45 -08:00
Brian Smith 34cf79a3e6
Add a test of the actual default output of `conduit install`. (#376)
Refactor `conduit install` test into a data-driven test. Then add a test of the actual default output of `conduit install`.

This test is useful to make it clear when we change the default
settings of `conduit install`.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 13:27:36 -10:00
Brian Smith 78ebd5e340
Base control plane Docker images on scratch instead of base. (#368)
The control plane is proxied through the Conduit proxy. The Conduit
proxy is based on the base image, and the control plane containers
and the proxy share a networking namespace. This means we don't
need the extra base utilities in the controller images since we can
use the utilties in the proxy image.

This is a step towards building the initial no-networking Conduit CA
pod. Since the Conduit CA will not do any networking of its own, we
networking debugging utilties are not helpful for it. They are
actually an unnecessary risk because they could facilitate the
exfiltration of the private key of the CA. (The Conduit CA pod won't
have the Conduit Proxy injected into it either.)

This also simplifies & slightly speeds up the building of the
controller images. This is a stepping stone towards being able to
build the controller images without `docker build` to improve build
times.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 13:03:19 -10:00
Brian Smith 86bb65a148
Remove potentially-conflicting `app` labels in control plane (#373)
The `app` label should be reserved for end-user applications and we
shouldn't use it ourselves. We already have a Conduit-specific label
that is is prefixed with the `conduit.io/` prefix to avoid naming
collisions with users' labels, so just use that one instead.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 12:43:55 -10:00
Andrew Seigner 83f9c391bb
Move install template to its own file (#423)
The template used by `conduit install` was hard-coded in install.go.

This change moves the template into its own file, in anticipation of
increasing the template's size and complexity.

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-23 14:15:31 -08:00
Dennis Adjei-Baah f66ec6414c
Inject the conduit proxy into controller pod during conduit install (#365)
In order to take advantage of the benefits the conduit proxy gives to deployments, this PR injects the conduit proxy into the control plane pod. This helps us lay the groundwork for future work such as TLS, control plane observability etc.

Fixes #311

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-23 13:55:46 -08:00
Sean McArthur 7365c5645a
proxy: fix intermittent tap match method quickcheck failure (#427)
Closes #413
2018-02-23 12:13:51 -08:00
Andrew Seigner 304f4e12dd
Make build scripts location-agnostic (#409)
The build scripts assume they are executed from the root of this repo.
This prevents running scripts from other locations, for example,
`cd web && ../bin/go-run .`.

Modify the build scripts to work regardless of current directory.

Fixes #301

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-23 10:02:14 -08:00
Sean McArthur b861a6df31
proxy: improve overall quality of logs (#424)
- Removed several useless `trace!("poll")` lines
- Upgraded controller client errors to `error` level
- Made controller client errors human-readable
2018-02-22 15:51:04 -08:00
Sean McArthur 382b68faeb proxy: add more tests for loopback IPs in FullyQualifiedAuthority (#411)
Closes #357

Signed-off-by: Sean McArthur <sean@seanmonstar.com>
2018-02-21 18:15:23 -10:00
Brian Smith cf3c8cd7bc
Use Go 1.10.0 to build Go components. (#408)
* Use Go 1.10.0 to build Go components.

Take advantage of the new build cache in Go 1.10. Future work on improving
build performance will utilize the build cache further.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-21 14:31:29 -10:00
Eliza Weisman 50103d479a
Remove timestamps from log messages (#399)
As @olix0r requested in https://github.com/runconduit/conduit/issues/56#issuecomment-356771758, I've removed timestamps from the Conduit proxy's log records.

Closes #56

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-02-21 15:17:17 -08:00
Brian Smith e6aad57766
Remove temporary files generated by dep in go-deps image. (#407)
Previously Dockerfile-go-deps was converted from a multi-stage Dockefile
to a single-stage Dockerfile in anticipation of enabling efficient use
of `--cache-from` in CI. However, that resulted in the image ballooning
in size because it contained the Git repo for every package downloaded
by `dep ensure`.

Bring the image back down to the proper size by removing the temporary
files created.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-21 13:06:24 -10:00
Kevin Lingerfelt 383babfae2
Prepare for the v0.3.0 release (#406)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-21 11:14:11 -08:00
Carl Lerche 287128885e
Proxy: Limit the max number of in-flight requests. (#398)
Currently, the max number of in-flight requests in the proxy is
unbounded. This is due to the `Buffer` middleware being unbounded.

This is resolved by adding an instance of `InFlightLimit` around
`Buffer`, capping the max number of in-flight requests for a given
endpoint.

Currently, the limit is hardcoded to 10,000. However, this will
eventually become a configuration value.

Fixes #287

Signed-off-by: Carl Lerche <me@carllerche.com>
2018-02-20 19:56:21 -08:00
Kevin Lingerfelt c579a8fe8d
Improve get/stat/tap help text by way of examples (#401)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 19:27:42 -08:00
Sean McArthur 236f71fbe0
proxy: use original dst if authority doesnt look like local service (#397)
The proxy will check that the requested authority looks like a local service, and if it doesn't, it will no longer ask the Destination service about the request, instead just using the SO_ORIGINAL_DST, enabling egress naturally.

The rules used to determine if it looks like a local service come from this comment:

> If default_zone.is_none() and the name is in the form $a.$b.svc, or if !default_zone.is_none() and the name is in the form $a.$b.svc.$default_zone, for some a and some b, then use the Destination service. Otherwise, use the IP given.
2018-02-20 18:09:21 -08:00
Kevin Lingerfelt b9b16195b8
Remove uses of upstream/downstream from web UI (#400)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 17:05:22 -08:00
Kevin Lingerfelt 8db7115420
Update go-run to set version equal to root-tag (#393)
* Update go-run to set version equal to root-tag

* Fix inject tests for undefined version change

* Pass inject version explitictly as arg

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 12:25:55 -08:00
Kevin Lingerfelt f48555d3cc
Remove kubectl dependency, validate k8s server version via api (#396)
* Remove kubectl dependency, validate k8s server version via api

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>

* Remove unused MockKubectl

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>

* Remame kubectl.go to version.go

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 12:14:11 -08:00
Dennis Adjei-Baah 9af3783555
Print error message only when invalid YAML file is used with inject command (#389)
When the `inject` command is used on a YAML file that is invalid, it prints out an invalid YAML file with the injected proxy. This may give a false indication to the user that the inject was successful even though the inject command prints out an error message further down the terminal window. This PR fixes #303 and contains a test input and output file that indicates what should be shown.

This PR also fixes #390.
Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-20 11:59:41 -08:00
Kevin Lingerfelt d1ae4c5bc7
Run conduit dashboard on ephemeral port by default (#394)
* Run conduit dashboard on ephemeral port by default

* Fix wording on dashboard --port flag

* log.Debug error instead of discarding it

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 10:33:47 -08:00
Risha Mars b26a551d89
Increase padding of main section (#395) 2018-02-20 10:11:32 -08:00
Risha Mars ae0d47d5c9
Add ability to cancel promises via a wrapper (#374)
* Add ability to cancel promises via a wrapper

* Let the ApiHelpers keep track of outstanding requests, provide ApiHelpers.cancel()
2018-02-19 17:28:40 -08:00
William Morgan 6807b491d3
update readme: experimental -> alpha, and minor tweaks (#391)
update README, add mailing list links, etc.
2018-02-19 15:41:04 -08:00
Risha Mars 53354cf68f
Small UI tweaks for 0.3 prep (#377)
* Display more decimal points for truncated numbers, add hover info

* Filter completed pods out of web UI

* Decrease the polling interval from 10s to 2s

* Add more detailed pod categorization based on status

* Tweak filtering of pods, tweak explanations in status table
2018-02-19 14:11:03 -08:00
Brian Smith 1489a84316
Refactor `conduit inject` code to eliminate duplicate logic (#383)
* Refactor `conduit inject` code to eliminate duplicate logic

Previously there was a lot of code repeated once for each type of
object that has a pod spec.

Refactor the code to reduce the amount of duplication there, to make future
changes easier.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-19 11:18:44 -10:00
Brian Smith 80aba6c075
CLI: Remove now-unnecessary "enhanced" Kubernetes object types (#382)
* CLI: Remove now-unnecessary "enhanced"  Kubernetes object types

The "enhanced" types aren't necessary because now the Kuberentes API
implementation has the correct JSON annotations for the InitContainers
field.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-19 09:37:25 -10:00
Risha Mars 8bc7c5acde
UI tweaks: sidebar collapse, latency formatting, table row spacing (#361)
- reduce row spacing on tables to make them more compact
- Rename TabbedMetricsTable to MetricsTable since it's not tabbed any more
- Format latencies greater than 1000ms as seconds
- Make sidebar collapsible 
- poll the /pods endpoint from the sidebar in order to refresh the list of deployments in the autocomplete
- display the conduit namespace in the service mesh details table
- Use floats rather than Col for more responsive layout (fixes #224)
2018-02-19 11:21:54 -08:00
Dennis Adjei-Baah 01e694ad71
add check and friendly error if conduit dashboard is not installed (#289)
* add check and friendly error if conduit dashboard is not installed

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-19 09:28:56 -08:00
Brian Smith d8f9c33183
Skip pods with hostNetwork=true in `conduit inject` (#380)
The init container injected by conduit inject rewrites the iptables configuration for its network namespace. This causes havoc when the network namespace isn't restricted to the pod, i.e. when hostNetwork=true.

Skip pods with hostNetwork=true to avoid this problem.

Fixes #366.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-18 13:55:42 -10:00
Brian Smith 51873542e5
Refactor `conduit inject` code to make it unit-testable. (#379)
Refactor `conduit inject` code to make it unit-testable.

Refactor the conduit inject code to make it easier to add unit tests. This work was done by @deebo91 in #365. This is the same PR without the conduit install changes, so that it can land ahead of #365. In particular, this will be used for testing the fix for high-priority bug #366.

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-18 12:33:52 -10:00
Oliver Gould c454ac413c
Upgrade to Rust 1.24.0 (#363)
Upgrade to Rust 1.24.0
2018-02-16 14:37:29 -08:00