Commit Graph

783 Commits

Author SHA1 Message Date
Eliza Weisman aee845e40f
proxy: Rebind endpoint stacks on TLS config changes using WatchService (#1185)
This branch changes the proxy's `Bind` module to add a middleware layer 
which watches for TLS cliend configuration changes and rebinds the 
endpoint stacks of any endpoints with which it is able to communicate with over 
TLS (i.e. those with `TlsIdentity` metadata) when the client config changes. The 
rebinding is done at the level of individual endpoint stacks, rather than for the
entire service stack for the destination.

This obsoletes my previous PRs #1169 and #1175.

Closes #1161

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-06-21 17:49:19 -07:00
Kevin Lingerfelt 5cf8ab00df
Switch to multi-value --tls flag, add to inject (#1182)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-21 15:52:14 -07:00
Oliver Gould 44d7ee06ca
proxy: Implement a WatchService (#1177)
WatchService is a middleware that rebinds its inner service
each time a Watch updates.

This is planned to be used to rebind endpoint stacks when TLS
configuration changes. Later, it should probably be moved into
the tower repo.
2018-06-21 15:41:41 -07:00
Andrew Seigner c4d570aa26
Revert usage of parallel in docker-build (#1183)
PR #978 introduced usage of parallel in docker-build. Unfortunately this
breaks if the system has non-GNU parallel.

Remove usage of parallel until we can do at least one of the following:
- detect version of parallel installed
- make usage of parallel optional and off by default
- confirm this speeds up builds for a majority of use cases

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-06-21 23:13:29 +01:00
Kevin Lingerfelt af85d1714f
Add probes and log termination policy for distributor (#1178)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-21 14:02:41 -07:00
Kevin Lingerfelt 12f869e7fc
Add CA certificate bundle distributor to conduit install (#675)
* Add CA certificate bundle distributor to conduit install
* Update ca-distributor to use shared informers
* Only install CA distributor when --enable-tls flag is set
* Only copy CA bundle into namespaces where inject pods have the same controller
* Update API config to only watch pods and configmaps
* Address review feedback

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-21 13:12:21 -07:00
Oliver Gould 5f7067c864
proxy: Document tls::config::watch_for_config_changes (#1176)
While investigating TLS configuration, I found myself wanting a
docstring on `tls::config::watch_for_config_changes`.

This has one minor change in functionality: now, `future::empty()`
is returned instead of `future:ok(())` so that the task never completes.
It seems that, ultimately, we'll want to treat it as an error if we lose
the ability to receive configuration updates.
2018-06-21 11:05:03 -07:00
Kevin Lingerfelt e80356de34
Upgrade prometheus to v2.3.1 (#1174)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-21 11:02:21 -07:00
Brian Smith bc6eb34469
Proxy: Implement TLS conditional accept more like TLS conditional connect. (#1166)
* Proxy: Implement TLS conditional accept more like TLS conditional connect.

Clean up the accept side of the TLS configuration logic.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-20 19:46:31 -10:00
Eliza Weisman 9bf1e60a61 bin: Remove unused script (#1153)
Committed in error.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-06-20 18:01:14 -07:00
Kevin Lingerfelt 682b0274b5
Add controller admin servers and readiness probes (#1168)
* Add controller admin servers and readiness probes
* Tweak readiness probes to be more sane
* Refactor based on review feedback

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-20 17:32:44 -07:00
Sean McArthur c52385dd42
proxy: add HTTP/1.1 Upgrade support automatically (#1126)
Any HTTP/1.1 requests seen by the proxy will automatically set up
to prepare such that if the proxied responses agree to an upgrade,
the two connections will converted into a standard TCP proxy duplex.

Implementation
-----------------

This adds a new type, `transparency::Http11Upgrade`, which is a sort of rendezvous type for triggering HTTP/1.1 upgrades. In the h1 server service, if a request looks like an upgrade (`h1::wants_upgrade`), the request body is decorated with this new `Http11Upgrade` type. It is actually a pair, and so the second half is put into the request extensions, so that the h1 client service may look for it right before serialization. If it finds the half in the extensions, it decorates the *response* body with that half (if it looks like a response upgrade (`h1::is_upgrade`)).

The `HttpBody` type now has a `Drop` impl, which will look to see if its been decorated with an `Http11Upgrade` half. If so, it will check for hyper's new `Body::on_upgrade()` future, and insert that into the half. 

When both `Http11Upgrade` halves are dropped, its internal `Drop` will look to if both halves have supplied an upgrade. If so, the two `OnUpgrade` futures from hyper are joined on, and when they succeed, a `transparency::tcp::duplex()` future is created. This chain is spawned into the default executor.

The `drain::Watch` signal is carried along, to ensure upgraded connections still count towards active connections when the proxy wants to shutdown.

Closes #195
2018-06-20 16:41:43 -07:00
Sean McArthur 8dcb95d39f
proxy: re-enabled vectored writes through our dynamic Io trait object. (#1167)
This adds `Io::write_buf_erased` that doesn't required `Self: Sized`, so
it can be called on trait objects. By using this method, specialized
methods of `TcpStream` (and others) can use their `write_buf` to do
vectored writes.

Since it can be easy to forget to call `Io::write_buf_erased` instead of
`Io::write_buf`, the concept of making a `Box<Io>` has been made
private. A new type, `BoxedIo`, implements all the super traits of `Io`,
while making the `Io` trait private to the `transport` module. Anything
hoping to use a `Box<Io>` can use a `BoxedIo` instead, and know that
the write buf erase dance is taken care of.

Adds a test to `transport::io` checking that the dance we've done does
indeed call the underlying specialized `write_buf` method.

Closes #1162
2018-06-20 16:31:48 -07:00
Thomas Rampelberg ad659874bd
Enable optional parallel build of docker images (#978)
* Enable optional parallel build of docker images

By default, docker does image builds in a single thread. For our containers, this is a little slow on my system. Using `parallel` allows for *optional* improvements in speed there.

Before: 41s
After: 22s

* Move parallel help text to stderr
2018-06-20 15:57:29 -07:00
Risha Mars 0ff1bb4ad8
Don't allow stat requests for named resources in --all-namespaces (#1163)
Don't allow the CLI or Web UI to request named resources if --all-namespaces is used.

This follows kubectl, which also does not allow requesting named resources
over all namespaces.

This PR also updates the Web API's behaviour to be in line with the CLI's. 
Both will now default to the default namespace if no namespace is specified.
2018-06-20 12:59:31 -07:00
Brian Smith 33ff1a33ab
Proxy: More carefully keep track of the reason TLS isn't used. (#1164)
* Proxy: More carefully keep track of the reason TLS isn't used.

There is only one case where we dynamically don't know whether we'll
have an identity to construct a TLS connection configuration. Refactor
the code with that in mind, better documenting all the reasons why an
identity isn't available.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-20 07:40:49 -10:00
Brian Smith 8ece9c4508
Proxy: Add TLS client infrastructure. (#1158)
Move TLS cipher suite configuration to tls::config.

Use the same configuration to act as a client and a server.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-19 14:26:42 -10:00
Kevin Lingerfelt 9bfd8898e0
Fix dashboard integration test (#1160)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-19 17:01:47 -07:00
Risha Mars 46c99febf2
Don't panic on stats that aren't included in StatAllResourceTypes (#1154)
Problem
`conduit stat` would cause a panic for any resource that wasn't in the list 
of StatAllResourceTypes
This bug was introduced by https://github.com/runconduit/conduit/pull/1088/files

Solution
Fix writeStatsToBuffer to not depend on what resources are in StatAllResourceTypes
Also adds a unit test and integration test for `conduit stat ns`
2018-06-19 17:00:16 -07:00
Kevin Lingerfelt 9a66641517
dest service: close open streams on shutdown (#1156)
* dest service: close open streams on shutdown
* Log instead of print in pkg packages
* Convert ServerClose to a receive-only channel

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-19 16:00:56 -07:00
Kevin Lingerfelt d3fdf5b504
Add integration tests for tap (#1152)
* Add integration tests for tap
* Collect fewer tap events

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-19 14:05:36 -07:00
Oliver Gould b711d005f6
proxy: Clarify Outbound::recognize (#1144)
The comments in Outbound::recognize had become somewhat stale as the
logic changed. Furthermore, this implementation may be easier to
understand if broken into smaller pieces.

This change reorganizes the Outbound:recognize method into helper
methods--`destination`, `host_port`, and `normalize`--each with
accompanying docstrings that more accurately reflect the current
implementation.

This also has the side-effect benefit of eliminating a string clone on
every request.
2018-06-19 14:01:27 -07:00
Risha Mars 8c9119dad2
Truncate very long error messages, small tweaks to error messages (#1150)
- If error messages are very long, truncate them and display a toggle to show the full message
- Tweak the headings - remove Pod, Container and Image - instead show them as titles
- Also move over from using Ant's Modal.method to the plain Modal component, which is a 
little simpler to hook into our other renders.
2018-06-19 13:58:38 -07:00
Eliza Weisman 13b33b6f3a
proxy: Add `tls="true"` metric label to connections accepted with TLS (#1050)
Depends on #1047.

This PR adds a `tls="true"` label to metrics produced by TLS connections and
requests/responses on those connections, and a `tls="no_config"` label on 
connections where TLS was enabled but the proxy has not been able to load
a valid TLS configuration.

Currently, these labels are only set on accepted connections, as we are not yet
opening encrypted connections, but I wired through the `tls_status` field on 
the `Client` transport context as well, so when we start opening client 
connections with TLS, the label will be applied to their metrics as well.

Closes #1046

Signed-off-by: Eliza Weisman <eliza@buoyanbt.io>
2018-06-19 12:30:11 -07:00
Brian Smith f82d16f50e
Proxy: Make TLS server aware of its own identity. (#1148)
* Proxy: Make TLS server aware of its own identity.

When validating the TLS configuration, make sure the certificate is
valid for the current pod. Make the pod's identity available at that
point in time so it can do so. Since the identity is available now,
simplify the validation of our own certificate by using Rustls's API
instead of dropping down to the lower-level webpli API.

This is a step towards the server differentiating between TLS
handshakes it is supposed to terminate vs. TLS handshakes it is
supposed to pass through.

This is also a step toward the client side (connect) of TLS, which will
reuse much of the configuration logic.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-18 12:53:10 -10:00
Oliver Gould 13716cd269
proxy: Upgrade h2 to 0.1.10 (#1149)
This picks up a fix for https://github.com/carllerche/h2/pull/285
2018-06-18 14:56:54 -07:00
Risha Mars df0bab80b4
Upgrade to webpack 4 and webpack-dev-server 3 (#1138)
Speeds up performance of webpack-dev-server.
2018-06-18 14:38:38 -07:00
Kevin Lingerfelt 9c77dfe00e
v0.4.4 release notes (#1145)
* v0.4.4 release notes

* Tweak wording about adblocker fix

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-18 11:29:31 -07:00
Kevin Lingerfelt 4278f9ec80
Fix unbound variable issue in docker-build script (#1146)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-18 11:29:09 -07:00
Alena Varkockova 6bb8b1328f Build CLI only for host platform (#884)
* Build CLI only for host platform

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>

* Changes after code review

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>
2018-06-18 10:34:56 -07:00
Risha Mars fdb0b7f63f
Grafana: remove fill and stack from individual resource breakouts (#1092)
Remove the filling and stacking in request rate graphs that combine resources, 
to make it easier to spot outliers.

* Grafana: remove fill and stack from individual resource breakouts
* Remove all the stacks and fills from request rates everywhere
2018-06-18 10:14:39 -07:00
Andrew Seigner 0b9e7ff7df
Enable get for nodes/proxy for Prometheus RBAC (#1142)
The `kubernetes-nodes-cadvisor` Prometheus queries node-level data via
the Kubernetes API server. In some configurations of Kubernetes, namely
minikube and at least one baremetal kubespray cluster, this API call
requires the `get` verb on the `nodes/proxy` resource.

Enable `get` for `nodes/proxy` for the `conduit-prometheus` service
account.

Fixes #912

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-06-18 17:49:23 +01:00
Brian Smith 916ed609b1
Update Rustls to the latest Git version to fix a bug. (#1143)
Using MS Edge and probably other clients with the Conduit proxy when
TLS is enabled fails because Rustls doesn't take into consideration
that Conduit only supports one signature scheme (ECDSA P-256 SHA-256).
This bug was fixed in Rustls when ECDSA support was added, after the
latest release. With this change MS Edge can talk to Conduit.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-16 08:09:42 -10:00
Brian Smith a872e57c4c
Proxy: Make the control plane completely optional. (#1132)
Proxy: Make the control plane completely optional.
2018-06-16 08:09:12 -10:00
Eliza Weisman a82eec37ab
Attempt to load TLS settings immediately prior to starting watch (#1137)
Previously, the proxy would not attempt to load its TLS certificates until a fs
watch detected that one of them had changed. This means that if the proxy was
started with valid files already at the configured paths, it would not load 
them until one of the files changed.

This branch fixes that issue by starting the stream of changes with one event
_followed_ by any additional changes detected by watching the filesystem.

I've manually tested that this fixes the issue, both on Linux and on macOS, and
can confirm that this fixes the issue. In addition, when I start writing 
integration tests for certificate reloading, I'll make sure to include a test
to detect any regressions.

Closes #1133.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-06-15 17:32:55 -07:00
Brian Smith cef86f8d5b
Add optional TLS client certificate authentication. (#1135)
Refactor the way the TLS trust anchors are configured in preparation
for the client and server authenticating each others' certificates.

Make the use of client certificates optional pending the implementation
of authorization policy.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-15 14:26:26 -10:00
Brian Smith a121768a76
Keep accepting new connections after TLS handshake error. (#1134)
When a TLS handshake error occurs, the proxy just stops accepting
requests. It seems my expectations of how `Stream` handles errors
were wrong.

The test for this will be added in a separate PR after the
infrastructure needed for TLS testing is added. (This is a chicken
and egg problem.)

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-15 14:22:58 -10:00
Kevin Lingerfelt c750006bc0
Fix conduit version issue in integration tests (#1139)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-15 16:35:51 -07:00
Kevin Lingerfelt a68ca736fa
Start running integration tests in CI (#1064)
* Start running integration tests in CI
* Add gcp helper funcs
* Split integration test cleanup into separate phase

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-15 14:36:48 -07:00
Risha Mars 0ed40288e5
Display proxy container errors in the Web UI (#1130)
* Display proxy container errors in the Web UI

Add an error modal to display pod errors
Add icon to data tables to indicate errors are present
Display errors on the Service Mesh Overview Page and all the resource pages
2018-06-15 14:12:36 -07:00
Kevin Lingerfelt 5c42e4e22b
test: Use proxy instead of lb for external test traffic (#1129)
* test: Use proxy instead of lb for external test traffic
* Adjust timeouts on install and get tests

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-06-15 12:54:12 -07:00
Eliza Weisman 0eadcc542e
proxy: Fix Inotify falling back to polling when files don't exist yet (#1119)
This PR changes the proxy's Inotify watch code to avoid always falling back to
polling the filesystem when the watched files don't exist yet. It also contains
some additional cleanup and refactoring of the inotify code, including moving
the non-TLS-specific filesystem watching code out of the `tls::config` module
and into a new `fs_watch` module.

In addition, it adds tests for both the polling-based and inotify-based watch
implementations, and changes the polling-based watches to hash the files rather
than using timestamps from the file's metadata to detect changes. These changes
are originally from #1094 and #1091, respectively, but they're included here
because @briansmith asked that all the changes be made in one PR.

Closes #1094. Closes #1091. Fixes #1090. Fixes #1097. Fixes #1061.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-06-15 11:40:04 -07:00
Brian Smith 110d91e667
Simplify & clarify "No TLS" server configuration (#1131)
The same pattern will be used for the "No TLS" client configuration.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-06-14 19:10:03 -10:00
Oliver Gould be2d878fba
proxy: Update prost to 0.4.0 (#1127)
prost-0.4.0 has been released, which removes unnecessary dependencies.
tower-grpc is being updated simultaneously, as this is the proxy's
primary use of prost.

See: https://github.com/danburkert/prost/releases/tag/v0.4.0
2018-06-14 16:29:41 -07:00
Risha Mars e2c2f19d2c
Propagate errors in conduit containers to the api (#1117)
- It would be nice to display container errors in the UI. This PR gets the pod's container 
statuses and returns them in the public api

- Also add a terminationMessagePolicy to conduit's inject so that we can capture the 
proxy's error messages if it terminates
2018-06-14 16:22:31 -07:00
Oliver Gould 5dfc863049
proxy: Update `rand` to 0.5.1 (#1125)
* proxy: Update `rand` to 0.5.1

The proxy depends on rand-0.4, which is superceded by newer APIs in
rand-0.5. Since we're already using rand-0.5 via the tower-balance
crate, it seems appropriate to upgrade the proxy.

* Expand lock files in reviews
2018-06-14 15:09:58 -07:00
Thomas Rampelberg c8b8db7461
Use native yarn cache in travis (#1124)
Use native yarn cache
2018-06-14 14:16:11 -07:00
Oliver Gould 2a4f38b9e7
proto: Use explicit `go_package` option (#1120)
protobuf has a `go_package` option that can be used to explicitly name
Go packages such that they can be imported without additional rewrites.

This allows us to store proto files without additional, redundant
directories (which were used for packaging hints, previously).

This change adds an explicit `go_package` to all .proto files and
updates `bin/protoc-go.sh` to ensure these packages are output into
$GOPATH (so that the go_package can be absolute). This removes the need
to manually rewrite imports in bin/protoc-go.sh.
2018-06-14 14:03:00 -07:00
Thomas Rampelberg 516807bde6
Add readiness/liveness checks for third party components (#1121)
* Add readiness/liveness checks for third party components

Any possible issues with the third party control plane components can wedge the services.

Take the best practices for prometheus/grafana and add them to our template. See #1116

* Update test fixtures for new output
2018-06-14 13:01:13 -07:00
Risha Mars 72415d173e
Allow webpack to compile on lint error (#1104)
Add an emitWarning to the webpack config so that webpack will compile despite lint 
errors when running in development mode. This is necessary to enable development 
on the frontend using webpack-dev-server's automatic reloading.

Also sets a NODE_ENV in travis.yml so that the build will fail if linting fails.
2018-06-14 11:26:59 -07:00