Commit Graph

797 Commits

Author SHA1 Message Date
Alex Dadgar f2b2e0482b code review fixes 2018-05-31 10:57:08 -07:00
Preetha Appan 4f835790d7
Set node eligibility to true when old client calls disable 2018-05-30 16:54:07 -05:00
Alex Dadgar 195e19827b Deployment adds JobSpecModifyIndex
Deployment tracks the Job.JobModifyIndex so that PUTS against /v1/jobs
can be more easily coorelated with the created deployment.

Fixes https://github.com/hashicorp/nomad/issues/4301
2018-05-30 11:33:56 -07:00
Nick Ethier 4b64db3a0f
api: emit different monitor message if node's drain strategy is never set 2018-05-24 06:39:09 -04:00
Preetha 159888a856
Merge pull request #4274 from hashicorp/f-force-rescheduling
Add CLI and API support for forcing rescheduling of failed allocs
2018-05-21 16:24:22 -07:00
Preetha Appan 4a400f045b
Fix docs and method documentation in API 2018-05-21 17:20:59 -05:00
Preetha Appan 3a8040e36f
Add new method EvaluateWithOptions to avoid breaking go API client 2018-05-11 14:18:53 -05:00
Preetha Appan b12df3c64b
Added CLI for evaluating job given ID, and modified client API for evaluate to take a request payload 2018-05-09 15:04:27 -05:00
Chelsea Holland Komlo d51611040f Add driver health information to node list stub 2018-05-09 11:21:54 -04:00
Alex Dadgar f4af30fbb5
Canary tags structs 2018-05-07 14:50:01 -05:00
Alex Dadgar f95ab4ade8
Mark canaries on creation, and unmark on promotion 2018-05-07 14:50:01 -05:00
Alex Dadgar 224b3092ae
change default to 10m and docs 2018-05-07 14:50:01 -05:00
Alex Dadgar 8a81038cdb
Set Reschedule from deployment watcher 2018-05-07 14:50:01 -05:00
Alex Dadgar e5caaf3358
Small test fix 2018-05-07 14:50:01 -05:00
Alex Dadgar 1336002255
Progress deadline in deployment state 2018-05-07 14:50:01 -05:00
Alex Dadgar ee50789c22
Initial implementation 2018-05-07 14:50:01 -05:00
Michael Schurter 0d534d30d6
Merge pull request #4251 from hashicorp/f-grpc-checks
Support Consul gRPC Health Checks
2018-05-04 14:55:16 -07:00
Michael Schurter 70b02875b7
Merge pull request #4234 from hashicorp/b-4159
Fix race in StreamFramer and truncation in api/AllocFS.Logs
2018-05-04 14:24:07 -07:00
Michael Schurter f6a4713141 consul: make grpc checks more like http checks 2018-05-04 11:08:11 -07:00
Michael Schurter 382caec1e1 consul: initial grpc implementation
Needs to be more like http.
2018-05-04 11:08:11 -07:00
Michael Schurter 526af6a246 framer: fix early exit/truncation in framer 2018-05-02 10:46:16 -07:00
Michael Schurter 949938534b api: never return EOF from Logs error chan
Closing the frames chan is the only race-free way to signal to receivers
that all frames have been sent and no errors have occurred.

If EOF is sent on error chan receivers may not receive the last frame
(or frames since the chan is buffered) before receiving the error.

Closing frames is the idiomatic way of signaling there is no more data
to be read from a chan.
2018-05-02 10:46:16 -07:00
Michael Schurter 6f0e2e808b tests: test logs from client<->api package 2018-05-02 10:46:16 -07:00
Preetha Appan 274bed1892
Add RescheduleTracker to allocs list stub struct 2018-05-01 14:53:47 -05:00
Alex Dadgar 15ad3f94af Fix command line 2018-04-26 15:46:22 -07:00
James Rasell b7c2ce2991
Update node-drain logging message to clearer for operators.
This change updates the console log message when performing a node
drain and particulary when a node has marked all allocs for
migration. Previously it logged 'drain complete' which was a little
confusing to operators as the node is not drained at this point.

Closes #4183
2018-04-24 07:50:01 +01:00
Nick Ethier 1f99c3a0f7
minor code review fixes to api/jobs 2018-04-17 10:18:36 -04:00
Nick Ethier 03a89060cf
api: add test for canonicalized jobs/parse 2018-04-16 19:21:09 -04:00
Nick Ethier de4176606d
command/agent: add Canonicalize option to parse args 2018-04-16 19:21:09 -04:00
Nick Ethier f2db03e56c
command/agent: add /v1/jobs/parse endpoint
The parse endpoint accepts a hcl jobspec body within a json object
and returns the parsed json object for the job. This allows users to
register jobs with the nomad json api without specifically needing
a nomad binary to parse their hcl encoded jobspec file.
2018-04-16 19:21:06 -04:00
Preetha bdc17ebf10
Merge pull request #4139 from hashicorp/b-reschedule-invalid-system-jobs
Make system jobs fail validation if they contain a reschedule stanza
2018-04-11 20:01:19 -05:00
Preetha Appan db549d1388
add canonicalize for reschedulepolicy to simplify validation logic 2018-04-11 18:47:27 -05:00
Preetha Appan ae1419826e
Always merge with default reschedule policy if its not nil 2018-04-11 15:26:01 -05:00
Preetha Appan a7b7b662ed
Make system jobs fail validation if they contain a reschedule stanza 2018-04-11 14:56:20 -05:00
Charlie Voiselle ba88f00ccb Changed "til" to "until"
Should be "till" or "until"; chose "until" because it is unambiguous as to meaning.
2018-04-11 12:36:28 -05:00
Alex Dadgar 3c51d5a5ea Fix ineffectual assignment 2018-04-05 11:29:39 -07:00
Alex Dadgar f1d3b47499 Don't assume the read index won't be zero if no jobs have been registered 2018-04-03 18:24:59 -07:00
Michael Schurter 7046db8818 cli: remove unreachable drain message 2018-03-30 14:15:12 -07:00
Michael Schurter f912cd4272 cli: log if a node goes down during draining 2018-03-30 14:02:42 -07:00
Michael Schurter 06874d8b3d drain: fix monitor node index handling 2018-03-30 12:43:53 -07:00
Michael Schurter 7199a2b960 cli: differentiate normal output vs info 2018-03-30 11:42:11 -07:00
Michael Schurter 0260bda046 cli: add color to drain output 2018-03-30 11:15:12 -07:00
Michael Schurter 6e10e0f84e drain: fix cli blocking when allocs already stopped 2018-03-30 10:18:14 -07:00
Michael Schurter ee3eddbac3 drain: block cli until all allocs stop
Before the drain CLI would block until the node was marked as completing
drain operations. While technically correct, it could lead operators (or
more likely: scripts) to shutdown drained nodes before all of its
allocations had *actually* terminated.

