Commit Graph

808 Commits

Author SHA1 Message Date
Charlie Voiselle eda764c0ca Review feedback + re-add dropped import 2017-11-13 12:51:19 -05:00
Charlie Voiselle 4b186861a9 gofmt and goimports nomad/structs/structs.go 2017-11-13 12:32:52 -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
Preetha 0d0804d6ff
Merge pull request #3496 from hashicorp/b-auto-revert-stable
Makes auto reverts robust against infinite revert cycles
2017-11-03 17:28:28 -05:00
Preetha Appan 7526853b4b Added more unit tests for testing rollback when job has identical spec to AllocHealth and DeploymentStatus endpoints. 2017-11-03 16:07:06 -05:00
Preetha Appan 317fbf04b1 Adds SpecChanged check to alloc health and fail deployment end points, and other code review comments. 2017-11-03 15:33:34 -05:00
Preetha Appan 0eaef09675 Remove event GenericSource, and address other code review comments. Also added deprecation info in comments. 2017-11-03 10:10:06 -05:00
Preetha Appan 7672535290 Added explanatory comment 2017-11-03 09:13:01 -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 5505391663 Fixes auto revert to check if the job's spec has changed before reverting. This prevents infinite reverting when reverting to a job version that was previously stable, but not so after attempting a revert. 2017-11-02 19:53:27 -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
Alex Dadgar ae6be0dac7 spelling mistake 2017-10-23 15:12:45 -07:00
Alex Dadgar d3e119f4d0 thread leader token through core gc and test 2017-10-23 15:04:00 -07:00
Alex Dadgar c1cc51dbee sync 2017-10-13 14:36:02 -07:00
Michael Schurter 84d8a51be1 SecretID -> AuthToken 2017-10-12 15:16:33 -07:00
Alex Dadgar 53f2ea88a5 Small fixes
This commit:

* Fixes the error checking in migration tests now that we are using the
canonical ErrPermissionDenied error
* Guard against NPE when looking up objects to generate the migration
token
* Handle an additional case in ShouldMigrate()
2017-10-11 17:13:50 -07:00
Chelsea Holland Komlo c67bfc2ee4 fixups from code review
change creation of a migrate token to be for a previous allocation
2017-10-11 17:13:50 -07:00
Chelsea Holland Komlo 36ad6bc6bf add MigrateTokens to server response for allocs 2017-10-11 17:09:20 -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 4173834231 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar e5ec915ac3 sync 2017-09-19 10:08:23 -05:00
Michael Schurter c98b79dcb4 Test CheckRestart.Validate 2017-09-15 15:12:47 -07:00
Michael Schurter 573a0df03d Watched -> TriggersRestart
Watched was a silly name
2017-09-14 16:48:39 -07:00
Michael Schurter d299d42089 Canonicalize and Merge CheckRestart in api 2017-09-14 16:48:39 -07:00
Michael Schurter ade29ecbed Improve check watcher logging and add tests
Also expose a mock Consul Agent to allow testing ServiceClient and
checkWatcher from TaskRunner without actually talking to a real Consul.
2017-09-14 16:47:41 -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 22690c5f4c Add check watcher for restarting unhealthy tasks 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 3904bde9a3 Fix batch handling of complete allocs/node drains
This PR fixes:
* An issue in which a node-drain that contains a complete batch alloc
would cause a replacement
* An issue in which allocations with the same name during a scale
down/stop event wouldn't be properly stopped.
* An issue in which batch allocations from previous job versions may not
have been stopped properly.

Fixes https://github.com/hashicorp/nomad/issues/3210
2017-09-14 15:08:57 -07:00
Alex Dadgar 6911bd7676 Worker waits til max ModifyIndex across EvalsByJob
This PR fixes a scheduling race condition in which the plan results from
one invocation of the scheduler were not being considered by the next
since the Worker was not waiting for the correct index.

