Commit Graph

9064 Commits

Author SHA1 Message Date
Paul Banks 1909a95118 xDS Server Implementation (#4731)
* Vendor updates for gRPC and xDS server

* xDS server implementation for serving Envoy as a Connect proxy

* Address initial review comments

* consistent envoy package aliases; typos fixed; override TLS and authz for custom listeners

* Moar Typos

* Moar typos
2018-10-10 16:55:34 +01:00
Paul Banks 8336b5e6b9 XDS Server Config (#4730)
* Config for the coming XDS server

* Default gRPC to 8502 for -dev mode; Re-merge the command Info output that shows gRPC.
2018-10-10 16:55:34 +01:00
Paul Banks 0f27ffd163 Proxy Config Manager (#4729)
* Proxy Config Manager

This component watches for local state changes on the agent and ensures that each service registered locally with Kind == connect-proxy has it's state being actively populated in the cache.

This serves two purposes:
 1. For the built-in proxy, it ensures that the state needed to accept connections is available in RAM shortly after registration and likely before the proxy actually starts accepting traffic.
 2. For (future - next PR) xDS server and other possible future proxies that require _push_ based config discovery, this provides a mechanism to subscribe and be notified about updates to a proxy instance's config including upstream service discovery results.

* Address review comments

* Better comments; Better delivery of latest snapshot for slow watchers; Embed Config

* Comment typos

* Add upstream Stringer for funsies
2018-10-10 16:55:34 +01:00
Paul Banks 96b9b95a19 Add cache.Notify to abstract watching for cache updates for types that support blocking semantics. (#4695) 2018-10-10 16:55:34 +01:00
Paul Banks e812f5516a Add -sidecar-for and new /agent/service/:service_id endpoint (#4691)
- A new endpoint `/v1/agent/service/:service_id` which is a generic way to look up the service for a single instance. The primary value here is that it:
   - **supports hash-based blocking** and so;
   - **replaces `/agent/connect/proxy/:proxy_id`** as the mechanism the built-in proxy uses to read its config.
   - It's not proxy specific and so works for any service.
   - It has a temporary shim to call through to the existing endpoint to preserve current managed proxy config defaulting behaviour until that is removed entirely (tested).
 - The built-in proxy now uses the new endpoint exclusively for it's config
 - The built-in proxy now has a `-sidecar-for` flag that allows the service ID of the _target_ service to be specified, on the condition that there is exactly one "sidecar" proxy (that is one that has `Proxy.DestinationServiceID` set) for the service registered.
 - Several fixes for edge cases for SidecarService
 - A fix for `Alias` checks - when running locally they didn't update their state until some external thing updated the target. If the target service has no checks registered as below, then the alias never made it past critical.
2018-10-10 16:55:34 +01:00
Paul Banks 1e7eace066 Add SidecarService Syntax sugar to Service Definition (#4686)
* Added new Config for SidecarService in ServiceDefinitions.

* WIP: all the code needed for SidecarService is written... none of it is tested other than config :). Need API updates too.

* Test coverage for the new sidecarServiceFromNodeService method.

* Test API registratrion with SidecarService

* Recursive Key Translation 🤦

* Add tests for nested sidecar defintion arrays to ensure they are translated correctly

* Use dedicated internal state rather than Service Meta for tracking sidecars for deregistration.

Add tests for deregistration.

* API struct for agent register. No other endpoint should be affected yet.

* Additional test cases to cover updates to API registrations
2018-10-10 16:55:34 +01:00
Paul Banks b83bbf248c Add Proxy Upstreams to Service Definition (#4639)
* Refactor Service Definition ProxyDestination.

This includes:
 - Refactoring all internal structs used
 - Updated tests for both deprecated and new input for:
   - Agent Services endpoint response
   - Agent Service endpoint response
   - Agent Register endpoint
     - Unmanaged deprecated field
     - Unmanaged new fields
     - Managed deprecated upstreams
     - Managed new
   - Catalog Register
     - Unmanaged deprecated field
     - Unmanaged new fields
     - Managed deprecated upstreams
     - Managed new
   - Catalog Services endpoint response
   - Catalog Node endpoint response
   - Catalog Service endpoint response
 - Updated API tests for all of the above too (both deprecated and new forms of register)

TODO:
 - config package changes for on-disk service definitions
 - proxy config endpoint
 - built-in proxy support for new fields

* Agent proxy config endpoint updated with upstreams

* Config file changes for upstreams.

* Add upstream opaque config and update all tests to ensure it works everywhere.

* Built in proxy working with new Upstreams config

* Command fixes and deprecations

* Fix key translation, upstream type defaults and a spate of other subtele bugs found with ned to end test scripts...

TODO: tests still failing on one case that needs a fix. I think it's key translation for upstreams nested in Managed proxy struct.

* Fix translated keys in API registration.
≈

* Fixes from docs
 - omit some empty undocumented fields in API
 - Bring back ServiceProxyDestination in Catalog responses to not break backwards compat - this was removed assuming it was only used internally.

* Documentation updates for Upstreams in service definition

* Fixes for tests broken by many refactors.

* Enable travis on f-connect branch in this branch too.

* Add consistent Deprecation comments to ProxyDestination uses

* Update version number on deprecation notices, and correct upstream datacenter field with explanation in docs
2018-10-10 16:55:34 +01:00
Paul Banks b06ddc9187 Rename proxy package (re-run of #4550) (#4638)
* Rename agent/proxy package to reflect that it is limited to managed proxy processes

Rationale: we have several other components of the agent that relate to Connect proxies for example the ProxyConfigManager component needed for Envoy work. Those things are pretty separate from the focus of this package so far which is only concerned with managing external proxy processes so it's nota good fit to put code for that in here, yet there is a naming clash if we have other packages related to proxy functionality that are not in the `agent/proxy` package.

Happy to bikeshed the name. I started by calling it `managedproxy` but `managedproxy.Manager` is especially unpleasant. `proxyprocess` seems good in that it's more specific about purpose but less clearly connected with the concept of "managed proxies". The names in use are cleaner though e.g. `proxyprocess.Manager`.

This rename was completed automatically using golang.org/x/tools/cmd/gomvpkg.

Depends on #4541

* Fix missed windows tagged files
2018-10-10 16:55:34 +01:00
Paul Banks 88388d760d Support Agent Caching for Service Discovery Results (#4541)
* Add cache types for catalog/services and health/services and basic test that caching works

* Support non-blocking cache types with Cache-Control semantics.

* Update API docs to include caching info for every endpoint.

* Comment updates per PR feedback.

* Add note on caching to the 10,000 foot view on the architecture page to make the new data path more clear.

* Document prepared query staleness quirk and force all background requests to AllowStale so we can spread service discovery load across servers.
2018-10-10 16:55:34 +01:00
Mitchell Hashimoto 87e37ac758
Merge pull request #4766 from hashicorp/f-connect-inject
website: add docs for the Connect injection
2018-10-10 08:23:56 -07:00
Matt Ho 59f9d5ccd1 website: fix typo in connect example (#4774) 2018-10-10 11:01:57 +02:00
Mitchell Hashimoto 1b02b9e3c1
website: address PR feedback 2018-10-09 09:30:37 -07:00
Hannah Oppenheimer 6b487f80ff Clarify enable_tag_override explanation
In designing a potential UI for a configuration of `enable_tag_override`,
I found the documentation confusing and lengthy. Here, I've made an
attempt at re-writing this section to be more concise and clear.

I also made a few small changes to the organization of this file to map
explanations to the order of the properties listing at the top. I find
it easier to scan docs when explanations appear in the same order they
are listed at the top. For explanations that span multiple paragraphs, I
provided a subheading, which also helps in linking from other pages.

Finally, I removed a duplicated paragraph from the documentation.
2018-10-09 09:55:44 -05:00
Hans Hasselberg f924ef855c
Update CHANGELOG.md 2018-10-09 10:42:56 +02:00
Igal Shprincis e1fe3af37f watch: don't set TLSConfig.Address explicitly (#4727)
Don't set the value of TLSConfig.Address explicitly.

This will make sure env vars like CONSUL_TLS_SERVER_NAME are taken into account for the connection. Fixes #4718.
2018-10-08 22:01:17 +02:00
Mitchell Hashimoto a4abd8dd76
website: note that env vars are set 2018-10-08 09:55:55 -07:00
John Cowen 8ba1c549a9
ui: Move the text encoding polyfill to a a proper detecting polyfill (#4767) 2018-10-08 17:47:44 +01:00
Mitchell Hashimoto fd46c6d7ce
website: address some PR feedback 2018-10-08 08:24:25 -07:00
Mitchell Hashimoto a3adf47bfb
website: add docs for the Connect injection 2018-10-07 23:47:08 -07:00
Dan Brown 26c94764b8 Fix retry_join config documentation (#4757)
'retry_join': source data must be an array or slice, got string
2018-10-05 14:16:02 -04:00
Matt Keeler 217a1f8840
Update the snapshot agent documentation(#4758)
Detail the S3 permissions required in addition to a gotcha regarding having part of the key within the S3 bucket name configuration.
2018-10-05 13:55:06 -04:00
Chris Hoffman 07093a4d44 typo: missing space 2018-10-05 11:33:28 -05:00
Freddy 23064759c8 Contribution guide (#4704)
* Add a contribution guide and link to it from readme

* Add first pass at testing section for contribution guide

* Format as in README.md

* Add responding to community questions as way to contribute
2018-10-05 09:06:40 -07:00
Freddy 95c7098848 Update semaphore guide (#4661)
* Fill in gaps in semaphore guide
* Update to match that values come back b64 encoded
* Add that the value needs to be decoded
* Remove outdated reference to session1
* Fix some typos
* Clarify what is mean by a session having an active key
* Clarify requirements for lock holders in semaphore guide
2018-10-04 12:06:53 -10:00
danielehc b95a6d16db Update options.html.md (#4753) 2018-10-04 19:28:26 +01:00
R.B. Boyer 8c76f12224
docs: correct link to top level agent package (#4750)
Fixes #4749
2018-10-04 09:15:55 -05:00
Paul Banks e8ba527f23
Add a Close method to cache that stops background goroutines. (#4746)
In a real agent the `cache` instance is alive until the agent shuts down so this is not a real leak in production, however in out test suite, every testAgent that is started and stops leaks goroutines that never get cleaned up which accumulate consuming CPU and memory through subsequent test in the `agent` package which doesn't help our test flakiness.

This adds a Close method that doesn't invalidate or clean up the cache, and still allows concurrent blocking queries to run (for up to 10 mins which might still affect tests). But at least it doesn't maintain them forever with background refresh and an expiry watcher routine.

It would be nice to cancel any outstanding blocking requests as well when we close but that requires much more invasive surgery right into our RPC protocol since we don't have a way to cancel requests currently.

Unscientifically this seems to make tests pass a bit quicker and more reliably locally but I can't really be sure of that!
2018-10-04 11:27:11 +01:00
Pierre Souchay 27729208e6 Enable compilation with Go 1.11 on Travis to avoid unstable tests (#4496)
* Enable compilation with Go 1.10 on Travis

There a minor compilation differences between Go 1.10 and 1.x
which is currently Go 1.11 beta.x such as new compilation
warnings.

It will show more obviously the errors in Travus when error
is linked for instance to a new compilation warning

* Compile only for Go 1.10 as requested by @pearkes

* Switch to golang 1.11 as requested by @pearkes
2018-10-03 14:49:48 -07:00
Paul O'Connor 6b7f03911e Fix prometheus error message (#4745) 2018-10-03 14:47:56 -07:00
Dan Brown d3b6750c3b Add Deployment Guide and update links (#4487)
* Adds Deployment Guide and update links
* Fixes releases link
* Re-organisation of content
* Cuts down "deployment" doc (which should focus on Reference Architecture) by moving raft and performance tuning to the Server Performance page which already covers some of this.
* Moves backups from "deployment" doc (which should focus on Reference Architecture) to "deployment-guide"
* Cleans up some notes and add single DC diagram
* Removes old link to deployment guide from nav
* Corrects minor styling, formatting, and grammar
2018-10-03 11:37:36 -10:00
John Cowen 9da8ad8f3d
UI: Package upgrades (#4740)
Upgrade all patch and minor upgradeable packages, also uses `only`
in ember-cli-build to reduce the included helpers from certain helper
packages.

Make some major version upgrades for some dev tools

- husky
- lint-staged
- ember-cli-yadda
- ember-cli-sass (also moved from node-sass to dart-sass)

Minor tweak: spotted css file (instead of scss file), rename

The move to `dart-sass`:

dart-sass has been the primary implementation of sass for ~6 months and
will receive updates earlier than libsass (ruby-sass itself is now deprecated)

Other benefits include not having to recompile (via `npm rebuild` or similar)
when switching platforms and an 'almost' javascript based solution.

This update also alters some media queries that, whilst wouldn't compile
anymore with either an updated libsass or dart-sass, where probably a
little over complicated anyway, I've therefore made them similar to
other breakpoints that made sense.
2018-10-03 09:54:07 +01:00
R.B. Boyer 0e8d6d7bd4
Update CHANGELOG.md 2018-10-02 16:00:58 -05:00
R.B. Boyer 491826ddbc
cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands (#4737)
cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands on unix

This also removes the signal handler for SIGKILL as it's impossible to receive these signals.
2018-10-02 15:57:21 -05:00
Mitchell Hashimoto 69cdab0d84
command/services: just add additional output feedback on success 2018-10-02 12:48:46 -07:00
Mitchell Hashimoto 935d13ec21
update CHANGELOG 2018-10-02 12:46:49 -07:00
Mitchell Hashimoto 868cb6d84f
Merge pull request #4732 from hashicorp/f-service-cli
cli: add `services register` and  `deregister`
2018-10-02 12:45:58 -07:00
Mitchell Hashimoto 657682def9
command/services: add test to ensure that dev mode introduces no
services
2018-10-02 12:45:00 -07:00
Mitchell Hashimoto f6810d52bb
Merge pull request #4733 from hashicorp/b-kube-docs
website: clarify that downward API works in any pod spec
2018-10-01 10:49:04 -07:00
Mitchell Hashimoto bd6ec230c3
website: clarify that downward API works in any pod spec 2018-10-01 10:35:09 -07:00
Mitchell Hashimoto 3cf2b9e361
website: docs for services CLI 2018-10-01 10:27:15 -07:00
Mitchell Hashimoto e00c40b4f5
command: register new commands 2018-10-01 09:17:36 -07:00
Mitchell Hashimoto bf83309124
command/services/register: flag-based registration 2018-10-01 09:16:14 -07:00
Mitchell Hashimoto 939708138f
command/services/deregister: tests for flag validation 2018-10-01 08:55:32 -07:00
Mitchell Hashimoto 3425f123ef
command/services/deregister: -id flag for deletion 2018-10-01 08:53:30 -07:00
Mitchell Hashimoto 2f97a618dc
command/services/deregister: basics working from file 2018-10-01 08:39:27 -07:00
Mitchell Hashimoto 4b887d6dda
command/services: move the config helpers to parent package 2018-10-01 08:27:59 -07:00
Mitchell Hashimoto 1e7d038b37
command/services/register: registration from files work 2018-10-01 08:05:57 -07:00
John Cowen 99c51c9f86
UI: Reduce in-development deprecations (also use toLocaleString) (#4677)
Various ember addons produced deprecation messages, some in the browser
console and some in terminal. Upgrading and replacing some of these has
reduced this.

Upgrades:

- ember-collection
- ember-computed-style

Replacements:

- ember-pluralize replaced with ember-inflector
- ember-cli-format-number replaced with custom helper using standard
`toLocaleString`

Removing ember-cli-format-number also meant some further changes related
to decimal places in the tomography graph, done using `toFixed`

The ExternalSources background-images have also now been escaped
correctly preventing in-development `console` warnings.

The only deprecation warnings are now from ember-block-slots, only in
terminal, making for a better development experience overall, especially now we
have an empty browser console

Also adds a `callIfType` 'helper util' which is a util specifically for helpers (it conforms to a helper argument signature) to be expanded upon later.
2018-10-01 13:42:42 +01:00
Mitchell Hashimoto 0fbaa18ed3
command/services/register: config mapping tests 2018-09-30 19:17:45 -07:00
Mitchell Hashimoto 3237047e72
vendor: update mapstructure to v1.1.0
We require this change to support struct to struct decoding.
2018-09-30 19:15:40 -07:00