This change makes the CLI block until all allocations have terminated
(unless ignoring system jobs).
2018-03-29 10:56:09 -07:00
Alex Dadgar de4b3772f1 Create evals for system jobs when drain is unset
This PR creates evals for system jobs when:

* Drain is unset and mark eligible is true
* Eligibility is restored to the node
2018-03-27 15:53:24 -07:00
Chelsea Holland Komlo 003bc209b9 use time.Time for node events for compatibility 2018-03-27 15:43:57 -04:00
Preetha Appan 33e170c15d
s/linear/constant/g 2018-03-26 14:45:09 -05:00
Alex Dadgar d7f246efe1 Drain cli, api, http 2018-03-21 20:27:32 -07:00
Michael Schurter a854c7bdae docs: improve DrainRequest.MarkEligible comment 2018-03-21 16:55:22 -07:00
Michael Schurter a7ab75d853 test: index no longer guaranteed on job list
Also switch to require and add t.Helper to appropriate funcs.
2018-03-21 16:55:22 -07:00
Michael Schurter 1cc012966b api: fix tests to expect default migrate strategy 2018-03-21 16:51:45 -07:00
Michael Schurter 2832853bfa Add DesiredTransition.ShouldMigrate to api pkg 2018-03-21 16:51:45 -07:00
Alex Dadgar 92b636dd32 Fix deadline handling 2018-03-21 16:51:44 -07:00
Alex Dadgar 7b2bad8c5e Toggle Drain allows resetting eligibility
This PR allows marking a node as eligible for scheduling while toggling
drain. By default the `nomad node drain -disable` commmand will mark it
as eligible but the drainer will maintain in-eligibility.
2018-03-21 16:51:44 -07:00
Alex Dadgar 02019f216a Correct defaulting 2018-03-21 16:51:44 -07:00
Alex Dadgar a37329189a Improve DeadlineTime helper 2018-03-21 16:51:44 -07:00
Alex Dadgar d47c68f764 Add eligibility to node view 2018-03-21 16:51:44 -07:00
Alex Dadgar 8289cc3c6f HTTP and API 2018-03-21 16:51:44 -07:00
Alex Dadgar 010228577e Drain cli, api, http 2018-03-21 16:51:43 -07:00
Michael Schurter d1ec65d765 switch to new raft DesiredTransition message 2018-03-21 16:49:48 -07:00
Alex Dadgar db4a634072 RPC, FSM, State Store for marking DesiredTransistion
fix build tag
2018-03-21 16:49:48 -07:00
Michael Schurter c0542474db drain: initial drainv2 structs and impl 2018-03-21 16:49:48 -07:00
Chelsea Komlo 6fc9231dac
Merge pull request #3856 from hashicorp/f-client-add-health-checks
Client driver health checks for Docker
2018-03-21 18:05:00 -04:00
Chelsea Holland Komlo 0bde357731 add concept of health checks to fingerprinters and nodes
fix up feedback from code review

