Commit Graph

1747 Commits

Author SHA1 Message Date
Armon Dadgar 1c7fb1bfbb Remove generated structs 2017-09-04 13:33:37 -07:00
Armon Dadgar 10500c39e5 nomad: fixing test 2017-09-04 13:21:01 -07:00
Armon Dadgar e74ea8a152 nomad: use hashes for efficient token/policy diffing 2017-09-04 13:09:34 -07:00
Armon Dadgar 97404e3f8c nomad: compute hash for ACL policies and tokens 2017-09-04 13:09:34 -07:00
Armon Dadgar 99c1001b2c nomad: avoid replication consistency issues by setting MinQueryIndex 2017-09-04 13:07:44 -07:00
Armon Dadgar b8bf35f087 ACL RPCs allow stale reads for scalability 2017-09-04 13:07:44 -07:00
Armon Dadgar ac6283c31f nomad: enforce ACLs on job submit 2017-09-04 13:05:53 -07:00
Armon Dadgar 6f5150a227 nomad: allow getting policies which are subset of token, fixes client resolution 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 18ddb910fa nomad: forward DeleteToken requests for global tokens 2017-09-04 13:05:53 -07:00
Armon Dadgar b807f5df6f nomad: forward UpsertToken requests for global tokens 2017-09-04 13:05:53 -07:00
Armon Dadgar 3e46094cee Passthrough replication token for token/policy replication 2017-09-04 13:05:53 -07:00
Armon Dadgar 855240b1b5 nomad: ACL endpoints enforce permissions 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 4bda2fa9e9 nomad: ACL endpoints check support enabled and redirect to authority 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 1ace912341 nomad: adding bootstrapping checks 2017-09-04 13:05:53 -07:00
Armon Dadgar 06a7f12fad nomad: adding bootstrap state store method 2017-09-04 13:05:53 -07:00
Armon Dadgar 76a03f2d8e Address @dadgar feedback 2017-09-04 13:05:53 -07:00
Armon Dadgar e7586a80df nomad: Switch from SHA1 to Blake2 @chelseakomlo 2017-09-04 13:05:36 -07:00
Armon Dadgar fc23a4e7e5 structs: sort policies to avoid order dependence for caching 2017-09-04 13:05:36 -07:00
Armon Dadgar 459c2b6fa7 nomad: switch policy/token replication to use batch endpoints 2017-09-04 13:05:36 -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 d9c56725d0 nomad: refactor to use CompileACLObject and handle anonymous token 2017-09-04 13:05:35 -07:00
Armon Dadgar 98e0f98f7e structs: Adding ACL compilation helper 2017-09-04 13:05:35 -07:00
Armon Dadgar 583e654246 structs: cache key helper for policy list 2017-09-04 13:05:35 -07:00
Armon Dadgar 3efdf1f7d9 Address @chelseakomlo comments 2017-09-04 13:04:45 -07:00
Armon Dadgar 99cea1ac23 Moving shared ACL objects 2017-09-04 13:04:45 -07:00
Armon Dadgar dc1904b57a nomad: adding ACL token resolution logic 2017-09-04 13:04:45 -07:00
Armon Dadgar 018973aea8 Address @dadgar feedback 2017-09-04 13:04:45 -07:00
Armon Dadgar 5a3a931ec5 nomad: adding global token replication 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 cb827b6696 nomad: adding policy replication support 2017-09-04 13:04:45 -07:00
Armon Dadgar 7d4aa1975f agent: thread through ACL config to Server 2017-09-04 13:04:45 -07:00
Armon Dadgar bc697dc50e Address @dadgar feedback 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 f91d2608cb nomad: renambe PublicID to AccessorID for consistency 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 e9bad0bf37 nomad: Add ACL Token snapshot/restore to FSM 2017-09-04 13:04:45 -07:00
Armon Dadgar a17991e907 nomad: CRUD methods for ACLTokens 2017-09-04 13:04:45 -07:00
Armon Dadgar 8623bf9a5b nomad: adding ACLToken table 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 cde8e9301b nomad: fixing state store tests due to signature mismatch 2017-09-04 13:04:44 -07:00
Armon Dadgar 3702587667 nomad: Adding Validate for ACLPolicy 2017-09-04 13:04:44 -07:00
Armon Dadgar 11672e4e01 nomad: adding validation of policy name and rules 2017-09-04 13:03:15 -07:00
Armon Dadgar 18e6053b58 agent: Adding ACL Policy endpoints 2017-09-04 13:03:15 -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 8a4dda8577 nomad: update method signature for tests 2017-09-04 13:03:15 -07:00
Armon Dadgar f147f25fe5 Addressing @dadgar review feedback 2017-09-04 13:03:15 -07:00
Armon Dadgar 351afa0069 nomad: Upsert and Delete ACL policies can take a list 2017-09-04 13:03:14 -07:00
Armon Dadgar 10b583ea38 nomad: adding FSM snapshot/restore of ACL policies 2017-09-04 13:03:14 -07:00
Armon Dadgar 4cb544e8f3 nomad: Adding CRUD to state store for ACL Policies 2017-09-04 13:03:14 -07:00
Armon Dadgar 85cad11885 nomad: adding policy table to state store 2017-09-04 13:03:14 -07:00
Alex Dadgar ad87c6fba5 Include google compare library 2017-09-01 16:42:09 -07:00
Alex Dadgar 26e66ed1c5 fix checking of context error 2017-09-01 09:53:09 -07:00
Alex Dadgar 4cc8bac48d fix blocking query due to ctx change 2017-08-31 15:34:55 -07:00
Alex Dadgar 62c14c21a5 Merge pull request #3142 from hashicorp/f-deployment-watcher
Deployment watcher takes state store
2017-08-31 10:45:17 -07:00
Alex Dadgar 8c69dd3fd3 Remove panic from testing 2017-08-31 10:42:58 -07:00
Jeremy Olexa f94f237597 Update peers.info message for operators 2017-08-31 08:51:04 -05:00
Alex Dadgar 590ff91bf3 Deployment watcher takes state store 2017-08-30 18:51:59 -07:00
Alex Dadgar c1253619ef Merge pull request #3138 from hashicorp/b-status-length
Search handles prefix longer than allowed UUIDs
2017-08-30 13:32:33 -07:00
Alex Dadgar 346d76dec3 Search handles prefix longer than allowed UUIDs
This PR fixes an issue in which the Search endpoint would error if the
prefix was longer than the allowed 36 characters of a UUID.

