Commit Graph

248 Commits

Author SHA1 Message Date
Preetha Appan 28364331cc
New structs and methods for reschedule policy, reschedule tracking and unit tests 2018-01-31 09:56:53 -06:00
Michael Schurter 8a0cf66822 Improve invalid port error message for services
Related to #3681

If a user specifies an invalid port *label* when using
address_mode=driver they'll get an error message about the label being
an invalid number which is very confusing.

I also added a bunch of testing around Service.AddressMode validation
since I was concerned by the linked issue that there were cases I was
missing. Unfortunately when address_mode=driver is used there's only so
much validation that can be done as structs/structs.go validation never
peeks into the driver config which would be needed to verify the port
labels/map.
2018-01-18 15:35:24 -08:00
Filip Ochnik fc99d3fc2d Prevent absolute URLs in checks paths 2017-12-21 10:32:12 +01:00
Michael Schurter 714eb0b266 Services should not require a port
Fixes #3673
2017-12-19 15:50:23 -08:00
Alex Dadgar 86608124ca Fix followers not creating periodic launch
Fix an issue in which periodic launches wouldn't be made on followers.
2017-12-11 13:55:17 -08:00
Michael Schurter 0d8995fb83 Improve validation and testing of service/check ports 2017-12-08 13:52:23 -08:00
Chelsea Holland Komlo 3f231a0856 add test for kill signal in required signals
update changelog
2017-12-07 11:40:15 -05:00
Preetha Appan d3110f21bd Changes service name validation logic to ignore any environment variables first. 2017-11-15 15:35:43 -06: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
Preetha Appan b86c5a99b1 Unit test for PopulateEventDisplayMessage 2017-11-03 09:13:01 -05:00
Alex Dadgar d34c6e0135 fix test 2017-10-11 18:08:37 -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
Michael Schurter c98b79dcb4 Test CheckRestart.Validate 2017-09-15 15:12:47 -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 387a8a923b nomad: adding policy subset check 2017-09-04 13:05:53 -07:00
Armon Dadgar e9c583807a nomad: adding ACLToken struct 2017-09-04 13:04:45 -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
Clint Armstrong dc8eab6adc Set MaxParallel default to 1 2017-08-25 07:56:40 -04: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 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 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 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
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 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 c77944ed29 assign names 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 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 10b040aea3 New update block; still need to handle the upgrade path 2017-05-08 17:44:26 -07:00
Alex Dadgar 56ac0970b4 validation errors 2017-03-11 16:23:24 -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 7e918003ba Allow specification of timezones 2017-02-15 14:37:06 -08:00
Alex Dadgar dbc4eac936 Merge pull request #2309 from hashicorp/f-no-root-token
Disallow root policy from being specified
2017-02-14 11:06:31 -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 7d158a5a7f Validate the interval within a restart policy
This PR ensures that the interval specified is not less than 5 seconds.