add driver info for all drivers to node
2018-03-21 15:15:25 -04:00
Preetha Appan 26b6e70d13
Addressed code review feedback 2018-03-21 09:15:29 -05:00
Preetha Appan 30fff15de7
Show reschedule policy in addition to when the eval will get rescheduled 2018-03-20 13:34:29 -05:00
Alex Dadgar d498fa950a Remove fake advertise address and fix TestAPI_OperatorAutopilotServerHealth 2018-03-19 15:49:12 -07:00
Preetha 6df57c177c
Merge pull request #4002 from hashicorp/b-reschedule-systemjob-panic
Fix incorrect initialization of reschedule policy for system jobs.
2018-03-19 13:06:55 -05:00
Preetha Appan 1d748663ce
Fix linting 2018-03-19 12:46:55 -05:00
Preetha Appan 161bc66355
Fix incorrect initialization of reschedule policy for system jobs. 2018-03-19 12:16:13 -05:00
Alex Dadgar 9e05c9a50e
Merge pull request #3997 from hashicorp/b-serf-addr
RPC Advertise used exclusively for Clients
2018-03-19 09:30:20 -07:00
Alex Dadgar 7e69d16c15 relax timing 2018-03-19 09:30:00 -07:00
Preetha Appan 462b431291
Fix ineffectual assignment lint warnings 2018-03-17 10:49:48 -05:00
Alex Dadgar 6448523b21 fix api job tests 2018-03-16 16:46:22 -07:00
Preetha Appan 9a5e6edf1f
Rename DelayCeiling to MaxDelay 2018-03-14 16:10:32 -05:00
Preetha Appan 342c3fb961
Added FollowupEvalID field and helper methods to calculate reschedule eligibility based on delay 2018-03-14 16:10:32 -05:00
Preetha Appan 5f50c3d618
Add new reschedule options to API layer and unit tests 2018-03-14 16:10:32 -05:00
Alex Dadgar de6ebb6e6c small cleanup 2018-03-13 18:08:22 -07:00
Alex Dadgar 63e14b7d63 nodeevents -> events 2018-03-13 18:08:22 -07:00
Chelsea Holland Komlo d30c269fbe code review feedback 2018-03-13 18:05:40 -07:00
Chelsea Holland Komlo 00d9923454 Ensure node updates don't strip node events
Add node events to CLI
2018-03-13 18:05:40 -07:00
Michael Schurter 7dd7fbcda2 non-Existent -> nonexistent
Reverting from #3963

https://www.merriam-webster.com/dictionary/existent
2018-03-12 11:59:33 -07:00
Josh Soref e2167ef047 spelling: unmarshal 2018-03-11 19:07:44 +00:00
Josh Soref 85fabc63c8 spelling: expected 2018-03-11 17:57:01 +00:00
Josh Soref 7f6e4012a0 spelling: existent 2018-03-11 18:30:37 +00:00
Josh Soref 1c07f37d37 spelling: describing 2018-03-11 17:54:04 +00:00
Josh Soref 79e6481463 spelling: configurations 2018-03-11 17:47:24 +00:00
Josh Soref 95f8098e99 spelling: configuration 2018-03-11 17:48:04 +00:00
Josh Soref dfec2cb25e spelling: canonicalize 2018-03-11 17:46:20 +00:00
Alex Dadgar 0715a4884b fix test 2018-02-15 13:59:03 -08:00
Alex Dadgar 57a0b7a774 allow setting timeout on any api config 2018-02-15 13:59:03 -08:00
Alex Dadgar aa98f8ba7b Enhance API pkg to utilize Server's Client Tunnel
This PR enhances the API package by having client only RPCs route
through the server when they are low cost and for filesystem access to
first attempt a direct connection to the node and then falling back to
a server routed request.
2018-02-15 13:59:03 -08:00
Kyle Havlovitz 54b691f538
Merge pull request #3852 from hashicorp/autopilot-cleanup
Clean up some leftover autopilot differences from Consul
2018-02-14 10:42:32 -08:00
Kyle Havlovitz 709b693d39 Clean up some leftover autopilot differences from Consul 2018-02-08 10:27:26 -08:00
Preetha Appan 12da54ae2b
Fix tests broken by default change to RestartPolicy 2018-02-02 19:25:45 -06:00
Preetha Appan 8ac05d4462
Reuse default policy structs in api, and other code review feedback 2018-01-31 16:33:00 -06:00
Preetha Appan 9d15e0c05b
Code review feedback 2018-01-31 09:58:05 -06:00
Preetha Appan 5714a6b8bf
Add method on API alloc to calculate attempted and remaining reschedule events 2018-01-31 09:58:05 -06:00
Preetha Appan 13444c08a4
Remove unused method 2018-01-31 09:58:05 -06:00
Preetha Appan e09ea8c0b0
Address code review comments 2018-01-31 09:58:05 -06:00
Preetha Appan 0c56a12a77
Add RescheduleTracker to allocations API struct 2018-01-31 09:56:53 -06:00
Preetha Appan 1f834d1a31
Add reschedule policy to API, and HCL parsing support. 2018-01-31 09:56:53 -06:00
Kyle Havlovitz cb2321353c
Merge pull request #3812 from hashicorp/autopilot-config-change
Refactor redundancy_zone/upgrade_version out of client meta
2018-01-30 16:14:26 -08:00
Kyle Havlovitz 2ccf565bf6 Refactor redundancy_zone/upgrade_version out of client meta 2018-01-29 20:03:38 -08:00
Alex Dadgar 31e212f467
Merge pull request #3684 from jrasell/f_gh_3678
Update `node-status` verbose command to include node address.
2018-01-29 15:32:14 -08:00
Preetha Appan fd2fbefa4c
Add a field to track the next allocation during a replacement 2018-01-24 17:55:05 -06:00
Kyle Havlovitz 901c8791f4
Merge pull request #3670 from hashicorp/autopilot
Add Autopilot feature from Consul
2018-01-19 12:52:56 -08:00
Kyle Havlovitz 8d41f4ad40 Formatting/test adjustments 2018-01-18 15:03:35 -08:00
Kyle Havlovitz 12ff22ea70 Merge branch 'master' into autopilot 2018-01-18 13:29:25 -08:00
Michael Schurter 9fcda9c5aa Make example service name make sense
Switch from global-redis-check for the example job's service name to
redis-cache. The former name is really confusing and someone finally
called us out on it:

https://groups.google.com/d/msg/nomad-tool/3RTh6CyYkWk/vEe_Sj7lAAAJ