Fixes https://github.com/hashicorp/nomad/issues/3134
2017-08-30 10:51:05 -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
Chelsea Komlo a544ee89e1 Merge pull request #3119 from jippi/patch-3
Error message for search API does not include the "all" option
2017-08-29 13:23:44 -04:00
Alex Dadgar 92dc3d3857 Fix even length uuid post hyphen 2017-08-29 09:21:18 -07:00
Christian Winther e4a72782c7 Error message for search API does not include the "all" option 2017-08-29 15:41:21 +02:00
Michael Schurter 28e9fa73f6 Welcome to the brave new world
Committing generated code to help ensure reproducible builds.
2017-08-28 15:51:18 -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
Chelsea Holland Komlo 9968689344 fix up formatting of error message
fixups from code review
2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo 74c51e63bd job names causes errors when searching other contexts, only log but not return this err 2017-08-25 16:42:11 +00:00
Clint Armstrong dc8eab6adc Set MaxParallel default to 1 2017-08-25 07:56:40 -04:00
Alex Dadgar 34485622e1 Merge pull request #3056 from hashicorp/b-auto-revert
Fix purging job versions
2017-08-23 14:20:48 -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
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
Alex Dadgar dfcb73c896 Fix purging job versions
This PR fixes an issue in which the job versions weren't properly
cleaned when removing a job.

