Commit Graph

1747 Commits

Author SHA1 Message Date
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
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 5e98c3ce95 Expose FSM errors into deployment watcher and API
This PR exposes errors returned by the FSM to the deployment watcher and
thus the API. It also adds an error to handle the case of promoting a
deployment that has no eligible canaries.
2017-07-25 16:23:22 -07:00
Alex Dadgar 219ef8a640 parallel deploymentwatcher tests 2017-07-21 19:23:24 -07:00
Alex Dadgar d3409d10c4 Remove comment 2017-07-21 15:55:43 -07:00
Alex Dadgar 0eaea964ed Improve shutdown code 2017-07-21 15:44:51 -07:00
Alex Dadgar 15fad96c21 Merge pull request #2868 from hashicorp/f-feedback
Variety of UX fixes
2017-07-20 17:43:42 -07:00
Alex Dadgar 39e7a26e5d Small fixes and UX changes 2017-07-19 13:34:24 -07:00
Alex Dadgar 30efd5a27a Skip error log on shutdown
This PR fixes the detection of a shutdown scenario and squelches the
error log.
2017-07-19 11:15: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 e51bc66680 Shrink dynamic port range
This PR shrinks the dynamic port range to not overlap with most
operating systems ephemeral port range: https://en.wikipedia.org/wiki/Ephemeral_port
2017-07-18 13:47:53 -07:00
Alex Dadgar cb966e550d fix blocking queries in deployment watcher 2017-07-18 13:02:40 -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 755d20da92 Merge pull request #2830 from hashicorp/b-max-warning
Warn instead of error when max_parallel is greater than count.
2017-07-17 15:35:23 -07:00
Alex Dadgar cd78b99d14 Address feedback 2017-07-17 15:35:14 -07:00
Alex Dadgar 84c2f25e0a Deployment GC ensures no alloc references 2017-07-17 14:09:59 -07:00
Alex Dadgar 311084c724 Allow the deployment to not exist and just no-op 2017-07-17 14:09:59 -07:00
Alex Dadgar f91312a49a Fix typo 2017-07-14 09:53:46 -07:00
Alex Dadgar 7a74080079 Log reason a plan gets rejected per node.
This PR adds a log explaining why a plan gets rejected. Should help
debugging.
2017-07-13 17:14:02 -07:00
Alex Dadgar e71e315950 Fix log line for gc'ing deployments 2017-07-13 15:07:25 -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 3ea8b02826 Merge pull request #2808 from hashicorp/b-restore-periodic
When restoring periodic jobs, take into consideration launch time zone
2017-07-07 16:51:23 -07:00
Alex Dadgar f86760db3c Basic logs 2017-07-07 16:49:08 -07:00
Alex Dadgar d9b8fd126f When restoring periodic jobs, take into consideration launch time zone
Fixes https://github.com/hashicorp/nomad/issues/2721
2017-07-07 16:18:56 -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 08bf34f9a3 Fix JobModifyIndex changing when job is marked stable 2017-07-07 12:12:48 -07:00
Alex Dadgar 9f016606aa Fix some tests, eval monitor shows deployment id and deployment cancels based on 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 de54ffd1f6 Deployment from inplace updates tracks placed properly. 2017-07-07 12:10:04 -07:00
Alex Dadgar bfc22346d5 Return the reverted job version 2017-07-07 12:10:04 -07:00
Alex Dadgar 371b2bdacc add reverted job version to deployment update response 2017-07-07 12:10:04 -07:00
Alex Dadgar a7fdc74bd4 feedback 2017-07-07 12:10:04 -07:00
Alex Dadgar 5457bb7962 Job stability 2017-07-07 12:10:04 -07:00
Alex Dadgar d07a5a2008 Complete deployments mark jobs as stable
This PR allows jobs to be marked as stable automatically by a successful
deployment.
2017-07-07 12:10:04 -07:00
Alex Dadgar 454083ba1b Remove canary 2017-07-07 12:10:04 -07:00
Alex Dadgar 952a22fb02 plan apply tests 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 2e2fd26bed Update index 2017-07-07 12:07:08 -07:00
Alex Dadgar ecee5e370e initial watcher 2017-07-07 12:07:08 -07:00
Alex Dadgar 43d2db1c14 Small fixes 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 95c7a5bcf3 job history 2017-07-07 12:05:57 -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 c643e6b0d1 Add config options 2017-07-07 12:05:56 -07:00
Alex Dadgar f233629a4f job deployment endpoint + api 2017-07-07 12:05:56 -07:00
Alex Dadgar 73325f888f deployment api 2017-07-07 12:03:11 -07:00
Alex Dadgar 580eed5c88 HTTP Endpoints 2017-07-07 12:03:11 -07:00
Alex Dadgar dad9e69822 more comment fixes 2017-07-07 12:03:11 -07:00
Alex Dadgar 5fdee898b2 simplify the batcher's timers 2017-07-07 12:03:11 -07:00
Alex Dadgar 7154e4e08f Remove setters 2017-07-07 12:03:11 -07:00
Alex Dadgar c189948ad2 comments on watcher 2017-07-07 12:03:11 -07:00
Alex Dadgar 79632d65c1 fix index 2017-07-07 12:03:11 -07:00
Alex Dadgar 8f4b22c1e1 Fix tests 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 6f821beec4 fix integration slightly 2017-07-07 12:03:11 -07:00
Alex Dadgar 7af65aa3d7 Add watcher to server 2017-07-07 12:03:11 -07:00
Alex Dadgar 3216b44af2 comments 2017-07-07 12:03:11 -07:00
Alex Dadgar bf52b401a5 batch test 2017-07-07 12:03:11 -07:00
Alex Dadgar f35a12b47b Fix unnecessary evals 2017-07-07 12:03:11 -07:00
Alex Dadgar c52790e448 more tests 2017-07-07 12:03:11 -07:00
Alex Dadgar b4c8f56570 Deployment watcher 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 eec3cefee4 state store 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 e782c4efbe Plan reuses job where possible 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 d8a816ccee Merge pull request #2750 from hashicorp/b-system-jobs-running
System jobs should be running until stopped
2017-07-03 14:47:31 -07:00
Michael Schurter 6e7cc3964e Merge pull request #2709 from hashicorp/f-advertise-docker-ips
Advertise driver-specific addresses
2017-07-03 14:04:12 -07:00
Michael Schurter 8d3e13ab8a System jobs without evals are running too 2017-07-03 13:48:51 -07:00
Michael Schurter f7d2a74ddf System jobs should be running until stopped
Prior to this commit they would be marked as dead if they had no
currently running allocations -- even though they would spring back to
life (running) if the cluster state changed such that a new eval+alloc
was created.
2017-06-28 11:39:24 -07:00
Michael Schurter 9c56f70d12 Validate job updates
Incurs a local read-before-write but because validation is transitive
there's no need to retry the read-validate-write on concurrent updates.
2017-06-27 16:08:18 -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 bbcea0dff9 Update consul/api and comment to custom http.Client 2017-05-30 15:11:32 -07:00
Michael Schurter 6f2ecdec27 Update consul/api and fix tls handling
Since I was already fixing consul's tls handling in #2645 I decided to
update consul/api and pre-emptively fix our tls handling against the
newest consul/api behavior. consul/api's handling of http.Transports has
improved but would have broken how we handled tls (again).