Also specifically mention that the `service.name` parameter is what is
advertised in Consul.
2018-01-17 14:08:30 -08:00
Kyle Havlovitz 7b980c42d8 Add raft remove by id endpoint/command 2018-01-16 13:35:32 -08:00
Michael Schurter 224046ece8 Invert and test CheckRestart merge logic 2018-01-09 15:17:07 -08:00
Michael Schurter 7c282f174b Fix service.check_restart stanza propagation
There was a bug in jobspec parsing, a bug in CheckRestart merging, and a
bug in CheckRestart canonicalization. All are now tested.
2018-01-09 15:15:36 -08:00
Preetha 1712b03705
Merge branch 'master' into 0.8 2018-01-03 16:06:38 -06:00
Fabian Holler f99aaa9134 revert change to increase min. CPU resource value from 20 to 100
In the commit 622d3ddb92ea7e656ef831641c02024cb5a5d6d1
"Fixed test and moved constants into standalone func" the minimum CPU
resource value for a job was increased from 100 to 20.

This can break the nomad setup for people that used lower CPU
values and are at the maximum MHz value of the available CPU on a
machine.
Change the minimum back to 20 MHz to ensure downwards compatibility.
2018-01-02 16:09:44 +01:00
James Rasell 45e8f977f7
Update `node-status` verbose command to include node address.
This change updates the `nomad node-status -verbose` command to
also include the addreess of the node. This is helpful for cluster
administrators to quickly discover information and access nodes
when required.
2017-12-21 08:58:35 +00:00
Kyle Havlovitz 1c07066064 Add autopilot functionality based on Consul's autopilot 2017-12-18 14:29:41 -08:00
Kyle Havlovitz b775fc7b33
Added support for v2 raft APIs and -raft-protocol option 2017-12-12 10:17:16 -06:00
Michael Schurter 4ae115dc59 Allow custom ports for services and checks
Fixes #3380

Adds address_mode to checks (but no auto) and allows services and checks
to set literal port numbers when using address_mode=driver.

