Commit Graph

248 Commits

Author SHA1 Message Date
Preetha Appan 5812f906c8
Allow empty spread targets, and validate target percentages. 2018-09-04 16:10:11 -05:00
Preetha Appan 5eb82b6260
Validate method, and rename ratio field to percent 2018-09-04 16:10:11 -05:00
Preetha Appan c407e3626f
More review comments 2018-09-04 16:10:11 -05:00
Preetha Appan dbbb4a957a
Fail validation if system job has affinities 2018-09-04 16:10:11 -05:00
Preetha Appan 9f0caa9c3d
Affinity parsing, api and structs 2018-09-04 16:10:11 -05:00
Alex Dadgar ee50789c22
Initial implementation 2018-05-07 14:50:01 -05:00
Michael Schurter f6a4713141 consul: make grpc checks more like http checks 2018-05-04 11:08:11 -07:00
Chelsea Holland Komlo ce1c3e0c2d add unit tests for panic cron parsing bug
add comments for cron parsing wrapper
2018-04-26 18:47:08 -04:00
Alex Dadgar d0f237086b UX touchups 2018-04-26 15:24:27 -07:00
Alex Dadgar eeb85299ff gofmt -s nomad/structs/structs_test.go 2018-04-17 13:39:32 -07:00
Chelsea Holland Komlo 788b23e17e add test for node copy 2018-04-17 12:58:07 -04:00
Preetha Appan 81f856e7c9
Fix one more failing test 2018-04-11 15:49:23 -05:00
Preetha Appan a7b7b662ed
Make system jobs fail validation if they contain a reschedule stanza 2018-04-11 14:56:20 -05:00
Preetha 6254d75eee
Merge pull request #4101 from hashicorp/b-rescheduling-edge-fixes
Fixes edge cases around timing/ task finish time being set more than once
2018-04-04 16:18:21 -05:00
Preetha Appan 00537c739b
Fixes edge cases around timing and task finish time being set more than once 2018-04-03 16:34:59 -05:00
Michael Schurter 6840becf46 drain: refactor batch_future into its own file
aka What If structs.go Wasn't So Big?
2018-04-02 16:40:06 -07:00
Alex Dadgar 301704091b Handle upgrade where Node doesn't have eligiblity
This PR handles upgrading a node that has no scheduling eligiblity set.
2018-03-29 16:52:23 -07:00
Preetha 9a732c4acb
Merge pull request #4071 from hashicorp/b-handle-missing-finishedat
handle missing finishedAt
2018-03-29 17:11:34 -05:00
Preetha Appan c8317532ff
Use time from task events if task state does not have FinishedAt set 2018-03-29 14:05:56 -05:00
Alex Dadgar b194f93f2f Disallow Update stanza on Batch 2018-03-29 11:28:56 -07:00
Preetha Appan 8776f4b942
Fix failing test 2018-03-29 07:59:38 -05:00
Preetha Appan 2da661595d
If FinishedAt is not set use alloc's modify time for rescheduling logic 2018-03-29 07:42:58 -05:00
Preetha Appan 539114124e
Fix too long token test case 2018-03-26 16:28:33 -05:00
Preetha Appan 33e170c15d
s/linear/constant/g 2018-03-26 14:45:09 -05:00
Preetha Appan 7db930b3c3
Extra test case and better error message for ambiguous config 2018-03-26 13:30:09 -05:00
Preetha Appan fbd56c35a8
Adds additional validation for ambigous settings (having both unlimited and attempts set) 2018-03-24 10:29:20 -05:00
Alex Dadgar e63bcb474d Drainer 2018-03-21 16:51:44 -07:00
Preetha 17f2f52f08
Merge pull request #3979 from hashicorp/b_update_compat_delete
Delete compatibility code for job level update stanza
2018-03-21 09:17:01 -05:00
Preetha Appan 9a5e6edf1f
Rename DelayCeiling to MaxDelay 2018-03-14 16:10:32 -05:00
Preetha Appan 9fed0d2103
Get reschedule policy from the alloc directly 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 51ec6ec15e
Formatting and linting fixes 2018-03-14 16:10:32 -05:00
Preetha Appan 10c9662222
New delayed rescheduling options, validation function and unit tests 2018-03-14 16:10:32 -05:00
Preetha Appan 948d917a60
lint warning fixed 2018-03-14 11:30:09 -05:00
Preetha Appan a924183604
Remove compat code for upgrade stanza that copied state from job level update stanza 2018-03-14 10:21:46 -05:00
Preetha 360d6e5a92
Merge pull request #3968 from hashicorp/f-nicer-vault-error
Make server side error messages from vault more clearer
2018-03-13 20:49:39 -05:00
Preetha Appan 9618f52746
Remove error wrapping and make vault connection server side errors clearer. 2018-03-13 17:09:03 -05:00
Josh Soref 4e40338cfa spelling: rescheduling 2018-03-11 18:40:32 +00:00
Josh Soref fdd7b5ee9d spelling: reschedule 2018-03-11 18:50:50 +00:00
Josh Soref eb127482a4 spelling: policies 2018-03-11 18:37:37 +00:00
Josh Soref 33a0a04941 spelling: missing 2018-03-11 18:27:02 +00:00
Josh Soref 444341a278 spelling: example 2018-03-11 18:05:59 +00:00
Chelsea Holland Komlo b4b0c7cdcf fix up linting 2018-02-28 12:58:44 -05:00
Chelsea Holland Komlo a72aaaf47f add network resources equal method, use time ticker
remove impossible test case
2018-02-27 12:42:53 -05:00
Preetha Appan 4fd2691323
Use next alloc id being set, move outside structs package and other code review feedback 2018-01-31 09:58:05 -06:00
Preetha Appan 009df8b986
Unit test for alloc struct's GCEligible method 2018-01-31 09:58:05 -06:00
Preetha Appan d016cbdf7b
Unit test for alloc struct's GCEligible method 2018-01-31 09:58:05 -06:00
Preetha Appan 6fcd9f67a8
Named fields in unit test and one more test case 2018-01-31 09:56:53 -06:00
Preetha Appan 5ee3cdecc5
Clean up the copy method + unit test 2018-01-31 09:56:53 -06:00
Preetha Appan 8408835af8
Wrap reschedule events in another struct and other review feedback 2018-01-31 09:56:53 -06:00
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