Fixes https://github.com/hashicorp/nomad/issues/3198
2017-09-14 14:28:43 -07:00
Armon Dadgar 20a8e590a0 nomad: support ACL bootstrap reset 2017-09-10 16:03:30 -07:00
Alex Dadgar 84d06f6abe Sync namespace changes 2017-09-07 17:04:21 -07:00
Armon Dadgar 97404e3f8c nomad: compute hash for ACL policies and tokens 2017-09-04 13:09:34 -07:00
Armon Dadgar ac6283c31f nomad: enforce ACLs on job submit 2017-09-04 13:05:53 -07:00
Armon Dadgar 387a8a923b nomad: adding policy subset check 2017-09-04 13:05:53 -07:00
Armon Dadgar ddcc5f89bc Add ErrPermissionDenied, rename TokenNotFound 2017-09-04 13:05:53 -07:00
Armon Dadgar 304a02d93b nomad: Add SecretID to QueryOptions and WriteMeta 2017-09-04 13:05:53 -07:00
Armon Dadgar e24a4abf2c nomad: adding ACL bootstrap endpoints 2017-09-04 13:05:53 -07:00
Armon Dadgar edc38185cc noamd: Adding batch fetch endpoints for ACL tokens and policies 2017-09-04 13:05:36 -07:00
Armon Dadgar 6a9d4e2dc3 nomad: Adding token resolution endpoint 2017-09-04 13:05:36 -07:00
Armon Dadgar 99cea1ac23 Moving shared ACL objects 2017-09-04 13:04:45 -07:00
Armon Dadgar 583a11cebd nomad: Adding ability to filter list of tokens to global only 2017-09-04 13:04:45 -07:00
Armon Dadgar 30b607987e nomad: generate accessor/secret ID server side 2017-09-04 13:04:45 -07:00
Armon Dadgar bd2db18c80 agent: Adding HTTP endpoints for ACL tokens 2017-09-04 13:04:45 -07:00
Armon Dadgar e5c69f162c nomad: implement ACL token endpoints 2017-09-04 13:04:45 -07:00
Armon Dadgar e9c583807a nomad: adding ACLToken struct 2017-09-04 13:04:45 -07:00
Armon Dadgar 3702587667 nomad: Adding Validate for ACLPolicy 2017-09-04 13:04:44 -07:00
Armon Dadgar d52e099fc2 Addressing @dadgar feedback 2017-09-04 13:03:15 -07:00
Armon Dadgar afdde24799 nomad: adding upsert policy endpoint 2017-09-04 13:03:15 -07:00
Armon Dadgar e3e243f433 nomad: implement policy delete endpoint 2017-09-04 13:03:15 -07:00
Armon Dadgar e4f5f305ea nomad: adding Get/List endpoints for ACL policies 2017-09-04 13:03:15 -07:00
Armon Dadgar 4cb544e8f3 nomad: Adding CRUD to state store for ACL Policies 2017-09-04 13:03:14 -07:00
Alex Dadgar be72602616 Allow distinct_host to have L/RTarget set
This PR removes validation that could break job backwards compatibility.
The targets are ignored so there is no side effects.

Fixes https://github.com/hashicorp/nomad/issues/3130
2017-08-30 10:30:01 -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
Chelsea Holland Komlo 6243690899 migrate all context 2017-08-28 05:29:38 +00:00
Alex Dadgar 7ce6c4f6f6 Add QueryOptions to SearchRequest 2017-08-26 15:56:13 -07:00
Clint Armstrong dc8eab6adc Set MaxParallel default to 1 2017-08-25 07:56:40 -04: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
Chelsea Komlo 49542712f9 Merge pull request #3068 from hashicorp/f-add-deployments-search-api
Add deployments to search api
2017-08-21 16:34:00 -04:00
Chelsea Holland Komlo 50c20b1801 add deployments to search api 2017-08-21 15:20:55 +00: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
Alex Dadgar fdb8df4a55 Merge pull request #3024 from hashicorp/f-no-revert-target
Deployment desc  when no stable job and autorevert
2017-08-15 12:24:09 -07:00
Chelsea Komlo b9f189495a Merge pull request #2995 from hashicorp/f-allocation-autocomplete
Allocation autocomplete, client api
2017-08-14 15:26:39 -04: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 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
Michael Schurter b1731d90df Fix timeout validation for script checks
It appears this was disabled a year ago when defaulting and validation
code was probably different: 91bbc5c3c769f4f17134dbc603ec677a178a9e9e