This allows SDNs, overlays, etc to advertise internal and host addresses
as well as do checks against either.
2017-12-08 12:03:00 -08:00
Chelsea Holland Komlo 021336eaee fix up test fixture to properly parse 2017-12-06 16:23:55 -05:00
Chelsea Holland Komlo b08611cfac move kill_signal to task level, extend to docker 2017-12-06 14:36:39 -05:00
Preetha 0e6484a397
Merge pull request #3536 from angrycub/b-resource-memory-test-fix
Fixed test and moved constants into standalone func
2017-11-13 17:00:14 -06:00
Charlie Voiselle 1419e7a1c3 gofmt and goimports 2017-11-13 12:25:02 -05:00
Preetha Appan be5fd87b9a Fixes bug with display message logic due to deprecating GenericSource. Also added more test cases to cover a bunch more edge cases 2017-11-13 11:14:57 -06:00
Charlie Voiselle 26acd7f025 Fixed test and moved constants into standalone func
In #3520, work was done to true up the defaults for Nomad resource
stanzas with the documentation.  This fixes the tests that I
accidentally broke in the process.  Some questions were raised about
using dynamic elements as part of expects, which is why I opted to
copy the MinResources pattern.   During this refactor I also noticed
that structs.go had a similar issue and an inconsistent minium for CPU.
2017-11-13 12:05:30 -05:00
Alex Dadgar b68f18bcc5
Merge pull request #3520 from hashicorp/b-memory-default-incorrect
`memory` default is 10, not 300
2017-11-10 12:43:37 -08:00
Charlie Voiselle 18750980ff Simplified based on review comments 2017-11-09 20:09:37 -05:00
Charlie Voiselle c15e91951b Adopted pattern from LogConfig to handle panic when no resource stanza at all
In testing realized that Resources night not be present at all.  Testing this case caused panic. Added in a means to collect clean defaults in that case.
2017-11-09 10:57:57 -05:00
Charlie Voiselle eda45a0cee Canonicalize task and remove merge with MinResources
The current code would merge the job with the output of MinResources causing the nil to be replaced with MemoryMB=helper.IntToPtr(10).  When later `Canonicalize`d, the 10 would cause the default of 300 not to be applied. Running `Canonicalize` on the task itself guarantees that CPU, MemoryMB, and IOPS is set, so we can remove the Merge withMinResources.
2017-11-09 10:10:11 -05:00
Chelsea Komlo bb96d79cae
Merge pull request #3480 from loomnetwork/fix-jobs-tests
jobs tests were sending invalid jobs
2017-11-08 11:49:19 -05:00
Charlie Voiselle ff5d1a90a4 Rolled back documentation change in favor of correcting the default 2017-11-07 17:17:49 -05:00
Preetha Appan 61a49e08af Fix formatting 2017-11-03 12:48:55 -05:00
Preetha Appan 56574ed87d Adds deprecation notice to API struct definition. 2017-11-03 10:12:37 -05:00
Preetha Appan 5f09c968b3 Move logic for determinic event display message to task_runner, added two new fields DisplayMessage and Details. 2017-11-03 09:13:01 -05:00
Preetha Appan 39d70be009 Add ModifyTime to Allocation and update it both on plan applies and client initiated updates 2017-11-01 15:13:48 -05:00
Matthew Campbell 7432676e87 jobs tests were sending invalid jobs 2017-11-01 18:29:15 +07:00
Michael Schurter 916682f8a0 Merge pull request #3387 from hashicorp/f-aclless-health
Agent Health Endpoint
2017-10-16 11:05:09 -07:00
Alex Dadgar c3f06b2134 Merge pull request #3384 from hashicorp/f-self-policies
Ability to introspect self token
2017-10-13 17:11:22 -07:00
Michael Schurter f141bf3fe5 Add Agent.Health to api package 2017-10-13 16:43:00 -07:00
Alex Dadgar c1cc51dbee sync 2017-10-13 14:36:02 -07:00
Alex Dadgar dd3920d681 Self token lookup 2017-10-13 13:12:20 -07:00
Michael Schurter 84d8a51be1 SecretID -> AuthToken 2017-10-12 15:16:33 -07:00
Alex Dadgar 68d1a61e8e fix test 2017-10-11 18:11:03 -07:00
Alex Dadgar ea4e9ed027 Change vault_grace default to match vaults 2017-10-11 17:20:12 -07:00
Alex Dadgar 6d3d0a9391 Nomad UI Command 2017-10-09 23:01:55 -07:00
Michael Schurter a66c53d45a Remove `structs` import from `api`
Goes a step further and removes structs import from api's tests as well
by moving GenerateUUID to its own package.
2017-09-29 10:36:08 -07:00
Alex Dadgar 76e4230833 Merge pull request #3284 from hashicorp/f-lint
Enable more linters
2017-09-26 15:46:42 -07:00
Alex Dadgar 4173834231 Enable more linters 2017-09-26 15:26:33 -07:00
Michael Schurter d0140f07ca grace_period -> grace 2017-09-26 10:21:35 -07:00
Alex Dadgar 2a09c51840 handle errors when streaming logs 2017-09-19 10:37:49 -05:00
Alex Dadgar e5ec915ac3 sync 2017-09-19 10:08:23 -05:00
Michael Schurter f92ffe5af5 Merge pull request #3105 from hashicorp/f-876-restart-unhealthy
Restart unhealthy tasks
2017-09-17 19:38:32 -07:00
Chelsea Holland Komlo fdf6120987 add acl token as meta flag
add API test for job ACL
2017-09-15 23:33:43 +00:00
Michael Schurter 06ca379da0 Add comments 2017-09-15 14:34:36 -07:00
Michael Schurter d299d42089 Canonicalize and Merge CheckRestart in api 2017-09-14 16:48:39 -07:00
Michael Schurter 99f4aa999a Default grace period to 1s 2017-09-14 16:46:54 -07:00
Michael Schurter a180c00fc3 on_warning=false -> ignore_warnings=false
Treat warnings as unhealthy by default
2017-09-14 16:46:54 -07:00
Michael Schurter b35d208428 Nest restart fields in CheckRestart 2017-09-14 16:46:54 -07:00
Michael Schurter bf34505509 Add restart fields 2017-09-14 16:46:54 -07:00
Alex Dadgar a2363e7583 sync acls 2017-09-13 11:38:29 -07:00
Alex Dadgar 84d06f6abe Sync namespace changes 2017-09-07 17:04:21 -07:00
Armon Dadgar 3f35b1ef0c api: Fixing double region merge conflict 2017-09-04 13:20:51 -07:00
Armon Dadgar d49bc49274 api: full CRUD for ACL token API 2017-09-04 13:09:34 -07:00
Armon Dadgar 4512094058 api: support token listing 2017-09-04 13:09:34 -07:00
Armon Dadgar 1e9f19ef40 api: support querying policies 2017-09-04 13:09:34 -07:00
Armon Dadgar 41249d9b6a api: support policy delete 2017-09-04 13:09:34 -07:00
Armon Dadgar 147471ffbf api: Adding support for ACL tokens 2017-09-04 13:09:34 -07:00
Armon Dadgar f1c4143a62 agent: thread ACLs for Job Register 2017-09-04 13:05:53 -07:00
Alex Dadgar 698387e103 Don't merge empty update from job into task groups
This PR fixes an issue in which we would merge an update stanza from the
job into the task groups even if it was empty. This broke round
tripping a job (reading from the api and resubmitting as JSON)

Fixes https://github.com/hashicorp/nomad/issues/3132
2017-08-30 11:35:19 -07:00
Alex Dadgar c5a9e5caca Address feedback 2017-08-29 16:09:53 -07:00
Alex Dadgar 602cce5c21 Node Client doesn't share HTTP client 2017-08-29 14:22:11 -07:00
Alex Dadgar 9f5c46f119 Fix TLSServerName for Node API Client
This PR fixes the construction of the TLSServerName when connecting to a
node that has TLS enabled and adds tests for all possible permutations.

Fixes https://github.com/hashicorp/nomad/issues/3013
2017-08-29 11:11:19 -07:00
Alex Dadgar 7af98ee57c Fix logs/fs commands
This PR fixes an assignment to a nil map in the api pkg related to
accessing logs and the filesystem of allocations.

Fixes https://github.com/hashicorp/nomad/issues/3115
2017-08-28 22:21:54 -07:00
Michael Schurter 4227373e2d Merge pull request #3108 from hashicorp/b-3013-stats-tls
Fix TLS support in api pkg / cli
2017-08-28 15:37:31 -07:00
Michael Schurter eddc375b9b Simplify region handling 2017-08-28 14:58:15 -07:00
Michael Schurter b145e04d5d Refactor GetNodeClient weirdness
- No need to for a pointer to a pointer
- Properly set and use QueryOptions.Region
2017-08-28 14:41:21 -07:00
Alex Dadgar e6bf8f8e75 Merge pull request #3081 from clinta/maxparallel0
If MaxParallel == 0 default limit to count
2017-08-28 12:42:50 -07:00
Alex Dadgar cff1c5ca08 Merge pull request #3107 from hashicorp/b-migrate-context-all
All context should use string context "all"
2017-08-28 12:38:54 -07:00
Michael Schurter 7363b50666 Fix TLS support in api pkg / cli
Fixes #3013