This would have made for a nasty surprise the next time we updated
consul/api.
2017-05-30 15:11:32 -07:00
Michael Schurter 26ee0e6051 Fix diff test 2017-05-26 17:05:14 -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
Alex Dadgar 6d76fb2f17 Merge branch 'master' of github.com:hashicorp/nomad 2017-05-17 14:46:03 -07:00
Alex Dadgar ee8dd84965 Fix nil job on allocation
The way the copying was happening on the alloc_runner was by temporarily
setting the alloc.Job to nil, copying and then restoring it. This
created an issue in which when the alloc was shared (which it is in
server/client mode and between alloc_runner/task_runner) there were race
conditions that could create a panic.

Fixes https://github.com/hashicorp/nomad/issues/2605
2017-05-17 14:07:06 -04:00
Michael Schurter 06f937bf28 Merge pull request #2591 from hashicorp/b-2180-script-updates
Properly interpolate services on updated tasks
2017-05-17 09:09:01 -07:00
Alex Dadgar d3012f1447 Fix Vault Client panic when given nonexistant role
The Vault API returns a nil secret and nil error when reading an object
that doesn't exist. The old code assumed an error would be returned and
thus will panic when trying to validate a non-existant role.
2017-05-16 12:59:58 -04:00
Michael Schurter a4e2463477 Fix consul.verify_ssl
Was getting ignored and would have defaulted to false if it wasn't
ignored.