Fixes an issue reported via the mailing list:
https://groups.google.com/d/msg/nomad-tool/yiPCTfOpYn4/yv7MMPUABQAJ
2017-08-14 10:23:52 -07:00
Alex Dadgar f64b05a001 Deployment desc when no stable job and autorevert
This PR adds a specialized description when the job has autorevert set
and there is no job to revert to.
2017-08-12 15:50:51 -07: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
Alex Dadgar 79d25b7db9 Merge pull request #2947 from hashicorp/f-vault-grace
Allow template to set Vault grace
2017-08-07 16:29:53 -07:00
Luke Farnell f0ced87b95 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Chelsea Holland Komlo f110fa5c0d syntax fixups and logging 2017-08-07 14:26:53 +00:00
Chelsea Holland Komlo 1b77f9a216 further refactoring 2017-08-04 22:50:41 +00:00
Chelsea Holland Komlo 1eff731d8b further refactoring 2017-08-04 15:19:35 +00:00
Chelsea Holland Komlo b2b4c5d7af add documentation
extract magic number into variable
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 92cc40f1de change resources endpoint from http get to post 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 64a83edd9f remove resourceliststub, no need for another layer of abstraction 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 4dd6b46198 Retrieve job information for resources endpoint
requires further refactoring and logic for more contexts
2017-08-04 14:34:25 +00: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 2650bb1d12 Distinct Property supports arbitrary limit
This PR enhances the distinct_property constraint such that a limit can
be specified in the RTarget/value parameter. This allows constraints
such as:

```
constraint {
  distinct_property = "${meta.rack}"
  value = "2"
}
```

This restricts any given rack from running more than 2 allocations from
the task group.