It's a little weird that Client now has a method for returning a
NewClient, but it's a convenient way to dedupe the logic to
connect-directly-to-a-node which is nontrivial and had sutble
differences between locations.
2017-08-28 11:46:28 -07:00
Chelsea Holland Komlo 6243690899 migrate all context 2017-08-28 05:29:38 +00:00
Alex Dadgar d7d8661485 Search respects QueryOptions and returns QueryMeta
@chelseakomlo heads up on this change
2017-08-27 22:17:51 -07:00
Clint Armstrong dc8eab6adc Set MaxParallel default to 1 2017-08-25 07:56:40 -04:00
Christian Winther c788fb1803 Add missing ReconcileSummaries API method
References https://www.nomadproject.io/api/system.html#reconcile-summaries
2017-08-24 11:55:10 +02:00
Alex Dadgar 02f26f3384 Autocomplete deployment commands 2017-08-22 13:05:24 -07:00
Alex Dadgar 422332c8bf Merge pull request #3002 from jrasell/gh_2993
Add the Nomad agent version to the node-status CLI output.
2017-08-22 10:43:25 -07:00
Michael Schurter bb8d5689d8 Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Michael Schurter d529b422b2 Add optional shutdown delay to tasks
Fixes #2441

Defaults to 0 (no delay) for backward compat and because this feature
should be opt-in.
2017-08-16 17:59:46 -07:00
James Rasell 0d120228ea Updates based on feedback provided by dadgar. 2017-08-16 22:19:31 +01:00
Chelsea Holland Komlo b3d22313ba update comment for revised contexts 2017-08-14 18:51:32 +00:00
Chelsea Holland Komlo e658d4daaa fixups from code review 2017-08-14 17:56:03 +00:00
Chelsea Holland Komlo 69c2b7e308 context constants should be in both api and structs pkg 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 9bc48a01a6 using contexts constants in replace of string contexts
fix up endpoints
2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 76827c98f7 use constants for contexts 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 465c4d7082 change endpoint to /v1/search 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo b7736c8b4a update comments
refactor for simplicity
2017-08-14 17:36:14 +00:00
Chelsea Holland Komlo 5ee58a391b rename to cluster search
comment updates
2017-08-14 17:36:14 +00:00
Chelsea Holland Komlo 59bd6929bc fix failing test assertion
small refactors
2017-08-14 17:35:35 +00:00
Chelsea Holland Komlo 9402d330e8 autocomplete for allocation ids 2017-08-14 17:35:35 +00:00
Alex Dadgar 6b238edc22 Merge pull request #3001 from hashicorp/f-template-events
Template emits events explaining why it is blocked
2017-08-10 13:00:58 -07:00
“James d6d721d7c1 Add the Nomad agent version to the node-status CLI putput. 2017-08-10 08:27:26 +01:00
Alex Dadgar aba107be99 Merge pull request #2979 from lfarnell/cleanup
Code cleanup
2017-08-08 10:21:15 -07:00
Alex Dadgar 4f6f6a13c8 Emit generic task events 2017-08-07 21:26:04 -07:00
Luke Farnell f0ced87b95 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Alex Dadgar 067a638478 Allow template to set Vault grace
This PR allows a template to specify the Vault grace duration.

Fixes https://github.com/hashicorp/nomad/issues/2922
2017-08-01 14:14:08 -07:00
Alex Dadgar 789751d84e Parallel 2017-07-21 16:33:04 -07:00
Alex Dadgar 461e36584e events 2017-07-07 12:12:48 -07:00
Alex Dadgar ade9a7c768 @jippi Changed my mind! Good suggestion 2017-07-07 12:12:48 -07:00
Alex Dadgar 770af68119 alloc-status 2017-07-07 12:12:48 -07:00
Alex Dadgar 40b04a5ea9 alloc-list shows version 2017-07-07 12:12:48 -07:00
Alex Dadgar 1cb877699a Disallow update stanza on batch jobs
This PR:
* disallows update stanzas on batch jobs
* undeprecates the stagger field
* changes the way warnings are returned
2017-07-07 12:11:39 -07:00
Alex Dadgar bfc22346d5 Return the reverted job version 2017-07-07 12:10:04 -07:00
Alex Dadgar 5457bb7962 Job stability 2017-07-07 12:10:04 -07:00
Alex Dadgar 454083ba1b Remove canary 2017-07-07 12:10:04 -07:00
Alex Dadgar ecee5e370e initial watcher 2017-07-07 12:07:08 -07:00
Alex Dadgar be34d9487d Add deployment id to alloc 2017-07-07 12:07:08 -07:00
Alex Dadgar 43d2db1c14 Small fixes 2017-07-07 12:07:08 -07:00
Alex Dadgar 2aa6c13349 deployment promote 2017-07-07 12:07:07 -07:00
Alex Dadgar e7034691ea deployment status 2017-07-07 12:07:07 -07:00
Alex Dadgar 7719306ef3 job revert 2017-07-07 12:07:07 -07:00
Alex Dadgar 2471b86dec Show submit time 2017-07-07 12:07:07 -07:00
Alex Dadgar abf34204cc JobVersions returns struct with optional diff 2017-07-07 12:05:57 -07:00
Alex Dadgar f233629a4f job deployment endpoint + api 2017-07-07 12:05:56 -07:00
Alex Dadgar 6d90c5c780 Deployments HTTP docs 2017-07-07 12:03:11 -07:00
Alex Dadgar 73325f888f deployment api 2017-07-07 12:03:11 -07:00
Alex Dadgar d04877d23c initial impl 2017-07-07 12:03:11 -07:00
Alex Dadgar cf5baba808 handle annotations 2017-07-07 12:03:11 -07:00
Michael Schurter 0d3bdf7210 Add support for go-getter modes
Fixes #2678
2017-07-06 10:45:44 -07:00
Michael Schurter 5b59bea67b Move caonicalization from nomad/structs/ to api/ 2017-06-21 17:19:08 -07:00
Michael Schurter b9bfb84b53 Implement DriverNetwork and Service.AddressMode
Ideally DriverNetwork would be fully populated in Driver.Prestart, but
Docker doesn't assign the container's IP until you start the container.

