Commit Graph

202 Commits

Author SHA1 Message Date
Michael Schurter e997ae44a5 Skip checks with TLSSkipVerify if it's unsupported
Fixes #2218
2017-04-19 12:45:34 -07:00
Michael Schurter cdb7d2ebb6 Use go-version instead of manual version parsing 2017-04-19 12:42:48 -07:00
Michael Schurter 947e31e9c2 Only register HTTPS agent check when Consul>=0.7.2
Support for TLSSkipVerify in other checks coming soon!
2017-04-19 12:42:48 -07:00
Michael Schurter e204a287ed Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Alex Dadgar a1a7941dec Various fixes
This PR:
* Uses Go 1.8 executable lookup
* Stores any err message from stats init method
* Allows overriding of Cpu Compute for hosts where it can't be detected
2017-03-14 12:56:31 -07:00
Alex Dadgar 70e4feb045 Limit parallelism during garbage collection
This PR introduces a parallelism limit during garbage collection. This
is used to avoid large resource usage spikes if garbage collecting many
allocations at once.
2017-03-10 16:27:00 -08:00
Alex Dadgar 6910678c21 Allow random UUID 2017-02-27 13:42:37 -08:00
Alex Dadgar 6afcba9e22 Allow specification of eval/job gc threshold 2017-02-27 11:58:10 -08:00
Alex Dadgar 15ffdff497 Vault Client on Server handles SIGHUP
This PR allows the Vault client on the server to handle a SIGHUP. This
allows updating the Vault token and any other configuration without
downtime.
2017-02-01 14:24:10 -08:00
Diptanu Choudhury 11d7cb1230 Making the GC related fields tunable 2017-01-31 15:51:20 -08:00
Diptanu Choudhury 1999b7eebb Merge pull request #2159 from hashicorp/b-consul-config
Fixed merging consul config
2017-01-18 16:14:54 -08:00
Diptanu Choudhury e927de02d2 Moved functions to helper from structs 2017-01-18 15:55:14 -08:00
Diptanu Choudhury b1d0078db5 Filter executor log messages 2017-01-12 11:54:19 -08:00
Alex Dadgar 6a4efbf3b2 Fix TestRetryJoin 2016-11-15 15:28:21 -08:00
Michael Schurter a75e5b5803 Addresses are just addresses - no ports
Store address+port in an unexported field for ease-of-use
2016-11-09 11:49:55 -08:00
Michael Schurter 290f71f62e Restore sync/atomic use for consistency 2016-11-08 16:21:52 -08:00
Michael Schurter 1e3a2ae04d Match old error messages 2016-11-08 15:25:29 -08:00
Michael Schurter c735589f41 Choose safer default advertise address
* -dev mode defaults bind & advertise to localhost
* Normal mode defaults bind to 0.0.0.0 & advertise to the resolved
  hostname. If the hostname resolves to localhost it will refuse to
  start and advertise must be manually set.