Now defaults to true as per docs and isn't ignored.
2017-05-15 15:32:32 -07:00
Alex Dadgar 67920c32b5 Merge branch 'master' of github.com:hashicorp/nomad 2017-05-11 14:55:17 -07:00
Alex Dadgar 079a4da7d2 Fix flaky test: TestServer_RPC_MixedTLS 2017-05-11 14:55:12 -07:00
Alex Dadgar 919c50ba5c Merge branch 'master' into f-update-block 2017-05-11 13:08:31 -07:00
Alex Dadgar 9a4dd71b6f Merge pull request #2621 from hashicorp/f-deployments
Deployment object and new Plan Apply FSM codepath
2017-05-11 13:08:19 -07:00
Alex Dadgar 83f5e65aae Plan allows updating the status of deployments 2017-05-11 12:49:04 -07:00
Alex Dadgar 9a576bafd1 Use a detected struct to hold deployment status for an allocation 2017-05-11 11:09:29 -07:00
Alex Dadgar 71788faacd Easy feedback fixes 2017-05-10 15:26:00 -07:00
Alex Dadgar 3a53bdb669 API defaults use structs default 2017-05-10 13:51:52 -07:00
Alex Dadgar 50eec3ef35 handle upgrading old update block syntax 2017-05-10 13:48:53 -07:00
Alex Dadgar 6232b66ea7 Thread through warnings about deprecations 2017-05-09 20:52:47 -07:00
Alex Dadgar ba70cc4f01 Merge branch 'master' into f-bolt-db 2017-05-09 11:11:55 -07:00
Alex Dadgar 10b040aea3 New update block; still need to handle the upgrade path 2017-05-08 17:44:26 -07:00
Michael Schurter 85210eb92f Update consul/api to support unix socket addrs
Fixes #2594
2017-05-08 11:57:04 -07:00
Alex Dadgar 7078d563cb Create Deployments through plan application 2017-05-05 15:33:19 -07:00
Alex Dadgar 343ff03f02 Deployment struct, state store, fsm persist/restore 2017-05-04 13:37:18 -07:00
Alex Dadgar e65dca8746 Structs 2017-05-04 13:37:17 -07:00
Michael Schurter b6e97d8523 Merge pull request #2587 from weargoggles/patch-1
Verification options for TLS
2017-05-02 10:36:41 -07:00
Alex Dadgar bddedd7aba Don't deepcopy job when retrieving copy of Alloc
This PR removes deepcopying of the job attached to the allocation in the
alloc runner. This operation is called very often so removing reflect
from the code path and the potentially large number of mallocs need to
create a job reduced memory and cpu pressure.
2017-05-01 14:50:34 -07:00
Alex Dadgar b67c40f717 Proper denormalization in optimistic state store 2017-05-01 14:49:57 -07:00
Alex Dadgar aed852782f Merge pull request #2592 from hashicorp/b-gc-race
Protect against nil job in new allocation
2017-05-01 13:54:43 -07:00
Pete Wildsmith 1b8a1614ca reduce to one configuration option
There should be just one option, verify_https_client, which
controls incoming and outgoing validation for the HTTPS wrapper
2017-04-28 10:45:09 +01:00
Alex Dadgar 490601f9d6 Swap validation checks 2017-04-27 10:51:28 -07:00
Alex Dadgar efa91c3d89 Protect against nil job in new allocation 2017-04-26 18:27:27 -07:00
Michael Schurter cafefa049b Properly interpolate services on updated tasks
Previously was interpolating the original task's services again.

Fixes #2180