Fixes https://github.com/hashicorp/nomad/issues/3052
2017-08-18 15:46:03 -07:00
Michael Schurter c5529bdd16 Put header diff in its own function 2017-08-17 16:49:14 -07:00
Michael Schurter 9a466bcf5e Add diff support for ServiceCheck.Header 2017-08-17 16:49:14 -07:00
Michael Schurter bb8d5689d8 Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Michael Schurter b4813747d0 Merge pull request #3043 from hashicorp/f-2441-shutdown-delay
Add optional shutdown delay to tasks
2017-08-17 14:37:48 -07:00
Michael Schurter 8fdd58f55e Fix ShutdownDelay diff test 2017-08-17 14:05:51 -07:00
Alex Dadgar 782abf4098 Fix race creating EvalFuture
This PR fixes https://github.com/hashicorp/nomad/issues/3044
2017-08-17 13:23:58 -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
Michael Schurter 8693f6d69c Merge pull request #3022 from hashicorp/b-check-validation
Fix timeout validation for script checks
2017-08-14 12:04:02 -07: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 76469614b5 code refactoring and fixups 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 aadec27d36 even in rounding down for queries, full prefixes are matched against ids
only applies to uuids, not jobs
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 9402d330e8 autocomplete for allocation ids 2017-08-14 17:35:35 +00:00
Chelsea Holland Komlo 075aeee73e round down odd prefixes 2017-08-14 17:35:35 +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
James Nugent ae85c548ac build: Apply goimports formatting to various files
The following files were not formatted as the output of goimports(1)
would create, causing the goimports linter to fail:

command/agent/resources_endpoint.go
nomad/resources_endpoint.go
nomad/resources_endpoint_test.go
2017-08-14 11:51:47 +08: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 4a88c4133d Fix broken Template Diff Test 2017-08-08 11:09:27 -07: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 Komlo 5537516bfd Merge pull request #2964 from hashicorp/f-autocomplete-api
autocomplete api
2017-08-07 12:40:09 -07:00
Chelsea Holland Komlo d4fc5160b1 code simplifications and logging 2017-08-07 17:28:46 +00:00
Chelsea Holland Komlo cd0698a87b max index for any resource, if context is unspecified 2017-08-07 15:07:18 +00: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 424e475333 if no context is specified, set maximum index for available contexts 2017-08-04 20:16:49 +00:00
Chelsea Holland Komlo 0b38704392 fix up tests to intantiate assertion test helper
add http tests for remaining contexts
2017-08-04 19:48:20 +00:00
Chelsea Holland Komlo 1eff731d8b further refactoring 2017-08-04 15:19:35 +00:00
Chelsea Holland Komlo 111019642b resources are expected by state store to be plural 2017-08-04 15:07:34 +00:00
Chelsea Holland Komlo 927b6667c7 set response index and meta information
add tests for edge cases
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo b2b4c5d7af add documentation
extract magic number into variable
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo b6f459a7a9 refactor rpc endpoint and tests
add test for when no prefixes are matched

add test for no context at HTTP api
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 7b7a80d6ce resources list endpoint accepts http POST and PUT
set the index for a resources response
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 312bb19e1c refactor and add error handling for invalid context type 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 98fe705dff adding allocations to resouces list endpoint
adding nodes to resources list endpoint
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 2759ffe2d2 refactor to remove duplication for types of resources 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 0026a308ec add truncation boolean to response 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 06f10d2e5f adds evaluations
makes context singular
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 5192dacf85 limit resources results to 20 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 197c411767 refactor test helper 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 377b059e5e remove unnecessary validations; these are tested elsewhere 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 2284e59b57 Fix double close and cleanup code 2017-08-03 13:40:34 -07:00
Alex Dadgar 146f3f5cb2 Don't restore parameterized periodic jobs 2017-08-03 12:37:58 -07: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 265e18b8ac Test for template envvar validation 2017-07-25 20:27:18 -07:00
Alex Dadgar a9c786a4fe Make test Vault pick random ports 2017-07-25 17:40:59 -07:00
Alex Dadgar 06eddf243c parallel nomad tests 2017-07-25 17:39:36 -07:00
Alex Dadgar 8dc8e17c1b Merge pull request #2907 from hashicorp/b-promote-err
Expose FSM errors into deployment watcher and API
2017-07-25 17:31:33 -07:00
Michael Schurter b1c65ca390 Prevent using env templates with signals 2017-07-25 16:34:41 -07:00