However, it's important to setup the port env vars before calling
Driver.Start, so Prestart should populate that.
2017-06-21 17:19:08 -07:00
Michael Schurter 551edaa139 Fix template canonicalize test 2017-05-26 16:42:16 -07:00
Michael Schurter 10b6610e56 Functional consul template env file support 2017-05-23 13:45:14 -07:00
Alex Dadgar 3a53bdb669 API defaults use structs default 2017-05-10 13:51:52 -07:00
Alex Dadgar 6232b66ea7 Thread through warnings about deprecations 2017-05-09 20:52:47 -07:00
Alex Dadgar 10b040aea3 New update block; still need to handle the upgrade path 2017-05-08 17:44:26 -07:00
Alex Dadgar a1c4b5f4c6 Revert api 2017-04-20 11:14:06 -07:00
Alex Dadgar ac5d65704f Structs 2017-04-20 11:14:06 -07:00
Michael Schurter 45a8635ea2 Add TLSSkipVerify support to api and parser 2017-04-19 12:45:34 -07:00
Alex Dadgar 1769fe468a Fix some tests 2017-04-17 19:39:20 -07:00
Alex Dadgar 7b3f3f80fb Status shows type of job 2017-04-15 17:08:05 -07:00
Alex Dadgar 3145086a42 non-purge deregisters 2017-04-15 17:08:05 -07:00
Alex Dadgar 45ad95e862 Agent API + api package 2017-04-15 17:08:05 -07:00
Alex Dadgar f97664512b Upsert Job Histories 2017-04-15 17:08:05 -07:00
Alex Dadgar 9cf1ec3e7a Fix api.NetworkResource fields 2017-04-07 18:36:43 -07:00
Alex Dadgar 81b78f77e1 Track task start/finish time & improve logs errors
This PR adds tracking to when a task starts and finishes and the logs
API takes advantage of this and returns better errors when asking for
logs that do not exist.
2017-03-31 16:14:11 -07:00
Michael Schurter 9a94b94bc8 Remove overly clever code 2017-03-27 20:54:43 -07:00
Michael Schurter 8310032c5c Fix TLS use in AllocFS API and region/dc detection 2017-03-27 17:38:16 -07:00
Michael Schurter 85d109f07f Merge pull request #2412 from barnardb/agent-self
Return AgentSelf struct from Agent.Self() instead of map
2017-03-13 13:29:15 -07:00
Alex Dadgar 9011a7984c Add metrics to show allocations on the client
This PR adds the following metrics to the client:
client.allocations.migrating
client.allocations.blocked
client.allocations.pending
client.allocations.running
client.allocations.terminal

Also adds some missing fields to the API version of the evaluation.
2017-03-09 12:37:41 -08:00
Ben Barnard 4ab0f4b932 Remove duplicate check 2017-03-08 16:19:38 +01:00
Ben Barnard 372303f4c6 Return AgentSelf struct from Agent.Self() instead of map
api.AgentSelf mirrors command.agent.agentSelf, and makes it easier to
work with the results of a call to Agent.Self()
2017-03-08 15:59:10 +01:00
Alex Dadgar 3b9bdfef1c Make validate work without a Nomad agent 2017-03-03 15:02:03 -08:00
Alex Dadgar 8827b4f4d0 Fix canonicalization of services 2017-03-01 15:30:01 -08:00
Alex Dadgar 5be806a3df Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Alex Dadgar 5708f347cd fix check 2017-02-24 15:01:09 -08:00
Alex Dadgar f8292fe515 ensure spec is set 2017-02-24 14:18:09 -08:00
Alex Dadgar abb729b989 Merge pull request #2336 from hashicorp/b-fix-api-panic
Fix API panic and bad missing port check
2017-02-24 13:07:09 -08:00
Michael Schurter 703ddea1dc Add Canonicalize test mimicing example job + template 2017-02-24 12:08:31 -08:00
Michael Schurter 6011a74ab9 Missed initializing another field in Template! 2017-02-24 10:47:50 -08:00
Michael Schurter 531af8f932 Template.Canonicalize wasn't initializing all fields 2017-02-24 10:31:05 -08:00
Alex Dadgar 6936c81720 Merge pull request #2302 from hashicorp/f-task-state-setup
Adding a task event for setup
2017-02-22 18:42:57 -08:00
Diptanu Choudhury 98921575af Adding a task event for setup 2017-02-22 18:28:07 -08:00
Alex Dadgar 556fb2562f Remove defaulting from parse and fix parser tests
This PR removes defaulting from the parse, fixes some regressions that
existed as part of the parser refactor and fixes the tests.
2017-02-22 12:30:05 -08:00
Alex Dadgar b49fceb491 rebase 2017-02-20 16:43:28 -08:00
Alex Dadgar 693dd21420 Add leader and timezone to conversion 2017-02-20 16:36:41 -08:00
Alex Dadgar 99538ddf1c Add defaulting test and fix types on the agent job endpoint tests 2017-02-20 15:53:56 -08:00
Alex Dadgar b67c59f03c Merge branch 'master' into refactor-parser 2017-02-20 15:13:21 -08:00
Michael Schurter 0758c73ef3 Fix API panic and bad missing port check
The format of the missing port error message changed from Go 1.7 to 1.8.
The fix is to just use strings.Contains instead of strings.HasPrefix
when looking for the "missing port" part.