Also fixes a slight memory leak in the new consul agent. Script check
handles weren't being deleted after cancellation.
2017-04-26 11:22:01 -07:00
Pete Wildsmith c948d2ee27 apply gofmt 2017-04-26 18:58:19 +01:00
Pete Wildsmith 56b122c501 Add verification options to TLS config struct 2017-04-25 23:29:43 +01:00
Alex Dadgar 367f4b592f docs 2017-04-20 11:14:06 -07:00
Alex Dadgar 321e01988a Don't allow revert to current version 2017-04-20 11:14:06 -07:00
Alex Dadgar 1b97c9abdd Revert server endpoint 2017-04-20 11:14:06 -07:00
Alex Dadgar ac5d65704f Structs 2017-04-20 11:14:06 -07:00
Michael Schurter 5c621980da Fix diff test + bonus upgrade to subtests 2017-04-19 12:42:48 -07:00
Michael Schurter 947e31e9c2 Only register HTTPS agent check when Consul>=0.7.2
Support for TLSSkipVerify in other checks coming soon!
2017-04-19 12:42:48 -07:00
Michael Schurter 33318501b6 Backoff on Consul lookup failures 2017-04-19 12:42:47 -07:00
Michael Schurter e204a287ed Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

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

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

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

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Alex Dadgar 5a2449d236 Respond to review comments 2017-04-19 10:54:03 -07:00
Alex Dadgar 1769fe468a Fix some tests 2017-04-17 19:39:20 -07:00
Alex Dadgar e7b128271f Diff code fixes 2017-04-16 16:54:40 -07:00
Alex Dadgar 7b3f3f80fb Status shows type of job 2017-04-15 17:08:05 -07:00
Alex Dadgar 34332af70e GC and some fixes 2017-04-15 17:08:05 -07:00
Alex Dadgar 3145086a42 non-purge deregisters 2017-04-15 17:08:05 -07:00
Alex Dadgar 7abcdff7fd GetJobVersions server endpoint 2017-04-15 17:08:05 -07:00
Alex Dadgar fda44689b7 Histories -> Versions 2017-04-15 17:08:05 -07:00
Alex Dadgar f97664512b Upsert Job Histories 2017-04-15 17:08:05 -07:00
Alex Dadgar d489ed3c7d Job History schema 2017-04-15 17:08:05 -07:00
Alex Dadgar a331a234d4 NewEvalBroker comment 2017-04-14 15:26:54 -07:00
Alex Dadgar a9c8b09da8 Push to configs 2017-04-14 15:24:55 -07:00
Alex Dadgar 8aec604e3f Easy feedback fixes 2017-04-14 13:19:14 -07:00
Alex Dadgar df7d59051f Reaping failed evaluations creates follow up eval
Create a follow up evaluation when reaping failed evaluations. This
ensures that a job will still make eventual progress.
2017-04-12 14:47:59 -07:00
Alex Dadgar ef875f6dda Delay Nack re-enqueue
Add a delay when an evaluation is nacked that starts off small but
compounds to a larger delay for subsequent Nacks. This creates some
back pressure.
2017-04-12 13:41:40 -07:00
Alex Dadgar c261fe324e Fix a panic during plan evaluation
This PR fixes a potential source of a panic while evaluating a plan with
all_at_once set to true with partial failures.

Fixes #2531
2017-04-10 14:56:21 -07:00
Michael Schurter a81c387adf Require TLS for server RPC when enabled
Fixes #2525

We used to be checking a RequireTLS field that was never set. Instead we
can just check the TLSConfig.EnableRPC field and require TLS if it's
enabled.

Added a few unfortunately slow integration tests to assert the intended
behavior of misconfigured RPC TLS.

Also disable a lot of noisy test logging when -v isn't specified.
2017-04-06 09:34:36 -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
Alex Dadgar 54a4d01bf6 Fix error checking 2017-03-29 13:59:43 -07:00
Michael Schurter ae3810052d Merge pull request #2482 from hashicorp/f-2289-better-artifact-err
Improve artifact download error message
2017-03-28 12:48:22 -07:00
Michael Schurter 2d07b75308 Recoverable struct field must be exported 2017-03-28 12:18:57 -07:00
Alex Dadgar 7bcf40bf65 Merge pull request #2489 from hashicorp/b-immediate-periodic
Fix dispatch of periodic job
2017-03-28 11:13:50 -07:00
Alex Dadgar 103e8d21fb Fix dispatch of periodic job
This PR fixes an issue in which when a periodic and parameterized job
was dispatched, an allocation would be immediately created.

