Commit Graph

1024 Commits

Author SHA1 Message Date
Diptanu Choudhury 88d383c47f Updated tests and comments 2016-08-04 11:29:36 -07:00
Diptanu Choudhury 5d3a2ac1e5 Sorting the job summaries while displaying 2016-08-04 10:42:53 -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 74caed0c7a Added an endpoint for users to reconcile job summaries 2016-08-03 16:12:47 -07:00
Alex Dadgar 7b64adfcdd Merge pull request #1502 from hashicorp/f-plan-exit-code
Plan exit code map to whether allocations would change + bug fix
2016-08-03 11:10:21 -07:00
Alex Dadgar 91db768430 Fix tests 2016-08-03 11:09:50 -07:00
Alex Dadgar e474ea7cce plan returns appropriate exit code 2016-08-01 20:07:49 -07:00
Diptanu Choudhury 41b540fbc8 Allow operators to opt into publishing node and alloc metrics 2016-08-01 19:52:20 -07:00
Kenjiro Nakayama 5edffb6025 Add validation of -n and -c options 2016-08-01 21:51:13 +09:00
Alex Dadgar ef47612606 api.fs uses the api.Client rather than making raw requests 2016-07-28 14:27:17 -07:00
Kenjiro Nakayama 224ebc0129 Add LevelFilter test 2016-07-27 13:42:24 +09:00
Diptanu Choudhury cfd35f5ad4 Merge pull request #1455 from hashicorp/f-job-summary
Job Summary - Part 2
2016-07-26 16:08:37 -07:00
Alex Dadgar 6087e8e47a Merge pull request #1466 from hashicorp/d-logs
Document logs command and API
2016-07-26 09:41:58 -07:00
Kenjiro Nakayama faf33152e0 Add TestFSCommand_Fails to fs command 2016-07-26 22:45:09 +09:00
Diptanu Choudhury cc37ec33cf Renamed Job.GetJobSummary to Job.Summary 2016-07-25 17:31:40 -07:00
Diptanu Choudhury 6193529040 Fixed more tests 2016-07-25 17:31:40 -07:00
Diptanu Choudhury 50842b88c7 Fixed some bugs 2016-07-25 17:26:38 -07:00
Diptanu Choudhury 52ff7935a3 Displaying the job summary in nomad status command 2016-07-25 17:26:38 -07:00
Diptanu Choudhury a5bb0ca6fc Moved the job endpoint around 2016-07-25 17:26:38 -07:00
Diptanu Choudhury 2ff2acbfc0 Added the job summary related endpoints 2016-07-25 17:26:38 -07:00
Alex Dadgar aa0c347450 remove unused file 2016-07-25 16:24:28 -07:00
Alex Dadgar 5a5d8f4ae3 Merge pull request #1465 from 42wim/ipv6-1318
Fix IPv6 advertise addresses
2016-07-25 16:14:15 -07:00
Wim c96f3ccb28 Use net.JoinHostPort 2016-07-25 23:34:08 +02:00
Diptanu Choudhury 471416ab20 Removing un-wanted dependencies 2016-07-25 14:17:52 -07:00
Wim a04907ad91 Fix IPv6 advertise addresses 2016-07-25 22:52:18 +02:00
Alex Dadgar fcb21177dd logs command docs 2016-07-25 13:08:39 -07:00
Alex Dadgar b8817e4877 better flush and connection closed handling 2016-07-25 11:16:54 -07:00
Alex Dadgar 43d78b6d23 control-c works 2016-07-25 11:16:54 -07:00
Alex Dadgar aee152ee15 small fixes 2016-07-25 11:16:54 -07:00
Alex Dadgar 6e15bdbe36 Add logs command test 2016-07-25 11:16:54 -07:00
Alex Dadgar 1f600252e7 Handle skipping indexes 2016-07-25 11:16:54 -07:00
Alex Dadgar 120e9d14ee log tests 2016-07-25 11:16:54 -07:00
Alex Dadgar 85cc520365 Support non-following logs 2016-07-25 11:16:54 -07:00
Alex Dadgar 3b85fdd09c Look up the tasks automatically 2016-07-25 11:16:54 -07:00
Alex Dadgar 8b819a343a fix indents 2016-07-25 11:16:54 -07:00
Alex Dadgar c808f2eefa remove file events and last offset 2016-07-25 11:16:01 -07:00
Alex Dadgar 605dd5cef9 unblock the readers to add liveness when using -n 2016-07-25 11:16:01 -07:00
Alex Dadgar b55e986c9f Read from correct offset 2016-07-25 11:16:01 -07:00
Alex Dadgar c84964bf6e Fix buffer reuse 2016-07-25 11:16:01 -07:00
Alex Dadgar 0327109300 tests 2016-07-25 11:16:01 -07:00
Alex Dadgar b2df901158 initial api and command 2016-07-25 11:16:01 -07:00
Alex Dadgar 3ea95bb91c initial log api impl 2016-07-25 11:16:01 -07:00
Alex Dadgar bf2259a24d Merge pull request #1458 from nak3/plan-stdin
Support nomad plan to take jobfile from stdin
2016-07-25 11:13:09 -07:00
Kenjiro Nakayama 64db388af2 Support nomad plan to take jobfile from stdin 2016-07-23 18:18:56 +09:00
Alex Dadgar 84c3711989 Merge pull request #1457 from hashicorp/f-kill-event
Add killing event and mark task as not running when killed
2016-07-22 17:33:18 -07:00
Alex Dadgar f46c9e8d64 Merge pull request #1453 from hashicorp/d-fs-tail
Documentation for tail and the stream endpoint
2016-07-22 16:21:25 -07:00
Alex Dadgar 818d671407 validate from stdin 2016-07-22 13:48:14 -07:00
matt maier 7f2af04bcd Change circonus_broker_search_tag to circonus_broker_select_tag to match option in consul 2016-07-22 15:16:14 -04:00
matt maier 02d71eb6d3 Circonus integration for telemetry metrics 2016-07-22 12:33:10 -04:00
Alex Dadgar 00721861b0 Merge pull request #1438 from nak3/show-cpu-mhz
[tiny] Output MHz to CPU resouces in alloc-status
2016-07-21 15:59:13 -07:00
Alex Dadgar 90748cedad Add killing event and mark task as not running when killed 2016-07-21 15:49:54 -07:00
Alex Dadgar 4e24676cd3 Docs 2016-07-21 12:33:05 -07:00
Alex Dadgar ed919f4d87 small cleanup of run command error msg 2016-07-21 09:52:41 -07:00
Alex Dadgar 75768770aa Merge pull request #1449 from nak3/fix-syslog-plugin
Return when nomad syslog command has invalid number of argument
2016-07-21 09:44:45 -07:00
Kenjiro Nakayama ef3886c5a0 Return when nomad syslog command has invalid number of argument 2016-07-21 23:19:22 +09:00
Kenjiro Nakayama d766ee5c32 Fix nomad run parse error 2016-07-21 19:41:36 +09:00
Alex Dadgar e0114fee05 InitFields to Canonicalize 2016-07-20 16:08:52 -07:00
Kenjiro Nakayama f5c6d4bd44 [tiny] Output MHz to CPU resouces in alloc-status 2016-07-20 19:46:34 +09:00
Kenjiro Nakayama 47260d68be [tiny] Fix an indent in init template 2016-07-20 17:41:26 +09:00
Mathias Lafeldt ab94704518
Fix typos in source code 2016-07-18 16:24:46 +02:00
Alex Dadgar a7a18de930 Merge pull request #1420 from hashicorp/f-tail-lines
Implement tail -n
2016-07-13 15:33:34 -06:00
Alex Dadgar 104a5baa33 Allow following of files when cating and fix offsets 2016-07-13 15:33:17 -06:00
Diptanu Choudhury 3836d6e54e Merge pull request #1383 from hashicorp/f-job-summary
Job Summary - Part 1
2016-07-13 13:34:27 -06:00
Alex Dadgar d37651995f implement -n for tail 2016-07-13 13:26:09 -06:00
Diptanu Choudhury 487c66b84d Removing the queued state of Job Summary and alloc desired status false 2016-07-13 13:20:46 -06:00
Alex Dadgar dba8a3df22 frames to reader 2016-07-12 17:34:32 -06:00
Alex Dadgar 661d100f2f address comments 2016-07-12 17:01:33 -06:00
Alex Dadgar 9059fc42cb Address more comments 2016-07-12 10:45:05 -06:00
Alex Dadgar 7dd14507ca Tests and handle conn close behavior better 2016-07-12 10:18:48 -06:00
Alex Dadgar e9ffadfdc6 initial comments 2016-07-11 10:58:18 -06:00
Alex Dadgar 281c1fbf39 StreamFramer tests 2016-07-10 13:57:20 -04:00
Alex Dadgar 1fe435a130 StreamFramer encapsulates the sending, heartbeating and batching behavior of frames 2016-07-10 13:57:04 -04:00
Alex Dadgar 958e0d6ca3 Only initialize watcher once, fix offsetting, implement tail non-follow 2016-07-10 13:57:04 -04:00
Alex Dadgar 92a6f0f8ba initial command implementation 2016-07-10 13:57:04 -04:00
Alex Dadgar e100fc4422 Set up for testing 2016-07-10 13:57:04 -04:00
Alex Dadgar 2f44a0a069 Flush and use correct buffer size 2016-07-10 13:57:04 -04:00
Alex Dadgar 51ae7ace25 initial tail impl 2016-07-10 13:57:04 -04:00
Diptanu Choudhury 48b9684b1e Using net.JoinHostPort instead of handcrafting addrs 2016-07-08 16:45:14 -07:00
Diptanu Choudhury b180223f4b Allowing ports to be overriden in check definitions 2016-07-08 14:14:25 -07:00
Alex Dadgar 79bb4d7d8e Document HCL only 2016-07-01 11:51:53 -07:00
Jake Champlin f094969c7b
Update failing tests 2016-06-23 11:28:17 -04:00
Diptanu Choudhury 9c6ce3ff90 Merge pull request #1344 from hashicorp/b-consul-service-name
Fixed parsing of consul agent service names
2016-06-22 15:47:34 -07:00
Alex Dadgar f3bc85c20f use microsecond granularity 2016-06-22 15:20:56 -07:00
Diptanu Choudhury 69e046f63f Fixed parsing of consul agent service names 2016-06-22 13:52:43 -07:00
Jake Champlin 37b546617f
Add test for reading jobfile from stdin 2016-06-21 22:59:04 -04:00
Jake Champlin 054572a048
Formatting updates 2016-06-21 17:35:08 -04:00
Jake Champlin 86854f032f
Formatting changes 2016-06-21 17:33:40 -04:00
Jake Champlin 1c2a5ad691
Remove debugging, add newline to website docs 2016-06-21 16:49:12 -04:00
Jake Champlin 84ad9925d7
Update from comments, initial test function 2016-06-21 16:46:42 -04:00
Jake Champlin 597892e1bc
Read Nomad Jobfile from STDIN if specified.
Allows `nomad run` to read a nomad jobfile from stdin. This allows
templating, and in-memory configuration to occur without writing a
static Nomad jobfile.
2016-06-21 13:50:18 -04:00
Alex Dadgar 9406739ba8 remove resolving client rpc addr 2016-06-17 14:55:37 -07:00
Sean Chittenden 7566e8a04b
Improve the error messages when obtaining node and alloc stats 2016-06-17 13:24:10 -07:00
Sean Chittenden f9562cf656
Lump this fix in with gopsutils: guard against errors from stats. 2016-06-17 13:24:10 -07:00
Sean Chittenden 9e287858de Merge pull request #1310 from hashicorp/b-logger
Create and pass only one `logger` object around per Agent
2016-06-17 12:16:35 -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 871a31a8ec
Teach config.ConsulConfig how to construct a consulapi TLS client.
Said differently, centralize the creation of consul's client config
in one place and use it everywhere.
2016-06-16 22:51:06 -07:00
Sean Chittenden 438c1e149b
Fix tests 2016-06-16 22:26:45 -07:00
Sean Chittenden 59c54e9aeb
Fix tests, don't take the address of DefaultConsulCommand() 2016-06-16 21:21:39 -07:00
Sean Chittenden d17af396ca
Create config.DefaultConsulConfig() 2016-06-16 20:41:05 -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 9c703f2119 Merge pull request #1305 from hashicorp/f-autoreg-checks
F autoreg checks
2016-06-16 17:41:25 -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 25eb3c7e22
Whitespace police 2016-06-16 17:34:09 -07:00
Alex Dadgar 8240e4b3a7 Merge pull request #1304 from hashicorp/d-plan-cli
plan cli docs
2016-06-16 17:24:24 -07:00
Alex Dadgar 2b26259f27 plan cli docs 2016-06-16 17:23:49 -07:00
Alex Dadgar 85548f46af Merge pull request #1299 from hashicorp/d-node-status
Update node-status docs
2016-06-16 17:21:37 -07:00
Sean Chittenden a658299235
Misc typos 2016-06-16 16:17:17 -07:00
Alex Dadgar fc8254d157 Update node-status docs 2016-06-16 14:50:41 -07:00
Sean Chittenden ec77a1869e
Test for errors 2016-06-16 14:43:46 -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
Alex Dadgar 122d035457 Give relative time 2016-06-15 15:28:35 -07:00
Alex Dadgar bf14fd355f plan displays launch time of periodic jobs 2016-06-15 13:34:45 -07:00
Sean Chittenden f05514335b
Teach Nomad servers how to fall back to Consul. 2016-06-15 12:40:51 -07:00
Diptanu Choudhury 201dd28743 Merge pull request #1284 from hashicorp/add-warn-message
Added a warn message for deprecated consul options
2016-06-15 11:33:24 +02:00
Diptanu Choudhury fd80e6ed0f Added a warn message for deprecated consul options 2016-06-15 02:31:57 +02:00
Alex Dadgar aea21affdb Document consul configuration 2016-06-14 15:21:57 -07: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
Sean Chittenden 10ce8f27d4
Temporarily disable various syncer checks due to the API changes made earlier today. 2016-06-13 19:52:17 -07:00
Sean Chittenden a54b4e08f8
Drive-by comment correction 2016-06-13 18:14:50 -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
Chris Bednarski 02385f0dbc Change Modfied to Modified 2016-06-13 15:09:13 -07:00
Diptanu Choudhury 2e10458367 Removing unwated line of code 2016-06-13 15:37:55 +02: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 232654cdee register checks 2016-06-12 21:28:56 -07:00
Alex Dadgar a82c2bb058 Do not reconcile in client and cleanup executor a bit 2016-06-12 18:22:07 -07:00
Alex Dadgar e4506ea333 fix test 2016-06-12 16:48:55 -07:00
Alex Dadgar c68d23b7d6 Merge pull request #1264 from hashicorp/b-rename-services
Rename ConsulService back to Service
2016-06-12 16:44:49 -07:00
Diptanu Choudhury 751b2e1bcb Remove initial delay of registering services with consul 2016-06-13 01:42:56 +02:00
Alex Dadgar 8e231fa382 Rename ConsulService back to Service 2016-06-12 16:36:49 -07:00
Alex Dadgar e547f1a86d use base 1024 for bytes not 1000 2016-06-12 14:20:39 -07:00
Alex Dadgar b3a48f5d53 reworked alloc-status command 2016-06-12 14:08:47 -07:00
Alex Dadgar e931b42473 unify cli output 2016-06-12 13:16:07 -07:00
Alex Dadgar a49bb31561 unify units 2016-06-12 11:19:45 -07:00
Alex Dadgar 974c713b4d show allocation resources seperate from host 2016-06-12 11:19:45 -07:00
Alex Dadgar 61fcebf296 initial refactor and cleanup 2016-06-12 11:19:45 -07:00
Alex Dadgar fdda90229f only support latest and remove ring buffer 2016-06-12 09:32:38 -07:00
Alex Dadgar e952540f6f Allocation resources returned in a struct 2016-06-11 21:04:10 -07:00
Alex Dadgar 480a281031 Merge pull request #1243 from hashicorp/f-run-modify-index
Add check-index flag to nomad run
2016-06-11 16:12:53 -07:00
Sean Chittenden 2f036231e5 Merge pull request #1201 from hashicorp/f-dyn-server-list
Dynamic Server Lists/Client Bootstrapping via consul.
2016-06-11 18:58:25 -04:00
Sean Chittenden 917766a3df
Prefer `%+q` over `%q` in log messages. 2016-06-11 18:17:20 -04:00
Alex Dadgar 5797534d16 Don't require slash for node stats 2016-06-11 13:15:57 -07:00
Sean Chittenden bbd8dfa798
goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden bc771d35df
Query for the Nomad service across multiple Consul datacenters. 2016-06-10 23:05:14 -04:00
Diptanu Choudhury 0a9a3918d6 Not reset-ing the list of pids if they don't change 2016-06-11 01:19:50 +02:00
Diptanu Choudhury 01054db4fa Calculating total ticks consumed in the nomad client 2016-06-10 23:14:33 +02:00
Diptanu Choudhury d9d5a95160 Using humanize to convert memory usage to MB 2016-06-10 22:24:33 +02:00
Diptanu Choudhury 2d3798b076 Calculating the cpu ticks in nomad client 2016-06-10 22:22:32 +02:00
Sean Chittenden d99467ef5e
Always create a consul.Syncer. Use a default Consul Config if necessary. 2016-06-10 15:55:27 -04:00
Sean Chittenden f6a0459ae5
Always create a consul.Syncer. Use a default Consul Config if necessary. 2016-06-10 15:55:27 -04:00
Sean Chittenden e69232dd73
Commit miss, bump to 5s 2016-06-10 15:54:39 -04:00
Sean Chittenden 26b1e826d7
golint(1) police 2016-06-10 15:54:39 -04:00
Sean Chittenden c92306f020
Stash client and server registration behind consul.auto_register 2016-06-10 15:54:39 -04:00
Sean Chittenden 68aebff84d
Only return the Client's server addresses, never mix-in server peers 2016-06-10 15:54:39 -04:00
Sean Chittenden 447fe59fd2
Hand wave over the syncer tests atm, these will be fixed shortly. 2016-06-10 15:54:39 -04:00
Sean Chittenden fa7285cb5b
Don't spam the consul if Consul is not available.
Log once when Consul goes away, and log when Consul comes back.
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 a2109af862
Properly cover Syncer attributes with the registryLock.
trackedServices, delegateChecks, trackedChecks, and checkRunners
should all be covered.  This lock needs to be reasonably narrow and
can't use defer due to possible recursive locking concerns further
downstream from the call sites.
2016-06-10 15:54:39 -04:00
Sean Chittenden f9b561b52f
On Syncer Shutdown, remove all services that match a Syncer's prefix. 2016-06-10 15:54:39 -04:00
Sean Chittenden 57e084e4df
Sync checks with Consul by comparing the AgentCheckReg w/ ConsulService
The source of truth is the local Nomad Agent.  Any checks are not local that
have a matching prefix are removed.  Changed checks are re-registered
and missing checks are re-added.
2016-06-10 15:54:39 -04:00
Sean Chittenden 197feae679
Sync services with Consul by comparing the AgentServiceReg w/ ConsulService
The source of truth is the local Nomad Agent.  Any services not local that
have a matching prefix are removed.  Changed services are re-registered
and missing services are re-added.
2016-06-10 15:54:39 -04:00
Sean Chittenden 9a223936bb
Generate and sync Consul ServiceIDs consistently 2016-06-10 15:54:39 -04:00
Sean Chittenden bcad11cc2a
Rename runChecks to consulAvailable
Apologies in advance for the variable thrash, the fingerprinter is
no longer used to gate whether or not Consul is available any more.
2016-06-10 15:54:39 -04:00
Sean Chittenden efe00d2ccd
Update Syncer.Run() to call SyncServices(). 2016-06-10 15:54:39 -04:00
Sean Chittenden 83775c5c8b
Add "Service Groups" to the Syncer.
Now the right way to register services with the Syncer is to call
`SetServices(groupName, []*services)`.  This was required to allow
the Syncer to sync either the Client, Server, or Both using a
single Syncer.
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 06e5e615a8
Rename command/agent/consul/sync.go to syncer.go 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 7956eb0c80
Rename structs.Task's `Service` attribute to `ConsulService` 2016-06-10 15:54:39 -04:00
Sean Chittenden 05a2b9528c
Remove Syncer.registerService()
This call is obsolete by a future commit that changes the canonical
source of truth to be consul.AgentServiceRegistration structs, which
means it is not necessary to construct AgentServiceRegistration
objects every time a registration is made, we just reuse the existing
object.
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 f671dac6cc
Fix test TestClientConfigCommand_UpdateServers()
Now that hostnames are validated on input, switch to IPs since they
bypass DNS resolution.
2016-06-10 15:50:11 -04:00
Sean Chittenden b199743b8a
Add some trace-level logging for /v1/agent/servers when writing
This endpoint shouldn't be hit often, but this could be useful in
logs down the road.
2016-06-10 15:50:11 -04:00
Sean Chittenden 07fa89d2a5
Fix config_parse_test to reflect that `consul.addr` does not exist.
`consul.address` does, but not `consul.addr`.
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 39fb0f2469
Change the endpoint for `/v1/agent/servers` and fix tests.
When an agent is running a server, the list of servers includes the
Raft peers.  When the agent is running a client (which is always the
case?), include a list of the servers found in the Client's RpcProxy.
Dedupe and provide a unique list back to the caller.
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 82d537fbd9
Update the `nomad_server_service` default from `nomad-server` to just `nomad`. 2016-06-10 15:50:11 -04:00
Sean Chittenden 7c3838373b
Create a weak decoder to parse time.Duration.
Hat tip to Alex for pointing this out (vs patching mapstructure)
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 410d85cc78
Rename the package from `client/rpc_proxy` to `client/rpcproxy`
Also rename `NewRpcProxy()` to just `New()` to avoid package stutter.
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 e727fd8c3c
Centralize the creation of a consul/api.Config struct.
While documented, the consul.timeout parameter wasn't ever set
except one-off in the Consul fingerprinter.
2016-06-10 15:50:11 -04:00
Sean Chittenden f695d6d70d
Reconcile consul's address configuration section.
There were conflicting directives previously, both consul.addr and
consul.address were required to achieve the desired behavior.  The
documentation said `consul.address` was the canonical name for the
parameter, so consolidate configuration parameters to `consul.address`.
2016-06-10 15:50:11 -04:00
Sean Chittenden bd779c3719
Reconcile renamed structures during rebase 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 b5c70f3729
Alpha sort config keys for Consul 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 b509da2d0c
Create a `nomad/structs/config` to break an import cycle.
Flattening and normalizing the various Consul config structures and
services has led to an import cycle.  Break this by creating a new package
that is intended to be terminal in the import DAG.
2016-06-10 15:48:36 -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
Sean Chittenden e36686a17d
Use consul/lib's RandomStagger
Removes four redundant copies of the method in the process.
2016-06-10 15:48:36 -04:00
Alex Dadgar b4fa34a854 Merge pull request #1252 from hashicorp/f-blocked-eval-text
Better placement failure text for blocked evals
2016-06-10 11:41:41 -07:00
Alex Dadgar f006aeeb20 helper 2016-06-10 11:02:15 -07:00
Alex Dadgar 93a8af1422 better placement failure text for blocked evals 2016-06-10 10:56:32 -07:00
Alex Dadgar 3cf74e7fd8 Alloc-status only shows measured statistics and fixes to CPU calculations 2016-06-10 10:38:29 -07:00
Diptanu Choudhury 872957e015 Merge pull request #1246 from hashicorp/fix-node-cpu-usage
Changed the logic of calculation of node cpu usage
2016-06-09 19:29:12 -07:00
Diptanu Choudhury ef2d630ea4 Changed the logic of calculation of node cpu usage 2016-06-10 03:24:42 +01:00
Alex Dadgar 5d181d203c Add check-index flag to nomad run 2016-06-08 17:56:32 -07:00
Alex Dadgar 2102855ae7 Merge pull request #1237 from hashicorp/b-regions
CLI can forward request to different regions
2016-06-08 11:00:23 -07:00
Diptanu Choudhury 66052700ca Moving the stats error to the bottom of alloc status 2016-06-08 12:28:41 -04:00
Diptanu Choudhury 843d7e224e Moving the stats error to the bottom of node status 2016-06-08 12:21:20 -04:00
Diptanu Choudhury 5074121e70 Fixed the formating of % in nomad alloc status 2016-06-08 08:53:33 -04:00
Alex Dadgar 77dd3af134 docs 2016-06-07 11:33:55 -07:00
Alex Dadgar a0557e766e Run and plan automatically sets the region 2016-06-07 11:28:07 -07:00
Alex Dadgar 86e368cdb8 Add region flag and environment variable 2016-06-07 11:16:04 -07:00
Alex Dadgar 08b16573a9 Merge pull request #1227 from hashicorp/upstream-scada-provider
Use upstream high-level SCADA provider
2016-06-07 09:47:24 -07:00
Diptanu Choudhury 4a35ffa1ef Indicating which values are percentages 2016-06-06 16:10:34 -07:00
Diptanu Choudhury c21d606ebb Getting inodes used percent back 2016-06-06 16:10:34 -07:00
Diptanu Choudhury 9db3b002b0 Showing detailed resource usage stats in alloc-stats 2016-06-06 16:10:34 -07:00
Diptanu Choudhury 5ca21b2906 Showing task resource usage in alloc status 2016-06-06 16:10:34 -07:00
Diptanu Choudhury 1bf3280f95 Showing actual resource usage 2016-06-06 16:10:34 -07:00
Diptanu Choudhury 10b9eeef56 Added the stats flag 2016-06-06 16:10:34 -07:00
Diptanu Choudhury d928d02d85 Removing inode percent since it doesn't work in some cases 2016-06-06 16:10:34 -07:00
Jeff Mitchell b4f25e0b04 Use upstream high-level SCADA provider 2016-06-01 18:25:09 -04:00
Alex Dadgar 0f84d8968b Merge pull request #1221 from hashicorp/b-nil-wait
fix wait result being nil and some panics in the cli
2016-05-31 16:50:38 -07:00
Alex Dadgar 4e15611339 fix wait result being nil and some panics in the cli 2016-05-31 23:09:05 +00:00
Alex Dadgar b1298bb658 plan shows failure reasons and ordered annotations 2016-05-31 21:51:23 +00:00
Alex Dadgar 4dd7b621f0 Merge pull request #1206 from hashicorp/f-eval-status
Introduce eval-status and deprecate eval-monitor
2016-05-31 11:19:44 -07:00
Alex Dadgar 8b7d3e90a9 Clean failed placement output 2016-05-31 18:18:58 +00:00
Diptanu Choudhury fd1b0dfd49 Fixed a test 2016-05-31 01:58:32 +02:00
Diptanu Choudhury f95b1d00c3 Renamed error message in alloc endpoint 2016-05-28 20:03:52 -07:00
Diptanu Choudhury f0c381e7d7 Added a test for alloc stats api endpoint 2016-05-28 19:59:20 -07:00
Diptanu Choudhury eb5d831099 Added a test for the clients stats endpoint 2016-05-28 19:59:20 -07:00
Diptanu Choudhury c0dc6cfbf2 Changing the api of the stats endpoints 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 9499759013 Fixed the docs for the stats command 2016-05-28 19:59:20 -07:00
Diptanu Choudhury a0c279f3b2 comments 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 37e8e0dc35 Fixed the node status cli command 2016-05-28 19:59:20 -07:00
Diptanu Choudhury a64062d6a6 Fixed the compilation on linux 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 0b0d0764e4 Changed signature of Allocation Stats Reporter 2016-05-28 19:59:20 -07: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 464812ea3b Changed the stats endpoints 2016-05-28 19:59:20 -07:00
Diptanu Choudhury ecf2492138 Making task a flag in the stats command 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 05c221186b Added disk usage to node status 2016-05-28 19:59:20 -07:00
Diptanu Choudhury cf247c1309 Added uptime to node stats 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 73fa700a88 Showing host resource usage stats 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 313c61b9db Added pidstats in task resource usage struct 2016-05-28 19:59:20 -07:00
Diptanu Choudhury 22c3f6fee0 Implemented nomad cpu percentage calculator 2016-05-28 19:59:03 -07:00
Diptanu Choudhury 2f06fa8e63 Using humanize for showing memory 2016-05-28 19:59:03 -07:00
Diptanu Choudhury 510eb14245 Reporting percentage usage of cpu in nomad stats 2016-05-28 19:59:03 -07:00
Diptanu Choudhury 63166d0e46 Adding a query param to return time series of stats 2016-05-28 19:42:34 -07:00
Diptanu Choudhury 9a96dddc07 Added some docs to resource stats endpoint 2016-05-28 19:42:34 -07:00
Diptanu Choudhury 7569b1af2e Collecting host stats 2016-05-28 19:42:34 -07:00
Diptanu Choudhury f3d0aecafe Reporting time series of stats 2016-05-28 19:42:34 -07:00
Diptanu Choudhury 13825f434e Added the nomad stats command 2016-05-28 19:42:34 -07:00
Diptanu Choudhury 0fb0e0237f Added a client API to display resource usage of an allocation 2016-05-28 19:42:34 -07:00
Alex Dadgar 12ecd061e1 test fix 2016-05-27 11:50:15 -07:00
Alex Dadgar 55d48196b2 eval-status website docs 2016-05-27 11:50:15 -07:00
Alex Dadgar d92bf1e1a5 Handle the no allocation case in status 2016-05-27 11:50:15 -07:00
Alex Dadgar 9651b2551b Fix check of completed next eval 2016-05-27 11:50:15 -07:00
Alex Dadgar 10c2e8449f Show failure reason in status 2016-05-27 11:50:15 -07:00
Alex Dadgar 57770de1fc Add eval-status and remove eval-monitor 2016-05-27 11:50:15 -07:00
Diptanu Choudhury 5b1a2100c6 Merge pull request #1204 from hashicorp/fix-server-address
Use Bind Addr as server's IP while registering with consul in the absence of other configuration.
2016-05-24 22:30:35 -07:00
Diptanu Choudhury bf5b78b77e Added a test for generation of the server addr 2016-05-24 21:29:13 -07:00
Alex Dadgar 1a4f25031c Merge pull request #1181 from hashicorp/f-plan-cli
cli: nomad plan command
2016-05-24 20:09:12 -07:00
Alex Dadgar 3cbb89c61e Merge pull request #1188 from hashicorp/f-no-failed-allocs
Failed Allocation Metrics stored in Evaluation
2016-05-24 20:06:28 -07:00
Alex Dadgar d7d9ecad59 meta flag test 2016-05-24 18:53:46 -07:00
Alex Dadgar b7ca0669b8 output and test fix 2016-05-24 18:42:05 -07:00
Alex Dadgar fcc57fbc66 rename SpawnedBlockedEval and simplify map safety check 2016-05-24 18:12:59 -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
Alex Dadgar 2a4d5f0ef9 Compress HTTP API responses and have the api client utilize this 2016-05-24 10:26:53 -07:00
Alex Dadgar 120ff47cd1 Merge pull request #1182 from hashicorp/f-json-encoder
Use codegen for json marshalling
2016-05-20 14:30:25 -07:00
Alex Dadgar e4cb2d400b print spawned eval in monitor 2016-05-19 13:16:10 -07:00
Alex Dadgar 16353c48a7 Show task group failures in eval-monitor 2016-05-18 22:02:51 -07:00
Alex Dadgar 636f886e30 Use codegen for json marshalling: 20% faster, 12% less bytes allocated, 85% less allocations 2016-05-18 09:45:46 -07:00
Diptanu Choudhury bf27cc1261 Merge pull request #1174 from hashicorp/f-config-consul-block
Using the auto-register flag
2016-05-18 04:16:38 +02:00
Alex Dadgar d7bb9c58ed tests 2016-05-17 13:33:48 -07:00
Alex Dadgar fca7db1a9f comments, refactor and help string 2016-05-17 13:33:48 -07:00
Alex Dadgar df653b5f1d Alligned properly 2016-05-17 13:33:48 -07:00
Alex Dadgar db3dfec715 better colors and verify help text 2016-05-17 13:33:48 -07:00
Alex Dadgar 93cf38b1ca verbose output 2016-05-17 13:33:48 -07:00
Alex Dadgar 3f7615c6a1 little better output 2016-05-17 13:33:48 -07:00
Alex Dadgar 5d6b83fd2e initial implementation of nomad plan 2016-05-17 13:33:48 -07:00
Dara Kong 9b2b39c7d6 Fix "http_api_response_headers" config not working
On startup, the agent starts with either a dev or default config.  Extra
config files are merged into final config.

The HTTPAPIResponseHeaders config was missing from the merge logic
therefore it would always result in empty value (regardlesss of any
config files specified).
2016-05-16 20:57:54 -07:00
Alex Dadgar a5ab96d40e Merge pull request #1168 from hashicorp/f-plan-endpoint
Job.Plan endpoint
2016-05-16 13:15:40 -07:00