2016-11-08 11:17:16 -08:00
Diptanu Choudhury 98bd0e2100 Disable http checks if TLS is enabled 2016-11-03 17:33:58 -07:00
Seth Vargo 4a1fa67f26
Separate agent configuration into its own pages
I apologize in advance for the rather long PR, but unfortunately there
is not an easy way to break this up into smaller chunks. This separates
the agent configuration into smaller, more consumable pieces just like
the job specification.
2016-11-02 18:30:00 -04:00
Alex Dadgar 75696f4c70 Resolve 2016-11-01 13:23:44 -07:00
Alex Dadgar 376651bcb2 Allow advertise to not specify port 2016-10-31 17:12:29 -07:00
Alex Dadgar ddf5fb82b5 Small cleanups 2016-10-27 10:51:11 -07:00
Evan Gilman 59489e4e4f Never return 0.0.0.0 as a non-bind address 2016-10-27 10:51:11 -07:00
Evan Gilman 7511490c12 Add more address selector tests 2016-10-27 10:51:11 -07:00
Evan Gilman af3de22d4f Remove old address advertise config code 2016-10-27 10:51:11 -07:00
Evan Gilman de33949df8 Add address selector methods to the agent 2016-10-27 10:51:11 -07:00
Evan Gilman 06909d2465 Use bind address for consul healtchecks in nomad client too 2016-10-27 10:47:45 -07:00
Evan Gilman c0ff732513 Use bind address for consul service checks 2016-10-27 10:47:45 -07:00
Diptanu Choudhury a051d87c5d Making the nomad agent checks tcp 2016-10-26 16:30:29 -07:00
Diptanu Choudhury 067fcda3fe Making the cli use TLS if the client has enabled TLS 2016-10-26 11:13:53 -07:00
Diptanu Choudhury cf35aeac84 Moving the TLSConfig to structs 2016-10-25 15:57:38 -07:00
Diptanu Choudhury e03927bb5c Changed the way TLS config is parsed 2016-10-24 13:56:19 -07:00
Diptanu Choudhury 2e3118e69c Implemented TLS support for http and rpc 2016-10-23 22:22:00 -07:00
Diptanu Choudhury 0f6e0d10b6 Enable serf encryption (#1791)
* Added the keygen command

* Added support for gossip encryption

* Changed the URL for keyring management

* Fixed the cli

* Added some tests

* Added tests for keyring operations

* Added a test for removal of keys

* Added some docs

* Fixed some docs

* Added general options
2016-10-17 10:48:04 -07:00
Alex Dadgar 4e8576516f Increase the timeout to be greater than the RPC hold threshold 2016-08-26 11:13:20 -07:00
Alex Dadgar 7d899b6c60 Pass Vault config to client 2016-08-17 16:23:29 -07:00
Alex Dadgar c913e4396f Add Vault config to server 2016-08-17 16:23:29 -07:00
Diptanu Choudhury 9a75052d2c Merge pull request #1518 from pubnub/feature/chroot-map-rebase
Add config field to specify chroot mapping for exec driver
2016-08-10 17:00:03 -07:00
Jay Oster 7df692226a Add config field to specify chroot mapping for exec driver
- Same format as used by the internal chroot mapping
- Map: source_path -> dest_path
- Example HCL:

client {
  chroot_env {
    "/etc" = "/etc"
    "/lib" = "/lib"
    "/opt/projects/foo/bin" = "/usr/bin"
  }
}
2016-08-03 17:17:17 -07:00
Diptanu Choudhury 41b540fbc8 Allow operators to opt into publishing node and alloc metrics 2016-08-01 19:52:20 -07:00
Wim c96f3ccb28 Use net.JoinHostPort 2016-07-25 23:34:08 +02:00
Wim a04907ad91 Fix IPv6 advertise addresses 2016-07-25 22:52:18 +02:00
Alex Dadgar f3bc85c20f use microsecond granularity 2016-06-22 15:20:56 -07:00
Alex Dadgar 9406739ba8 remove resolving client rpc addr 2016-06-17 14:55:37 -07:00
Sean Chittenden 46e2d54acf
Provide `nomad.Config` with a default `LogOutput` of `os.StdErr` 2016-06-17 06:44:10 -07:00
Sean Chittenden 9a60999100
Pass a logger arg to `NewClient` and `NewServer` 2016-06-16 23:29:23 -07:00
Sean Chittenden c2f96ee6ba
Remove the shutdownCh as an argument, it was already present in the receiver 2016-06-16 23:15:41 -07:00
Sean Chittenden e58c2a2ed4
Remove client registration of RPC services, only servers have an RPC interface 2016-06-16 18:14:59 -07:00
Sean Chittenden 2a2b35d1bc
Use `/v1/agent/servers` (vs `/v1/agent/self`). 2016-06-16 17:40:47 -07:00
Sean Chittenden 26cc057751
Automatically register service checks for HTTP, RPC, and Serf. 2016-06-16 17:34:25 -07:00
Sean Chittenden af55b74114 Merge pull request #1276 from hashicorp/f-consul-server-autojoin
Teach Nomad servers how to fall back to Consul.
2016-06-16 14:40:45 -07:00
Diptanu Choudhury 14747848f7 Removed the stats block from client configuration 2016-06-16 21:30:29 +01:00
Sean Chittenden b0fecbefc1
Define `BootstrapExepct` as an `int32` so it can be manipulated atomically. 2016-06-16 12:00:15 -07:00
Sean Chittenden f05514335b
Teach Nomad servers how to fall back to Consul. 2016-06-15 12:40:51 -07:00
Diptanu Choudhury fd80e6ed0f Added a warn message for deprecated consul options 2016-06-15 02:31:57 +02:00
Sean Chittenden 6e22b680ce
Disambiguate `auto_join` from `auto_register`, rename reg to `auto_advertise`.
Provide an option that describes the value to the user vs the
operation performed by the software.  Momentarily introducing
`auto_join`
2016-06-14 12:11:38 -07:00
Alex Dadgar 4b04e503f3 address comments 2016-06-13 17:32:18 -07:00
Alex Dadgar 8bbf4a55e5 Fix IDs and domain scoping 2016-06-13 16:30:58 -07:00
Diptanu Choudhury d019d8ef8e implemented reconciliation of unwanted services 2016-06-13 14:52:26 +02:00
Alex Dadgar 753d50f3d4 agent just calls run 2016-06-12 22:30:52 -07:00
Alex Dadgar 8e231fa382 Rename ConsulService back to Service 2016-06-12 16:36:49 -07:00
Alex Dadgar fdda90229f only support latest and remove ring buffer 2016-06-12 09:32:38 -07:00
Sean Chittenden 917766a3df
Prefer `%+q` over `%q` in log messages. 2016-06-11 18:17:20 -04:00
Sean Chittenden bbd8dfa798
goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden c92306f020
Stash client and server registration behind consul.auto_register 2016-06-10 15:54:39 -04:00
Sean Chittenden a1a0c313de
Skip nil check for agent's consulSyncer is always not nil 2016-06-10 15:54:39 -04:00
Sean Chittenden c54539b860
Initialize Consul for the Nomad Agent in a more uniform way.
Decompose Client and Server registration into `setupClient()` and
`setupServer()`, respectively.
2016-06-10 15:54:39 -04:00
Sean Chittenden d307ca2c28
Begin leveraging the Agent-level consul.Syncer 2016-06-10 15:54:39 -04:00
Sean Chittenden 8c813630e6
Move package client/consul/sync to command/agent/consul.
This has been done to allow the Server and Client to reuse the same
Syncer because the Agent may be running Client, Server, or both
simultaneously and we only want one Syncer object alive in the agent.
2016-06-10 15:54:39 -04:00
Sean Chittenden 6b126ce488
Change the API signature of Syncer.SyncServices().
SyncServices() immediately attempts to sync whatever information
the process has with Consul.  Previously this method would take an
argument of the exclusive list of services that should exist,
however this is not condusive to having a Nomad Client and Nomad
Server share the same consul.Syncer.
2016-06-10 15:54:39 -04:00
Sean Chittenden e24de53ead
Refine Nomad's Consul `port` handling.
Previously this would immediately default to '127.0.0.1' if the
config was set to `:some-port-number`.  Now it uses the BindAddr
if available.  Also, if the `port` option is set to just a port`
number (e.g. '1234'), attempt to parse the port number by itself
to allow statically configured ports to work, even when no host is
specified.
2016-06-10 15:54:39 -04:00
Sean Chittenden 555f4fe135
Change client/consul.NewSyncer() to accept a shutdown channel
In addition to the API changing, consul.Syncer can now be signaled
to shutdown via the Shutdown() method, which will call the Run()'ing
sync task to exit gracefully.
2016-06-10 15:54:39 -04:00
Sean Chittenden e2a561204a
Fix typo in comment 2016-06-10 15:50:11 -04:00
Sean Chittenden 7fe1944bc5
Fix tests for client.TestAgent_ServerConfig
Add similar logic in Agent `serverConfig()` to set up the
`serverSerfAddr` the same as `serverHttpAddr` and `serverRpcAddr`.
2016-06-10 15:50:11 -04:00
Sean Chittenden cb80e93a6b
Move client.DefaultConfig() to client/config.DefaultConfig()
Resolves an import cycle in testing and is more appropriate because
the default should reside next to its struct definition.
2016-06-10 15:50:11 -04:00
Sean Chittenden b3fd455b1f
Register the serf service with the Nomad server service.
This will be unused in this PR.
2016-06-10 15:50:11 -04:00
Sean Chittenden 6cd01d7567
Nuke a.consulConfig in favor of a.consul.Config 2016-06-10 15:50:11 -04:00
Sean Chittenden 1fe979a5e4
Remove types.ShutdownChannel and replace with `chan struct{}` 2016-06-10 15:50:11 -04:00
Sean Chittenden 9fb0104def
Teach Client to reuse an Agent's consulSyncer.
"There can be only one."
2016-06-10 15:50:11 -04:00
Sean Chittenden 47891fb559
Register two services each for clients and servers, http and rpc.
In order to give clients a fighting chance to talk to the right port,
differentiate RPC services from HTTP services by registering two
services with different tags.  This yields
`rpc.nomad-server.service.consul` and
`http.nomad-server.service.consul` which is immensely more useful to
clients attempting to bootstrap their world.
2016-06-10 15:50:11 -04:00
Sean Chittenden ac7881226c
Advertise the server's RPC endpoint, not its HTTP endpoint.
Rename c.serverRpcAddr to serverRpcAddr.  This will be broken out
into in additional set of services in a subsequent commit.
2016-06-10 15:50:11 -04:00
Sean Chittenden 10d1b6ba9b
Reduce all forms of ConsulConfig down to a single struct
nomad/structs/config/consul.go's ConsulConfig is the canonical definition
for all things Consul now.
2016-06-10 15:50:11 -04:00
Sean Chittenden 520fcb99de
Rename consulConfig to consulAgentConfig 2016-06-10 15:50:11 -04:00
Sean Chittenden e6c78274c8
Rename client/config/config's ConsulConfig to ConsulAgentConfig
A follow up commit to the previous rename.  More to come.
2016-06-10 15:50:11 -04:00
Sean Chittenden 882364f4d9
An Agent's consulSyncer is always not nil now. 2016-06-10 15:50:11 -04:00
Sean Chittenden 98cea9ba07
Revise Agent.syncAgentServicesWithConsul()'s interface
Reduce down to its lowest common helper function denominator.
2016-06-10 15:50:11 -04:00
Sean Chittenden d1442dc317
Reduce all forms of ConsulConfig down to a single struct
nomad/structs/config/consul.go's ConsulConfig is the canonical definition
for all things Consul now.
2016-06-10 15:50:11 -04:00
Sean Chittenden e60580b279
Define a type for the PeriodicCallback handlers and ShutdownChannel 2016-06-10 15:50:11 -04:00
Sean Chittenden 17116fc5a7
Rebalance Nomad client RPCs among different Nomad servers.
Implement client/rpc_proxy.RpcProxy.
2016-06-10 15:50:11 -04:00
Sean Chittenden 88f3422d7c
Rename NewConsulService to NewSyncer 2016-06-10 15:49:37 -04:00
Sean Chittenden b9789e0cf7
Rename client/consul/sync.PeriodicSync to Run 2016-06-10 15:49:37 -04:00
Sean Chittenden 768aab015d
Rename client/consul/sync.ConsulService to client/consul/sync.Syncer
Syncer describes the responsibility and actions of the type.
2016-06-10 15:49:37 -04:00
Sean Chittenden 840b49a720
Distill config.Config.ConsulConfig down to config.Config.Consul
The enclosed struct provides the necessary context
2016-06-10 15:48:36 -04:00
Sean Chittenden c7a680c28f
Rename consulConfig to consulAgentConfig 2016-06-10 15:48:36 -04:00
Sean Chittenden 73e173673e
Rename client/config/config's ConsulConfig to ConsulAgentConfig
A follow up commit to the previous rename.  More to come.
2016-06-10 15:48:36 -04:00
Sean Chittenden e97652bbfb
Rename consul.ConsulConfig to consul.AgentConfig
There were two `ConsulConfig` structs running around, one of them
needed to go away.  Rely on the package's path to provide context
for the type of AgentConfig.
2016-06-10 15:48:36 -04:00
Diptanu Choudhury c46400597e Making the stats collection interval and number of data points to keep in memory configurable 2016-05-28 19:59:20 -07:00
Diptanu Choudhury bf5b78b77e Added a test for generation of the server addr 2016-05-24 21:29:13 -07:00
Diptanu Choudhury 227477533c Using the bind addr as server's IP if advertise addr and addresses.HTTP is not specified 2016-05-24 17:27:09 -07:00