Commit Graph

752 Commits

Author SHA1 Message Date
Thomas Rampelberg d0f0eecbc8
Fix the web docker build by running yarn outside of NODE_ENV=production (#988)
As part of trying to be fancy, I moved the `setup` step into build. This breaks the docker builds because we need to run yarn *without* NODE_ENV=production and then the build *with* NODE_ENV=production (to do things like minify/compress assets).

Split apart build as something without setup and provide a default target that does setup + build for travis.
2018-05-23 10:05:27 -07:00
Thomas Rampelberg c5f0adafc8
Update babel to use `env` and `react-app` as presets. (#976)
- Switched from `es2015` to `env` for the default preset. This is the recommended preset and allows us to track the latest and greatest moving forward.
- Added `react-app` as a preset. We get class properties (and thus => for context) as well as the current recommended settings for react apps.
- Created a `web` script that provides functions for common tasks. `react-app` requires that BABEL_ENV/NODE_ENV is set and this guarantees it.
- Updated the web dockerfile to set NODE_ENV correctly and use `bin/web`.
- Moved the babel related modules over to devDependencies.
2018-05-22 17:17:44 -07:00
Oliver Gould 41d9f915ed
proxy: Alter telemetry to use discrete instants (#980)
Proxy tasks emit events to the telemetry system. These events are used
aggregate counts and latencies, as well as to inform Tap requests.
Initially, these events included durations, describing the relevant time
that elapsed between this event and another.

This approach is somewhat inflexible -- it unnecessarily constrains the
set of measurements that can computed in the telemetry system.

To remedy this, the `Event` types can be changed to report discrete
`Instant`s (rather than `Duration`s). Then, when latencies are computed
in the telemetry system, these discrete instants can be compared to
produce durations.

There are no functional changes in this PR.
2018-05-22 14:57:00 -07:00
Andrew Seigner 8a1a3b31d4
Fix non-default proxy-api port (#979)
Running `conduit install --api-port xxx` where xxx != 8086 would yield a
broken install.

Fix the install command to correctly propagate the `api-port` flag,
setting it as the serve address in the proxy-api container.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-05-22 10:34:25 -07:00
Thomas Rampelberg 55d7228959
Enable cheap source-map by default (#977)
Debugging issues in the dashboard is a little frustrating without source maps and the full source map takes awhile to build.

Just enables one of the cheaper source maps by default. It is good enough (tm) for what is there now.
2018-05-22 07:39:18 -07:00
Kevin Lingerfelt 2baeaacbc8
Remove package-scoped vars in cmd package (#975)
* Remove package-scoped vars in cmd package
* Run gofmt on all cmd package files
* Re-add missing Args setting on check command

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-05-21 18:15:39 -07:00
Eliza Weisman d256377eea
proxy: Remove configure-and-bind-to-executor pattern (#967)
A common pattern when using the old Tokio API was separating the configuration
of a task from binding it to an executor to run on. This was often necessary
when we wanted to construct a type corresponding to some task before the
reactor on which it would execute was initialized. Typically, this was 
accomplished with two separate types, one of which represented the 
configuration and exposed only a method to take a reactor `Handle` and
transform it to the other type, representing the actual task.

After we migrate to the new Tokio API in #944, executors no longer need to be
passed explictly, as we can use `DefaultExecutor::current` or 
`current_thread::TaskExecutor::current` to spawn a task on the current 
executor. Therefore, a lot of this complexity can be refactored away.

This PR refactors the `Config` and `Process` structs in
i`control::destination::background` into a single `Background` struct, and 
removes the `dns::Config` and `telemetry::MakeControl` structs (`dns::Resolver`
and `telemetry::Control` are now constructed directly). It should not cause
any functional changes.

Closes #966

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-21 15:40:33 -07:00
Risha Mars b078a27a82
Consolidate calls to /metrics to use the new resource type all (#963)
This PR modifies the Namespace page in the web UI to replace the 3 existing api calls 
with a single call.

* Consolidate calls to /metrics to use the new resource type all
* Simplify urlsForResource, add comment with assumptions
2018-05-21 10:38:49 -07:00
Eliza Weisman fb1268b4d3
proxy: Use `impl Trait` to unbox some futures (#969)
Now that `impl Trait` is stable, we don't need to box as many futures. We still
need to box before spawning them on an executor, but the component futures no 
longer require their own boxes. 

Signed-off-by: Eliza Weisman <eliza@buoyant.io
2018-05-19 13:19:05 -07:00
Risha Mars 1e6434f6de
Fix bug in the public-api where conduit stat params were ignored (#971)
* Fix bug where we were dropping parts of the StatSummaryRequest
* Add tests for prometheus query strings and for failed cases

Problem
In #928 I rewrote the stat api to handle 'all' as a resource type. To query for all resource types, 
we would copy the Resource, LabelSelector and TimeWindow of the original request, and then 
go through all the resource types and set Resource.Type for each resource we wanted to get.
The bug is that while we copy over some fields of the original request, we didn't copy over all 
of them - namely Resource.Name and the Outbound resource. So the Stat endpoint would 
ignore any --to or --from flags, and would ignore requests for a specific named resource.

Solution
Copy over all fields from the request.

I've also added tests for this case. In this process I've refactored the stat_summary_test code 
to make it a bit easier to read/use.
2018-05-18 16:06:06 -07:00
Eliza Weisman a067d3918c
proxy: Upgrade Conduit to use the new version of Tokio (#944)
Closes #888.  Closes #867.

This branch upgrades Conduit to use the new Tokio API. It was also necessary to
upgrade some other dependencies (including `hyper`, and `trust-dns`) alongside
this upgrade. 

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-17 16:38:15 -07:00
Kevin Lingerfelt 36ec391dbe
Go: update k8s dependencies to 1.10.2 (#962)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-05-17 15:46:58 -07:00
Risha Mars f6367224b9
Add a controller namespace label to the destination service endpoints (#960)
Add a the dst_conduit_io_control_plane_ns label to the destination service endpoints
2018-05-17 14:47:07 -07:00
Sean McArthur fb904f0174
proxy: rebind services on connect errors (#952)
Instead of having connect errors destroy all buffered requests,
this changes Bind to return a service that can rebind itself when
there is a connect error.

It won't try to establish the new connection itself, but waits for
the buffer to poll again. Combing this with changes in tower-buffer
to remove canceled requests from the buffer should mean that we
won't loop on connect errors for forever.

Signed-off-by: Sean McArthur <sean@seanmonstar.com>
2018-05-17 14:15:16 -07:00
Oliver Gould a1b56846b2
proxy: Drop destination resolutions when unused (#956)
A proxy dispatches requests over a constrained number of routes. When
the router's upper bound is reached---and potentially in other future
scenarios---router capacity is created by removing unused routes, their
load balancers, and all related endpoint stacks.

However, in the current regime, the controller subsystem will continue
to monitor discovery observations. As the number of active observations
expands over time, the controller task ends up with more and more work
to do.

This change introduces a shared atomic boolean between the resolution
returned to the load balancer and the state maintained when
communicating with the service. Before the controller polls its active
resolutions, it first ensures that all unused resolutions are dropped.
2018-05-16 17:28:11 -07:00
Eliza Weisman 6433ce060d
proxy: Fix end events not firing when a stream is ended by a DATA frame (#957)
A recent upstream change in `tower-h2` (tower-rs/tower-h2@d9b3140) caused some
HTTP/2 streams that were previously terminated by TRAILERS frames to be 
terminated by empty DATA frames with the end of stream bit set, instead.

This broke some tests in my dev branch for #944, as our test server also uses
`tower-h2`, and some of the metrics tests were no longer seeing the expected
`StreamResponseEnd` events due to this change. This issue may also occur in
other cases, resulting in incorrect metrics.

This PR changes `MeasuredBody::poll_data` to trigger the Stream End event if
it sees a DATA frame that ends the stream.

Fixes #954 

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-16 16:24:29 -07:00
Risha Mars 1464470487
Include path prefix in location of js asset bundle (#959)
Problem
If you navigate directly to (or do a hard refresh on) a path with more than one segment, 
e.g. http://localhost:8084/namespaces/conduit, the dashboard js is not served. 
Pages with two paths have to be accessed by loading the dashboard on a different 
path and then clicking through.

When accessing the dashboard via conduit dashboard we append a path prefix so that 
we can connect using the k8s proxy. This means that moving the dashboard to serve 
images off relative paths won't work, because we need to serve images whether the 
dashboard is loaded from http://localhost:8084/namespaces/conduit or 
from http://localhost:8084/namespaces. 

Solution
Check whether we're serving the dashboard with the proxy url, and if we are, adjust
the url at which we serve the index bundle from.
I've also added a very manual override if the conduit logo can't be found at the usual url.
2018-05-16 15:41:50 -07:00
Oliver Gould fbba6bf4c8
rfc: proxy: Split `control::discovery` into submodules (#955)
While preparing #946, I was again struck by the `discovery` module being very weighty
(nearly 800 dense lines). The intent of this change is only to improve readability. There
are no functional changes. The following aesthetic changes have been made:

* `control::discovery` has been renamed to `control::destination` to be more consistent
  with the rest of conduit's terminology (destinations aren't the only thing that need to
  be discovered).
* In that vein, the `Discovery` type has been renamed `Resolver` (since it exposes one
  function, `resolve`).
* The `Watch` type has been renamed `Resolution`. This disambiguates the type form
  `futures_watch::Watch`(which is used in the same code) and makes it more clearly the
  product of a `Resolver`.
* The `Background` and `DiscoveryWork` names were very opaque.  `Background` is now
  `background::Config` to indicate that it can't actually _do_ anything; and
  `DiscoveryWork` is now `background::Process` to indicate that it's responsible for
  processing destination updates.
* `DestinationSet` is now a private implementation detail in the `background` module.
* An internal `ResolveRequest` type replaces an unnamed tuple (now that it's used across
  files).
* `rustfmt` has been run on `background.rs` and `endpoint.rs`
2018-05-15 17:23:01 -07:00
Eliza Weisman b28193817c
proxy: Move absolute URI detection to `bind::Protocol` (#938)
This is in preparation for landing the Tokio upgrade. 

In the upcoming Hyper release, the handling of absolute form request URIs
moved from `hyper::Request` to the `hyper::client::connect::Connect` trait.
Once we upgrade to the new Tokio, we will have to upgrade our Hyper 
dependency as well.

Currently, Conduit detects whether the request URI is in absolute form in
`h1::normalize_our_view_of_uri` and adds an extension to the request if it is.
This will no longer work with the new Hyper, as that function is called from
the `bind::NormalizeUri` service, which is not constructed until after the 
client connection is established. Therefore, it is necessary to move this
information to `bind::Protocol`, so that it can be passed to 
`transparency::client::HyperConnect` (our implementation of Hyper's `Connect`
trait) when we are using the newest Hyper. 

For now, however, I've left in the `UriIsAbsoluteForm` extension and continued
to set it in  `h1::normalize_our_view_of_uri`, since we currently still use it
on the current Hyper version. I thought it was good to minimize the changes to
this existing code, as it will be removed when we migrate to the new Hyper.

This PR shouldn't cause any functional changes.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-15 13:16:58 -07:00
Risha Mars 12b520a55d
Use menu links correctly (don't repeat icon and text links) (#953)
This enables the removal of the inline-block display for links and
fixes menu items not showing up when sidebar is expanded on firefox

Problem
Previously we were linking the icon and expand text of the menu bar separately. 
This caused the clickable areas of the menus to be inconsistent, which we were 
fixing via css. This wasn't consistently displayed across browsers.

Fix
Linkify the whole Menu Item rather than linking the icon and text separately.
This enables the removal of the inline-block display for links and
fixes menu items not showing up when sidebar is expanded on firefox.
Additionally it makes the clicking of menu links way more consistent.
2018-05-14 18:11:12 -07:00
Kim Christensen bcc4f9ec94 Optimize frontend assets to improve load times (#378) (#945)
The frontend assets was not optimized, resulting in suboptimal page load times.

Enabled webpack production mode in the Dockerfile, this still allows good development
and debugging experience when running the web interface locally during development.
Also added minification of the CSS handled by css-loader.

The web interface still works as expected.
The size of the JS file has been reduced from 3.6 MB to 1.2 MB.
And the CSS minification has resulted in sidebar.css from 5.71 kB to 4.33 kb,
and styles.css from 4.18 kB to 3.1 kB.

Fixes #378

Signed-off-by: Kim Christensen <kimworking@gmail.com>
2018-05-14 16:16:23 -07:00
Carl Lerche d24a3410d8
Proxy: Update h2 dependency. (#948)
This also updates `bytes` as the newest version is required by `h2`.

Signed-off-by: Carl Lerche <me@carllerche.com>
2018-05-14 11:23:25 -07:00
Oliver Gould 1ed3f2ed85
docs: Remove reference to #155 in docs (#947)
The Adding Your Service guide incorrectly references #155, which has
been resolved.  Remove it.
2018-05-14 11:22:50 -07:00
Eliza Weisman fac845bdcd
proxy: Add a lazy version of ThreadRng (#936)
This is in preparation for landing the Tokio upgrade. 

In order to be generic over Tokio's current thread and threadpool executors,
a number of types in Conduit which were not previously `Send` are now required
to be `Send`. A majority of this work will be done in the main Tokio upgrade
PR, as it is in many cases not possible to make these types `Send` _without_
using the new Tokio API (in order to remove `Handle`s, etc.); however, I'm
factoring out everything possible and trying to land it in separate PRs.

The p2c load balancer constructed in `Outbound` is currently parameterized
over a random number generator. We currently construct it by getting the 
thread-local RNG, and passing it to the load balancer constructor. However,
the thread-local RNG is not `Send`. I've fixed this issue by creating a new
zero-sized empty struct type which implements `rand::Rng` simply by calling
`thread_rng()` every time its' called, and passing that to 
`choose::power_of_two_choices` instead. Since this is an empty type which 
contains no data, and the correct thread-local RNG is accessed whenever
the methods are called, this new type can trivially be `Send`. According to
the `rand` crate's documentation, this is the correct way to use `ThreadRng`
anyway:
> Retrieve the lazily-initialized thread-local random number generator, seeded
> by the system. Intended to be used in method chaining style, e.g. 
> `thread_rng().gen::<i32>()`.
> (from https://docs.rs/rand/0.4.2/rand/fn.thread_rng.html)

This shouldn't lead to any functional changes.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-11 17:26:23 -07:00
Eliza Weisman f3cd0c4f27
proxy: Make `outbound_updates_newer_services` test forward-compatible (#939)
This is in preparation for landing the Tokio upgrade.

The test `discovery::outbound_updates_newer_services` currently contains an
assertion that an HTTP/2 request to an HTTP/1 service will return a response
with status code 500. This is because the current version of Hyper on which
Conduit depends does not support protocol upgrades.

However, commit hyperium/hyper@bc6af88a32, which
adds support for this kind of protocol upgrade, was recently merged to Hyper's
master branch. Therefore, this assertion will no longer be correct once we 
depend on the upcoming Hyper release. When we migrate to the new Tokio, it will
be necessary to upgrade our Hyper dependency as well, and this test will fail.

I've modified the test to no longer make assertions about the response's status
code, so that it's compatible with both the current and future Hyper versions.
If the response is not `Ok`, the test will still fail, since 
`tests::support::Client::request()` `expect`s that the response is successful,
but the status code is ignored. I've added a comment in the test explaining 
this.

Eventually, when the master version of Conduit depends on the latest Hyper, we
may want to change this test to assert that the status code is 200 instead. We
may also want to add more tests for Hyper's protocol upgrade functionality, but
that seems out of scope for this PR.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-05-11 14:36:03 -07:00
Risha Mars b8dc83f9d2
Modify the Stat API to handle requests for resource type "all" (#928)
Allow the Stat endpoint in the public-api to accept requests for resourceType "all".

Currently, this queries Pods, Deployments, RCs and Services, but can be modified 
to query other resources as well.

Both the CLI and web endpoints now work if you set resourceType to all.

e.g. `conduit stat all`
2018-05-11 14:35:37 -07:00
Oliver Gould 319088bd70
proxy: Update to Rust 1.26.0 (#942)
Notably, this adds support for `impl Trait`.

More info at https://blog.rust-lang.org/2018/05/10/Rust-1.26.html
2018-05-11 13:52:56 -07:00
Kevin Lingerfelt 4e8e1eb84d
CLI: Fix validation for service stats (#935)
* CLI: Fix validation for service stats
* Address review feedback

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-05-11 10:28:49 -07:00
Oliver Gould e91699bba2
proxy/router: Implement LRU cache eviction (#925)
The router's cache has no means to evict unused entries when capacity is
reached.

This change does the following:

- Wraps cache values in a smart pointer that tracks the last time of
  access for each entry. The smart pointer updates the access time when
  the reference to entry is dropped.
- When capacity is not available, all nodes that have not been accessed
  within some minimal idle age are dropped.

Accesses and updates to the map are O(1) when capacity is available.
Reclaiming capacity is O(n), so it's expected that the router is
configured with enough capacity such that capacity need not be reclaimed
usually.
2018-05-10 19:06:31 -07:00
Risha Mars 8cf5f45a58
Upgrade React to 16.3.2 (#927) 2018-05-10 15:15:29 -07:00
Risha Mars 1eb9e15f4a
Start polling for new resource type immediately after switching tabs (#926)
* Fix issue where we were waiting for the next polling interval when switching tabs

Fix issue where we were waiting for the next polling interval when switching tabs.
When we switch tabs, we update the Props of the ResourceList component, but we weren't
resetting how we poll the server. This meant we'd wait until the end of the current polling interval
(2s) to get the data for the tab we just switched to.

I've added stopServerPolling and startServerPolling methods so that we can cancel the resource
requests of the page we're leaving and immediately start polling for new data if the resource type
changes.
2018-05-10 15:14:59 -07:00
Oliver Gould 27345a6d2f
proxy/router: Create a separate `cache` module (#920)
The router's `Inner` type contains a map of routes. Recently, this map's
capacity has become constrained to prevent leakage for long-running
processes.

This change prepares for a fuller LRU implementation by moving the
router's `Inner` type to a new (tested) module, `cache`.
2018-05-10 14:00:50 -07:00
Oliver Gould 77c1aeae79
Fix syntax of travis.yml (#932)
PR #891 introduced a change that broke the formatting of .travis.yml for
docker deployments.

This change resolves it.

Fixes #931
2018-05-10 13:57:58 -07:00
Oliver Gould 2019747ff8
router: Store `recognize` outside of lock (#913)
The router stores its cache and `Recognize` implementation within a `Mutex`,
but there is no need for the recognizer to be locked.

This change creates a new `Cache` type that is locked independently of
`Recognize`. In order to accomplish this, `Recognize::bind_service` has
been changed to take an immutable reference to its `self`.

The (unused) `Single` type has been removed because it relied on
`bind_service` being mutable.
2018-05-10 11:51:01 -07:00
Oliver Gould a786089fd6
docker: Cache versionless builds before building versioned go binaries (#921)
The way that git-related version information is linked into go binaries
busts Docker's cache such that every commit causes all binaries to
rebuilt.

In order to ameliorate this, we can build each binary once without
version information first so that its artifacts are cached. When Go
sources are not changed and only the version information changes, builds
are 4.3x faster than before (from 5+ minutes to <90s).

On `master`

Branch off of master and build (mostly cached):

```
:; time DOCKER_TRACE=1 bin/docker-build
...
DOCKER_TRACE=1 bin/docker-build  9.10s user 6.30s system 5% cpu 4:26.47 total
```

Rebuild without changing anything (highly cached):

```
:; time DOCKER_TRACE=1 bin/docker-build
...
DOCKER_TRACE=1 bin/docker-build  9.23s user 6.04s system 47% cpu 32.017 total
```

Update only the git sha and rebuild:

```
:; git ci -am 'bump it' --allow-empty
[ver/eg 2749eb3] bump it
:; time DOCKER_TRACE=1 bin/docker-build
...
DOCKER_TRACE=1 bin/docker-build  8.55s user 6.08s system 4% cpu 5:22.25 total
```

On this branch:

Rebuild without changing anything (highly cached):

```
:; time DOCKER_TRACE=1 bin/docker-build
...
DOCKER_TRACE=1 bin/docker-build  8.94s user 5.97s system 46% cpu 32.257 total
```

Update only the git sha and rebuild:

```
:; git ci -am 'bump it' --allow-empty
[ver/go-docker-cache-versionless 77a80b5] bump it
:; time DOCKER_TRACE=1 bin/docker-build
...
DOCKER_TRACE=1 bin/docker-build-cli-bin  2.02s user 1.34s system 9% cpu 34.144 total
```
2018-05-10 10:22:09 -07:00
Thomas Rampelberg 25d8b22b5c
Adding statefulsets to inject. Fixes #907 (#910) 2018-05-10 09:00:36 -05:00
Thomas Rampelberg e96c2e1135
Made inject aware of the List type. (#886) 2018-05-10 08:08:55 -05:00
Oliver Gould 76ca32297e
proxy: Remove try_bind_route! macro (#915)
The macro is now only used once, so it seems clearer just to inline the
logic.
2018-05-09 14:38:20 -07:00
Risha Mars 0431193e94
Indicate failed pods in ServiceMesh page (#914)
* Turn the status bars red if there exist failed pods in the namespace
* Also use failed pods in conduit component table

Now that the API returns the number of failed pods, use this info to indicate failed pods in 
the ServiceMesh page. 
The bars will turn red if there are any failed pods present in the namespace. 
They'll be green if they have non-zero pods meshed, and grey otherwise.
2018-05-09 10:22:45 -07:00
Oliver Gould e5ad5de975
Reuse the proxy's build stage across CI runs (#891)
The proxy's Dockerfile is split into stages: build and runtime.
The build stage includes all of the intermdiate build information, and
the runtime image discards these layers with a small production-ready
image.

In order to improve docker build times, we can save this build layer to
be reused.

This reduces the docker build of the proxy in CI from 15 minutes to
about 7.5 minutes (when the proxy is not changed).
2018-05-09 09:11:58 -07:00
Sean McArthur b48a26b0b7
proxy: change peek to use reads for eventual support of TLS (#901) 2018-05-08 18:19:12 -07:00
Oliver Gould 8bedd9d38a
rfc: Make DestinationServiceQuery generic (#749)
The goals of this change are:
1. Reduce the size/complexity of `control::discovery` in order to ease code reviews.
2. Extract a reusable grpc streaming utility.

There are no intended functional changes.

`control::discovery::DestinationServiceQuery` is used to track the state of a request (and
streaming response) to the destination service. Very little of this logic is specific to
the destination service.

The `DestinationServiceQuery` and associated `UpdateRx` type have been moved to a new
module, `control::remote_stream`, as `Remote` and `Receiver`, respectively. Both of these
types are generic over the gRPC message type, so it will be possible to use this utility
with additional API endpoints.

The `Receiver::poll` implementation has been simplified to be more idiomatic with the rest
of our code (namely, using `try_ready!`).
2018-05-08 16:54:20 -07:00
Andrew Seigner 1275b1ae89
Introduce Grafana, K8s, and Prom dashboards (#904)
Grafana provides default dashboards for Prometheus and Grafana health.
The community also provides Kubernetes-specific dashboards. Conduit was
not taking advantage of these.

Introduce new Grafana dashboards focused on Grafana, Kubernetes, and
Prometheus health. Tag all Conduit dashboards for easier UI navigation.
Also fix layout in Conduit Health dashboard.

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-05-08 23:11:43 +02:00
Risha Mars 1b0f269a43
Add per namespace pages that show all resource stats for a namespace (#893)
Add namespaces as a top level resource in the Web UI

This PR does the following:
- Replace the deployments table in the service mesh page with namespaces
- Add a Namespaces index page that lists all namespaces and their stats
- Add an individual namespace page showing all resources for that namespace
- Make the incomplete mesh message more generic to any resource type
- Revamp rest of service mesh page to move off ListPods
2018-05-08 14:05:16 -07:00
Oliver Gould 63fbbd6931
proxy: Parse units with duration configurations (#909)
Configuration values that take durations are currently specified as
time values with no units.  So `600` may mean 600ms in some contexts and
10 minutes in others.

In order to avoid this problem, this change now requires that
configurations provide explicit units for time values such as '600ms' or
10 minutes'.

Fixes #27.
2018-05-08 13:54:12 -07:00
Risha Mars 416381cdfd
Fix bug where GetPodsFor(pod) was returning all pods in a namespace (#900)
* Fix bug where GetPodsFor(pod) was returning all pods in a namespace

Problem
In lister.GetPodsFor, when the input object was a pod, we would return all the pods in the namespace. I would expect GetPodsFor(pod) to return only one pod - the pod itself.

Cause
The cause of this is that when the object type was pod we were setting the selector to selector = labels.Everything() which gets all the pods in the namespace.

Fix
Special case GetPodsFor(pod) to return the pod itself, rather than looking up pods via labels.
2018-05-08 13:52:49 -07:00
Risha Mars 0f7d98067d
Make the sidebar icon based and collapsed by default (#897)
Make the sidebar icon based and collapsed by default

I had to move the call to version check into the sidebar component, indicator 
when the sidebar was minimized if there was a conduit update.

Currently I just have letters representing the icons for Deployments, RCs and Pods, 
but we can change this in the future.
2018-05-08 12:30:05 -07:00
Oliver Gould 68e203a2fc
proxy: Use Duration types for config defaults (#906)
It's easy to misconfigure default durations, since they're recorded as
integers and converted to Durations separately.

Now, all default constants that represent durations use const `Duration`
instances (enabled by a recent Rust release).

This fixes #905 which was caused by using the wrong time unit for the
metrics retain time.
2018-05-08 10:58:22 -07:00
Oliver Gould f4dba72cc3
proxy: Track SingleUse services against router capacity (#902)
PR #898 introduces capacity limits to the balancer. However, because the
router supports "single-use" routes--routes that are bound only for the
life of a single HTTP1 request--it is easy for a router to exceed its
configured capacity.

In order to fix this, the `Reuse` type is removed from the router
library so that _all_ routes are considered cacheable. It's now the
responsibility of the bound service to enforce policies with regards to
client retention.

Routes were not added to the cache when the service could not be used to
process more than a single request. Now, `Bind` wraps its returned
services (via the `Binding` type), that dictate whether a single client
is reused or if one is bound for each request.

This enables all routes to be cached without changing behavior with
regards to connection reuse.
2018-05-08 10:57:56 -07:00
Risha Mars f94856e489
Modify the Stat endpoint to also return the number of failed conduit pods (#895)
* Modify the Stat endpoint to also return the count of failed pods
* Add comments explaining pod count stats
* Rename total pod count to running pod count

This is to support the service mesh overview page, as I'd like to include an indicator of
failed pods there.
2018-05-08 10:35:21 -07:00