Fixes https://github.com/hashicorp/nomad/issues/2286
2017-02-13 15:27:36 -08:00
Alex Dadgar 0b2e2971fd Disallow root policy from being specified
This PR disallows the specification of a root policy by a Nomad task.
2017-02-13 10:51:29 -08:00
Alex Dadgar 3ba8faeae3 Add leader task to api and server side 2017-02-10 16:57:47 -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 295c2bf74a Merge pull request #2186 from hashicorp/f-driver-cleanup
Add Cleanup method to Driver interface
2017-01-20 13:02:14 -08:00
Michael Schurter 1f7b5b4b47 Rename Constructor -> Parameterized Job 2017-01-20 12:43:10 -08:00
Diptanu Choudhury b2a494c24e Ensuring we can register service names with duplicate name but different ports 2017-01-17 12:26:07 -08:00
Michael Schurter a3a3656dbb Switch to use recoverable errors from Cleanup
TaskRunner handles retrying but Cleanup handles all of CreatedResources.
2017-01-13 16:46:08 -08:00
Alex Dadgar 072ff1c3ee ensure file doesn't escape 2016-12-18 15:48:30 -08:00
Alex Dadgar aa904b495e Require batch 2016-12-16 15:20:12 -08:00
Alex Dadgar 5a742528c9 dispatch help 2016-12-14 15:19:27 -08:00
Alex Dadgar 54bcde8e36 Dispatch structs 2016-11-23 15:03:13 -08:00
Alex Dadgar 3f69ab130e can not -> cannot 2016-11-01 16:05:51 -07:00
Alex Dadgar cf38103b85 Change the 0 timeout, interval validation to be more user friendly 2016-11-01 16:05:51 -07:00
Alex Dadgar 4082732d3a Interpolate and then validate services 2016-10-25 14:27:49 -07:00
Alex Dadgar 8e07c2750e Merge pull request #1839 from hashicorp/f-signal-constraints
Signal creates an auto-constraints
2016-10-25 11:09:33 -07:00
Alex Dadgar aadc9e3017 Add implicit signal constraint and validate that a driver can handle the signal. Also fixes a bug with plan and implicit constraints by adding them to the job being planned 2016-10-20 13:55:35 -07:00
Diptanu Choudhury 7f17c93f89 Ensuring that ephemeral disk is present before deciding if we should migrate (#1827) 2016-10-19 11:12:25 -07:00
Alex Dadgar af036be754 Struct/api/parsing 2016-10-18 11:24:20 -07:00
Alex Dadgar 3d0edaa91e Ensure templates have different destinations 2016-10-10 15:19:00 -07:00
Diptanu Choudhury d50c395421 Getting snapshot of allocation from remote node (#1741)
* Added the alloc dir move

* Moving allocdirs when starting allocations

* Added the migrate flag to ephemeral disk

* Stopping migration if the allocation doesn't need migration any more

* Added the GetAllocDir method

* refactored code

* Added a test for alloc runner

* Incorporated review comments
2016-10-03 09:59:57 -07:00
Diptanu Choudhury 9b98d70aec Fixed task group validation tests 2016-09-27 17:57:30 -07:00
Alex Dadgar e925f8ca58 Add template structs 2016-09-26 15:36:11 -07:00
Diptanu Choudhury 1b3c5e98c8 Renaming LocalDisk to EphemeralDisk (#1710)
Renaming LocalDisk to EphemeralDisk
2016-09-14 15:43:42 -07:00
Diptanu Choudhury b844dc3600 Fixed more tests 2016-08-26 01:51:19 -05:00
Diptanu Choudhury ffaf6c6299 Fixed some tests 2016-08-25 13:56:39 -05:00
Alex Dadgar db2806a9c1 Merge pull request #1629 from hashicorp/f-derive-token
Server Deriving Tokens on behalf of Clients
2016-08-23 13:58:47 -07:00
Diptanu Choudhury 4ca623bcfe blocking chained allocations until previous allocation hasn't terminated 2016-08-22 11:34:24 -05:00
Alex Dadgar 94b870a58b Start 2016-08-19 16:40:37 -07:00
Alex Dadgar 9bd9948c5b Job Register endpoint validates token 2016-08-17 16:25:38 -07:00
Alex Dadgar de6e662eb4 Fix service validate test 2016-08-17 11:09:40 -07:00
Marin 69bc3a8fc8 Add support for initial check status 2016-08-16 12:05:15 -07:00
Diptanu Choudhury 761cc40cd2 Fixed a make vet warning 2016-08-12 12:09:44 -07:00
Alex Dadgar af09ef0832 fix validation tests 2016-07-20 16:43:20 -07:00
Alex Dadgar e0114fee05 InitFields to Canonicalize 2016-07-20 16:08:52 -07:00
Alex Dadgar 6bc7009f8c Allow count 0 on system jobs 2016-07-13 13:50:08 -06:00
Diptanu Choudhury b4fe764f07 Added a test 2016-07-08 22:33:04 -07:00
Alex Dadgar 8e231fa382 Rename ConsulService back to Service 2016-06-12 16:36:49 -07:00
Sean Chittenden 7956eb0c80
Rename structs.Task's `Service` attribute to `ConsulService` 2016-06-10 15:54:39 -04:00
Sean Chittenden 4973ec32bb
Rename structs.Services to structs.ConsulServices 2016-06-10 15:54:39 -04:00
Alex Dadgar cc00a66e38 validate that tasks don't contain slashes 2016-05-27 17:17:10 -07:00
Diptanu Choudhury 8a582c1b6c Ensuring check names are unique 2016-05-03 13:16:02 -07:00
Diptanu Choudhury 506ea1a206 Ensuring service names are unique 2016-05-02 13:43:07 -07:00
Alex Dadgar fce63bdc5c Ensure the label exists on checks and small enhancements 2016-04-18 19:38:47 -07:00
Diptanu Choudhury f617fb89fd Invalidating services when they contain check of type tcp and http but no ports 2016-04-15 12:50:55 +04:00
Alex Dadgar 823261c974 add destination to artifact block and validate it 2016-03-18 12:01:46 -07:00
Alex Dadgar 52aac4421f Fix validate test 2016-03-17 11:29:41 -07:00
Alex Dadgar e6d50f96ef Respond to comments and fix test 2016-03-15 20:21:52 -07:00
Alex Dadgar 081556db93 update the getter 2016-03-15 13:28:57 -07:00
Alex Dadgar 68059fa85c Go-getter options are generic and validation of checksums 2016-03-15 13:28:57 -07:00
Sean Chittenden a16b030e92 Add two tests for invalid service names 2016-03-14 17:54:49 -07:00
Alex Dadgar 8ad65876bf Add allocation index environment variable 2016-03-09 18:09:51 -08:00
Armon Dadgar a08391455a nomad: simple encode/decode benchmark 2016-02-20 17:43:17 -08:00
Armon Dadgar 623b473ee6 Revert "Lzw compress raft entries"
This reverts commit a687ee6df316ffadac5305f4be9cf9a5642cd6af.

The LZW compression reduces the file size by ~60%, but increases
our encode and decode costs by 2x in a CPU bottlenecked path.
2016-02-20 17:36:39 -08:00
Alex Dadgar 6e8a57ba1a Lzw compress raft entries 2016-02-20 13:21:38 -08:00
Diptanu Choudhury d64b109afc Bumped up disk requirements in a test 2016-02-11 22:50:34 -08:00
Diptanu Choudhury 7eba3f3b5f Merge pull request #763 from hashicorp/f-logrotator
Implemented log rotation for drivers
2016-02-11 15:02:39 -08:00
Diptanu Choudhury e7f8997bb1 Added a validator for log storage 2016-02-11 12:30:47 -08:00
Diptanu Choudhury 9e994cb8d0 Fixed some tests 2016-02-11 10:42:56 -08:00
Alex Dadgar bb36684fec Copy handles empty case 2016-02-11 09:08:20 -08:00
Alex Dadgar 2627b742fa Fix == 2016-02-05 15:15:56 -08:00
Alex Dadgar 40a373f9e0 Ensure there are no periods in the service name 2016-02-05 14:42:35 -08:00
Alex Dadgar 6f20d3f435 Restart on-success shouldn't be user specifiable 2016-02-02 17:35:06 -08:00
Alex Dadgar 30ccc2f46d Merge pull request #742 from hashicorp/b-restart-attempts
Restart policy handling / validation adjustments
2016-02-02 15:47:07 -08:00
Ryan Uber 198a1a3cd4 structs: more restart policy validation 2016-02-02 14:32:30 -08:00
Alex Dadgar 4748bfd869 Tests 2016-02-02 13:50:30 -08:00
Alex Dadgar 670cc50a02 merge 2015-12-23 18:26:39 -08:00
Alex Dadgar 55cc8c61b3 fix 2015-12-18 12:17:50 -08:00
Alex Dadgar 31c3e12957 merge 2015-12-18 12:17:13 -08:00
Diptanu Choudhury 2eb03e1d23 Renamed serviceId to serviceID 2015-12-14 15:57:56 -08:00
Diptanu Choudhury 6b6d74e2eb Fixed tests 2015-12-14 15:47:01 -08:00
Diptanu Choudhury b3c161a7d5 Generate check names, check id and service id on the server side 2015-12-10 16:07:17 -08:00
Alex Dadgar 7f8c2c6e95 Add IsPeriodic 2015-12-01 08:59:00 -08:00
Alex Dadgar a9b95bca2d Add Periodic config to job 2015-12-01 08:59:00 -08:00
Diptanu Choudhury e25c260694 Merge pull request #509 from hashicorp/f-service-name
Implemented interpolation of Job, Task group and Task Names in Service Name
2015-11-26 23:28:13 -08:00
Diptanu Choudhury cbfe727100 Making the Job expand all service names during registration 2015-11-26 19:26:00 -08:00
Diptanu Choudhury fbe3bd0724 Fixed some docs 2015-11-26 13:47:02 -08:00
Diptanu Choudhury fd1b8a0336 Fixing tests 2015-11-26 12:40:42 -08:00
Diptanu Choudhury f9c3d16b9f Removing un-used imports 2015-11-24 10:02:33 -08:00
Diptanu Choudhury 5549c1d2dc Generating the sha1 for a check 2015-11-24 10:02:33 -08:00
Diptanu Choudhury 4c8dd666dc Added validation to the checks 2015-11-17 15:13:25 -08:00
Diptanu Choudhury a9acc52b4e Fixed validation logic for restart policy when interval is zero 2015-11-17 02:56:11 -05:00
Diptanu Choudhury 0238e27d5d Fixed the structs test 2015-11-16 13:10:57 -08:00
Diptanu Choudhury 52eb6c77af Fixing tests to not create a TG without restart policies 2015-11-02 13:24:59 -08:00
Alex Dadgar fd9c2baf02 Constants for constraints and renaming to use undescore instead of camel 2015-10-26 13:47:56 -07:00
Armon Dadgar 369be8e8f4 nomad: additional constraint validation 2015-10-11 15:50:16 -04:00
Chris Bednarski 4554a678e5 Remove this guard since it's likely to hide nasty bugs where nomad should crash 2015-09-24 15:38:11 -07:00
Chris Bednarski 130263af84 Add exhaustive tests and nil guard to List and Map for NetworkResource 2015-09-24 15:11:44 -07:00
Chris Bednarski 50b967d716 Added ListStaticPorts() to get a list of statically-allocated ports from the NetworkResource 2015-09-23 22:28:34 -07:00
Chris Bednarski 38b7f0b452 That method is gone 2015-09-23 13:45:23 -07:00
Chris Bednarski e2c324d098 Merge branch 'master' into f-port-configs 2015-09-23 11:57:12 -07:00
Armon Dadgar b213462cb4 Change CPU from float64 to int 2015-09-23 11:14:32 -07:00
Chris Bednarski 3e90379f05 Pass dynamic ports to the exec driver via environment variables 2015-09-22 22:33:29 -07:00
Chris Bednarski 168c959497 Added named ports 2015-09-22 13:59:16 -07:00
Armon Dadgar c713cfb9ac nomad: testing the job validations 2015-09-15 11:23:03 -07:00
Armon Dadgar cbc9b6dae2 nomad: thread alloc fit failure reason through 2015-09-13 18:38:11 -07:00
Armon Dadgar 7586b39a7b nomad: removing old network index lookup methods 2015-09-13 15:04:36 -07:00
Armon Dadgar 373c4ee83a nomad: Resource Superset ignores network in favor of NetworkIndex 2015-09-13 14:59:34 -07:00
Armon Dadgar 39fa04eda7 nomad: aggregate by blank network constraints 2015-09-12 17:04:09 -07:00
Armon Dadgar 47f6a8a64a nomad: Support adding NetworkResource by CIDR/IP 2015-09-12 16:33:41 -07:00
Armon Dadgar 2eb8044518 nomad: handle network usage superset by CIDR/IP 2015-09-12 16:29:45 -07:00
Armon Dadgar 2d4fad31b2 nomad: adding IP to NetworkResource 2015-09-12 16:21:57 -07:00
Armon Dadgar 1701275936 nomad: share resource adding 2015-08-04 17:41:02 -07:00
Armon Dadgar f23e0db780 nomad: share and test superset 2015-08-04 17:32:57 -07:00
Armon Dadgar 0c3bab297c nomad: testing 2015-08-04 17:23:42 -07:00
Armon Dadgar 6b63bfa5a2 structs: adding encode and decode 2015-06-06 00:21:17 +02:00