Fixes https://github.com/hashicorp/nomad/issues/2470
2017-03-27 16:55:17 -07:00
Michael Schurter 507862ade3 Add WrapRecoverable helper 2017-03-27 15:37:15 -07:00
Alex Dadgar 787be30f13 Fix periodic job state
This PR fixes an issue in which a periodic job would incorrectly
transistion to status dead.

Fixes https://github.com/hashicorp/nomad/issues/2268
2017-03-27 10:35:36 -07:00
Michael Schurter 0e6c564406 Improve artifact download error message
Fixes #2289

Unfortunately took more RecoverableError hijinx than I would have liked.
There might be a better way.
2017-03-24 15:26:05 -07:00
Alex Dadgar 3b323603b5 Fix diff alignment and remove no change DC
Old Output:
```
+/- Job: "example"
    Datacenters {
  Datacenters: "dc1"
}
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
  }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
  }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
    }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
    }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
      }
    }
```

New Output:
```
+/- Job: "example"
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
      }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
      }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
        }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
        }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
          }
        }
```
2017-03-21 11:42:10 -07:00
Alex Dadgar df9ce2680b Fix output alignment and remove no-change DC
Old Output:

```
+/- Job: "example"
    Datacenters {
  Datacenters: "dc1"
}
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
  }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
  }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
    }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
    }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
      }
    }
```

New Output:

```
+/- Job: "example"
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
      }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
      }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
        }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
        }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
          }
        }
```
2017-03-21 11:31:06 -07:00
Alex Dadgar 5588fd6c04 Merge pull request #2432 from hashicorp/b-batch-gc
Eval GC will collect allocs from stopped batch job
2017-03-13 10:06:55 -07:00
Alex Dadgar 56ac0970b4 validation errors 2017-03-11 16:23:24 -08:00
Alex Dadgar 3825f7cf1f Eval GC will collect allocs from stopped batch job
This PR fixes a bug in which allocations from stopped batch jobs could
not be garbage collected.
2017-03-11 15:48:57 -08:00
Alex Dadgar 33263ca085 Merge pull request #2418 from hashicorp/f-distinct-property
`distinct_property` constraint
2017-03-09 22:15:52 -08: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 abefe537ba Correct error message re length of service name
The error message had an off-by-one error :)
2017-03-08 15:12:30 +01:00
Alex Dadgar d83a8fe9f2 Unoptimized implementation + testing 2017-03-07 14:48:54 -08:00
Alex Dadgar c1d4927088 Debug lines 2017-03-06 10:25:26 -08:00
Alex Dadgar 634cb3365f Remove dead code 2017-03-03 18:27:49 -08:00
Alex Dadgar 3b9bdfef1c Make validate work without a Nomad agent 2017-03-03 15:02:03 -08:00
Alex Dadgar c58494fdb6 Handle periodic paramaterized jobs
Fixes https://github.com/hashicorp/nomad/issues/2382
2017-03-01 11:45:20 -08:00
Alex Dadgar e21792091a remove leading slash on vault path 2017-02-28 14:03:18 -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 c71cd02edf Fix typo 2017-02-27 11:40:24 -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
Alex Dadgar d2cbbac76e Merge pull request #2347 from hashicorp/b-parse
Remove defaulting from parse and fix tests
2017-02-22 18:42:43 -08:00
Diptanu Choudhury 98921575af Adding a task event for setup 2017-02-22 18:28:07 -08:00
Alex Dadgar ed670f0226 Revert "Deregistering non-existant job returns 404" 2017-02-22 18:22:02 -08:00
Alex Dadgar eae24d7d3f Fix flakey test TestNetworkIndex_AssignNetwork_Dynamic_Contention 2017-02-22 15:58:21 -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 1e5183fb89 Deregistering non-existant job returns 404
Fixes https://github.com/hashicorp/nomad/issues/2326
2017-02-20 20:10:21 -08:00
Alex Dadgar b49fceb491 rebase 2017-02-20 16:43:28 -08:00
Alex Dadgar b67c59f03c Merge branch 'master' into refactor-parser 2017-02-20 15:13:21 -08:00
Alex Dadgar b2ee70472d Merge pull request #2331 from hashicorp/b-dispatch-response
swap structs
2017-02-17 11:44:19 -08:00
Alex Dadgar e06056fa82 swap structs 2017-02-17 11:43:14 -08:00