Also add an error return to Client.newRequest as parsing the path
processes arbitrary user input and would panic if given an invalid URL.

See: https://groups.google.com/d/topic/nomad-tool/gi3-CTE7oXo/discussion
2017-02-20 11:12:34 -08:00
Alex Dadgar 10735d1c0f Merge pull request #2321 from hashicorp/f-timezone
Allow specification of timezones in Periodic Jobs
2017-02-17 11:32:14 -08:00
Alex Dadgar 92419929a8 Fix embedded meta in dispatch response 2017-02-16 15:47:36 -08:00
Diptanu Choudhury e3b92afc77 Making the job register endpoint use api.Job 2017-02-16 13:52:39 -08:00
Diptanu Choudhury 161ce2ff87 Removing un-neccessary conversions 2017-02-16 13:52:39 -08:00
Diptanu Choudhury d0d7c92bab Added tests 2017-02-16 13:52:39 -08:00
Diptanu Choudhury 7567209857 Making the job spec return api.Job 2017-02-16 13:52:39 -08:00
Alex Dadgar 7e918003ba Allow specification of timezones 2017-02-15 14:37:06 -08:00
Alex Dadgar b6357f96c5 Merge pull request #2308 from hashicorp/f-leader-task
Leader task
2017-02-14 11:03:32 -08:00
Alex Dadgar 9b72f77f0b Api Leader becomes a pointer 2017-02-13 10:43:33 -08:00
Alex Dadgar 238b4bcafd Add Leader support to client 2017-02-10 17:55:19 -08:00
Alex Dadgar 3ba8faeae3 Add leader task to api and server side 2017-02-10 16:57:47 -08:00
Alex Dadgar 2d4d9b79d8 Operator command/endpoint/documentation 2017-02-09 18:04:46 -08:00
Alex Dadgar 6b7efa1ba6 Template destination file permissions.
This PR allows setting the file permissions of the rendered template.
2017-01-31 20:10:01 -08:00
Alex Dadgar 8196a58c4c Rename dispatch_input to dispatch_payload 2017-01-25 21:27:44 -08:00
Michael Schurter 1f7b5b4b47 Rename Constructor -> Parameterized Job 2017-01-20 12:43:10 -08:00
Jason Hancock 2f950354bc fix a copy/paste error on api.Regions() comment 2017-01-17 22:48:01 -08:00
Diptanu Choudhury bb664835c2 Added the API for GC of allocations and nodes 2017-01-12 16:18:29 -08:00
Alex Dadgar 2c838a80f6 Detect newly created allocation's properly 2017-01-08 13:55:03 -08:00
Alex Dadgar a37656e7d8 Add QueuedAllocations to api.Evaluation 2017-01-06 11:32:14 -08:00
Alex Dadgar 8d5f0fea69 Merge pull request #2128 from hashicorp/f-dispatch
Nomad Constructor Jobs and Dispatch
2017-01-06 05:22:49 +08:00
Michael Schurter 4a9a574d9d Merge pull request #2054 from hashicorp/f-prestart
Add Driver.Prestart method
2016-12-20 16:18:56 -08:00
Michael Schurter 2aa235f8f2 Rename InitializationMessage to DriverMessage 2016-12-20 11:51:09 -08:00
Diptanu Choudhury 9cdd576720 Updated changelog and fixed tests 2016-12-20 11:32:17 -08:00
Alex Dadgar bf1e157bd8 Children fixes + nomad status outputs summaries
Children object is always initialized instead of lazily.
`nomad status` outputs children summaries and has specialized view for
constructor jobs.
2016-12-14 16:58:54 -08:00
Alex Dadgar 4a5c3c8db0 Rename structs 2016-12-14 14:28:43 -08:00
Alex Dadgar c005fcb973 Add structs 2016-12-05 17:24:37 -08:00
Alex Dadgar a7ce915042 start of the cli command 2016-12-04 21:22:13 -08:00
Michael Schurter 770ed703d0 Add Driver.Prestart method
The Driver.Prestart method currently does very little but lays the
foundation for where lifecycle plugins can interleave execution _after_
task environment setup but _before_ the task starts.

Currently Prestart does two things:

* Any driver specific task environment building
* Download Docker images

This change also attaches a TaskEvent emitter to Drivers, so they can
emit events during task initialization.
2016-12-02 11:03:48 -08:00
Alex Dadgar f0b6d5953c Remove paused 2016-12-01 13:17:34 -08:00
Alex Dadgar cfd9593e7a dispatch beginning 2016-11-25 18:04:55 -08:00
Diptanu Choudhury 5191b4d33a Making the status command return the allocs of currently registered job 2016-11-24 16:31:30 +01:00
Alex Dadgar 54bcde8e36 Dispatch structs 2016-11-23 15:03:13 -08:00
Diptanu Choudhury e057c39ea1 Fixed a test 2016-11-08 15:48:47 -08:00