Fixes https://github.com/hashicorp/nomad/issues/1146
2017-07-31 16:52:13 -07:00
Michael Schurter 7cbae6e168 Merge pull request #2899 from hashicorp/d-mention-env-in-init
Mention env templates in nomad init
2017-07-26 11:17:47 -07:00
Michael Schurter b1c65ca390 Prevent using env templates with signals 2017-07-25 16:34:41 -07:00
Alex Dadgar 9c655e1208 Validate that min_healthy_time < healthy_deadline
This PR adds a validation check to the update stanza to ensure that the
min_healthy_time is feasible.
2017-07-25 16:30:53 -07:00
Alex Dadgar e1888e822c Merge pull request #2841 from hashicorp/b-rolling-no-fit
Treat destructive updates atomically
2017-07-19 11:11:25 -07:00
Alex Dadgar 22e84d00ab Fix deep copy of driver config 2017-07-17 17:53:21 -07:00
Alex Dadgar 641e178416 Stop before trying to place 2017-07-17 17:18:12 -07:00
Alex Dadgar cd78b99d14 Address feedback 2017-07-17 15:35:14 -07:00
Alex Dadgar aa2126cc1a Warn instead of error when max_parallel is greater than count.
Fixes https://github.com/hashicorp/nomad/issues/2819
2017-07-13 13:10:45 -07:00
Alex Dadgar 79ce4bdfc6 Merge pull request #2807 from hashicorp/f-validate-ports
Prevent port conflicts
2017-07-07 16:59:18 -07:00
Alex Dadgar 6cde454509 Handle same task reserving ports twice 2017-07-07 16:58:20 -07:00
Alex Dadgar f86760db3c Basic logs 2017-07-07 16:49:08 -07:00
Michael Schurter e2a79d330c Prevent port conflicts
Validate that no two tasks in the same task group can reserve the same
static port.
2017-07-07 16:17:05 -07:00
Michael Schurter 517c799439 Validate job type
Fixes #2722
2017-07-07 15:34:26 -07:00
Alex Dadgar 45712c6ca3 test fixes 2017-07-07 14:11:27 -07:00
Alex Dadgar 3a29b38108 Status description shows requiring promotion 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 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 371b2bdacc add reverted job version to deployment update response 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 477c713df5 Plan apply handles canaries and success is set via update 2017-07-07 12:10:04 -07:00
Alex Dadgar e229d3650b Attach eval id 2017-07-07 12:10:04 -07:00
Alex Dadgar af1935e1e1 Mark complete 2017-07-07 12:10:04 -07:00
Alex Dadgar c10d7ab871 Remove promoted bit from allocation 2017-07-07 12:10:04 -07:00
Alex Dadgar 09dfa2fc10 Rename CreateDeployments and remove cancelling behavior in state_store 2017-07-07 12:10:04 -07:00
Alex Dadgar ecee5e370e initial watcher 2017-07-07 12:07:08 -07:00
Alex Dadgar e7034691ea deployment status 2017-07-07 12:07:07 -07:00
Alex Dadgar 57cbbf87f8 deployment list 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 b64185a3f1 Deployment GC
This PR implements the garbage collector for deployments. Deployments
will by default be garbage collected after 1 hour.
2017-07-07 12:05:57 -07:00
Alex Dadgar 73325f888f deployment api 2017-07-07 12:03:11 -07:00
Alex Dadgar c189948ad2 comments on watcher 2017-07-07 12:03:11 -07:00
Alex Dadgar 87d187d777 Tests 2017-07-07 12:03:11 -07:00
Alex Dadgar 423e5b45da FailDeployment 2017-07-07 12:03:11 -07:00
Alex Dadgar c52790e448 more tests 2017-07-07 12:03:11 -07:00
Alex Dadgar 013085a62e Watcher 2017-07-07 12:03:11 -07:00
Alex Dadgar 80dc4d66d8 Deployments list 2017-07-07 12:03:11 -07:00
Alex Dadgar 6688a3f76c FSM Tests 2017-07-07 12:03:11 -07:00
Alex Dadgar d04877d23c initial impl 2017-07-07 12:03:11 -07:00
Alex Dadgar 3f04bb7f26 SpecChanged doesn't mutate passed job 2017-07-07 12:03:11 -07:00
Alex Dadgar b2573b01f9 Fix canary handling 2017-07-07 12:03:11 -07:00
Alex Dadgar 7952240d69 Deployment tests 2017-07-07 12:03:11 -07:00
Alex Dadgar c77944ed29 assign names 2017-07-07 12:03:11 -07:00
Alex Dadgar 270e26c600 Populate desired state per tg 2017-07-07 12:03:11 -07:00
Alex Dadgar cf5baba808 handle annotations 2017-07-07 12:03:11 -07:00
Alex Dadgar d5ea5a16fd Small cleanup 2017-07-07 12:03:11 -07:00
Alex Dadgar 07b1c3e5db Only upsert a job if the spec changes and push deployment creation into reconciler 2017-07-07 12:03:11 -07:00
Alex Dadgar 0d42b5d421 initial reconciler 2017-07-07 12:01:17 -07:00
Alex Dadgar b3f4db0930 cancel deployments 2017-07-07 12:01:17 -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 73c696e717 Remove readme 2017-06-21 17:19:08 -07:00
Michael Schurter 8d440b1675 Skip DRIVER env vars for labels without a port mapping 2017-06-21 17:19:08 -07:00
Michael Schurter c0eff81383 Fix Service.AddressMode changes during task updates 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 10b6610e56 Functional consul template env file support 2017-05-23 13:45:14 -07:00
Alex Dadgar 4503e2d1f7 Merge pull request #2634 from hashicorp/f-update-block
New Update block syntax
2017-05-18 13:29:17 -04:00