Commit Graph

2193 Commits

Author SHA1 Message Date
Mahmood Ali
12114354ab Merge pull request #5668 from hashicorp/flaky-test-20190430
fix flaky test by allowing for call invocation overhead
2019-05-13 12:33:44 -04:00
Mahmood Ali
494642b11c typo: "atleast" -> "at least" 2019-05-13 10:01:19 -04:00
Mahmood Ali
5abbee5d39 Merge pull request #5632 from hashicorp/f-nomad-exec-parts-01-base
nomad exec part 1: plumbing and docker driver
2019-05-09 18:09:27 -04:00
Mahmood Ali
bfb4f0ca2d agent: add websocket handler for nomad exec
This adds a websocket endpoint for handling `nomad exec`.

The endpoint is a websocket interface, as we require a bi-directional
streaming (to handle both input and output), which is not very appropriate for
plain HTTP 1.0. Using websocket makes implementing the web ui a bit simpler. I
considered using golang http hijack capability to treat http request as a plain
connection, but the web interface would be too complicated potentially.

Furthermore, the API endpoint operates against the raw core nomad exec streaming
datastructures, defined in protobuf, with json serializer.  Our APIs use json
interfaces in general, and protobuf generates json friendly golang structs.
Reusing the structs here simplify interface and reduce conversion overhead.
2019-05-09 16:49:08 -04:00
Danielle
62274e9452 Merge pull request #5536 from hashicorp/dani/consul
Consul Catalog Integration Fixes
2019-05-09 13:22:54 +02:00
Danielle Lancashire
3d3b2ca239 consul: Document example check id 2019-05-09 13:22:22 +02:00
Mahmood Ali
538b5c3eba fix flaky test by allowing for call invocation overhead 2019-05-08 18:04:37 -04:00
Preetha
237d8ca2ec Merge pull request #5628 from hashicorp/f-preemption-config
Add config to disable preemption for batch/service jobs
2019-05-06 15:40:35 -05:00
Lang Martin
84306b0bfb Merge pull request #5601 from hashicorp/b-config-parse-direct-hcl
config parse direct hcl
2019-05-06 12:05:19 -04:00
Preetha Appan
a9d45c5048 Rename to match system scheduler config.
Also added docs
2019-05-03 14:06:12 -05:00
Danielle Lancashire
14c231aeb9 consul: Do not deregister external checks
This commit causes sync to skip deregistering checks that are not
managed by nomad, such as service maintenance mode checks.  This is
handled in the same way as service registrations - by doing a Nomad
specific prefix match.
2019-05-02 16:54:18 +02:00
Danielle Lancashire
195529efd4 consul: Use a stable identifier for services
The current implementation of Service Registration uses a hash of the
nomad-internal state of a service to register it with Consul, this means that
any update to the service invalidates this name and we then deregister, and
recreate the service in Consul.

While this behaviour slightly simplifies reasoning about service registration,
this becomes problematic when we add consul health checks to a service. When
the service is re-registered, so are the checks, which default to failing for
at least one check period.

This commit migrates us to using a stable identifier based on the
allocation, task, and service identifiers, and uses the difference
between the remote and local state to decide when to push updates.

It uses the existing hashing mechanic to decide when UpdateTask should
regenerate service registrations for providing to Sync, but this should
be removable as part of a future refactor.

It additionally introduces the _nomad-check- prefix for check
definitions, to allow for future allowing of consul features like
maintenance mode.
2019-05-02 16:54:18 +02:00
Chris Baker
cb7aa2bf91 test case for 5540 (#5590)
* client/metrics: modified metrics to use (updated) client copy of allocation instead of (unupdated) server copy

* updated armon/go-metrics to address race condition in DisplayMetrics
2019-04-30 10:31:35 -04:00
Lang Martin
d1dbbe868e config_parse leave the *HCL strings in place after converting times 2019-04-30 10:30:53 -04:00
Lang Martin
4d3e86648e config_parse_test additional config confirmation w/ sample json 2019-04-30 10:30:53 -04:00
Lang Martin
6aa98c37ae config comment for future changes 2019-04-30 10:30:53 -04:00
Lang Martin
6abbf6a1c3 tag HCL bookkeeping keys with json:"-" to keep them out of the api 2019-04-30 10:29:14 -04:00
Lang Martin
e6d6c0afed config_parse_test remove redundant parse direct test 2019-04-30 10:29:14 -04:00
Lang Martin
41bfd27df1 config_parse remove unused multi-stage parsing via mapstructure 2019-04-30 10:29:14 -04:00
Lang Martin
0490a91f9d config_parse_test test direct hcl parsing 2019-04-30 10:29:14 -04:00
Lang Martin
ae7a8da18c agent/config, config/* mapstructure tags -> hcl tags 2019-04-30 10:29:14 -04:00
Lang Martin
bac0d5f0ed config_parse add new ParseConfigFileDirectHCL
- parse by using hcl.Decode directly
- handle time.Duration strings in a second pass
- report unexpected keys in a third pass
2019-04-30 10:29:14 -04:00
Preetha Appan
c9edc45661 Add config to disable preemption for batch/service jobs 2019-04-29 18:48:07 -05:00
Danielle Lancashire
7f102bcea8 alloc_signal: Add autcompletion and cmd tests 2019-04-26 12:47:53 +02:00
Danielle Lancashire
023d0dff31 allocs: Add nomad alloc signal command
This command will be used to send a signal to either a single task within an
allocation, or all of the tasks if <task-name> is omitted. If the sent signal
terminates the allocation, it will be treated as if the allocation has crashed,
rather than as if it was operator-terminated.

Signal validation is currently handled by the driver itself and nomad
does not attempt to restrict or validate them.
2019-04-25 12:43:32 +02:00
Mahmood Ali
c07c0c810f fix crash when executor parent nomad process dies
Fixes https://github.com/hashicorp/nomad/issues/5593

Executor seems to die unexpectedly after nomad agent dies or is
restarted.  The crash seems to occur at the first log message after
the nomad agent dies.

To ease debugging we forward executor log messages to executor.log as
well as to Stderr.  `go-plugin` sets up plugins with Stderr pointing to
a pipe being read by plugin client, the nomad agent in our case[1].
When the nomad agent dies, the pipe is closed, and any subsequent
executor logs fail with ErrClosedPipe and SIGPIPE signal.  SIGPIPE
results into executor process dying.

I considered adding a handler to ignore SIGPIPE, but hc-log library
currently panics when logging write operation fails[2]

This we opt to revert to v0.8 behavior of exclusively writing logs to
executor.log, while we investigate alternative options.

[1] https://github.com/hashicorp/nomad/blob/v0.9.0/vendor/github.com/hashicorp/go-plugin/client.go#L528-L535
[2] https://github.com/hashicorp/nomad/blob/v0.9.0/vendor/github.com/hashicorp/go-hclog/int.go#L320-L323
2019-04-23 09:52:46 -04:00
Danielle
9a4fe5e98f Merge pull request #5512 from hashicorp/dani/f-alloc-stop
alloc-lifecycle: nomad alloc stop
2019-04-23 13:05:08 +02:00
Danielle Lancashire
bb142af5d6 allocs: Add nomad alloc stop
This adds a `nomad alloc stop` command that can be used to stop and
force migrate an allocation to a different node.

This is built on top of the AllocUpdateDesiredTransitionRequest and
explicitly limits the scope of access to that transition to expose it
under the alloc-lifecycle ACL.

The API returns the follow up eval that can be used as part of
monitoring in the CLI or parsed and used in an external tool.
2019-04-23 12:50:23 +02:00
Michael Schurter
6943943a92 Merge pull request #5486 from hashicorp/b-validate-migrate
api: fix migrate stanza initialization
2019-04-15 09:44:59 -07:00
Chris Baker
570efaa05b gofmt/goimport and test formatting 2019-04-12 20:55:55 +00:00
Chris Baker
165244a9b7 changes to appease gofmt 2019-04-12 19:12:42 +00:00
Chris Baker
f011f61645 cli: add support for periodic force evaluation
resolves #3251
2019-04-12 18:56:35 +00:00
Chris Baker
c38a98e5bb cli: add acl token list command, documentation
docs: fix some incorrect acl policy docs (typos, copy-paste errors)
2019-04-12 15:48:36 +00:00
Michael Schurter
5ea4382af7 api: fix migrate stanza initialization
Fixes Migrate to be initialized like RescheduleStrategy.

Fixes #5477
2019-04-11 15:29:19 -07:00
Danielle Lancashire
419d70c5f9 allocs: Add nomad alloc restart
This adds a `nomad alloc restart` command and api that allows a job operator
with the alloc-lifecycle acl to perform an in-place restart of a Nomad
allocation, or a given subtask.
2019-04-11 14:25:49 +02:00
Danielle
776477824e Merge pull request #5516 from hashicorp/dani/f-verbose-status
Allow passing -verbose to meta status
2019-04-11 13:31:48 +02:00
Danielle Lancashire
38e73b51e9 status: Allow passing -verbose to meta status
A common issue when using nomad is needing to add in the object verb to
a command to include the `-verbose` flag.

This commit allows users to pass `-verbose` via the `nomad status` alias by
adding a placeholder boolean in the metacommand which allows subcommands
to parse the flag.
2019-04-11 13:15:44 +02:00
Chris Baker
fcc6a2ca13 agent config: cleaner VAULT_ env lookup 2019-04-10 10:34:10 -05:00
Chris Baker
20a3884559 docs: -vault-namespace, VAULT_NAMESPACE, and config
agent: added VAULT_NAMESPACE env-based configuration
2019-04-10 10:34:10 -05:00
Chris Baker
5db81957ff wip: added config parsing support, CLI flag, still need more testing, VAULT_ var, documentation 2019-04-10 10:34:10 -05:00
Chris Baker
9d50d82ead "job revert" command: alphabetized flags 2019-04-10 10:34:10 -05:00
Chris Baker
af0d0f919f cli: plumbed vault token from job revert command through API call 2019-04-10 10:34:10 -05:00
Arshneet Singh
e6ef8b0e88 Remove redundant assertion and replace regex matches with require 2019-04-10 10:34:10 -05:00
Arshneet Singh
ec49fff549 Don't display node name if output isn't verbose. Add tests. 2019-04-10 10:34:10 -05:00
James Rasell
ee92bf86d8 Add NodeName to the alloc/job status outputs.
Currently when operators need to log onto a machine where an alloc
is running they will need to perform both an alloc/job status
call and then a call to discover the node name from the node list.

This updates both the job status and alloc status output to include
the node name within the information to make operator use easier.

Closes #2359
Cloess #1180
2019-04-10 10:34:10 -05:00
Nomad Release bot
18dd59056e Generate files for 0.9.0 release 2019-04-09 01:56:00 +00:00
Nomad Release bot
6a838b8c3b Generate files for 0.9.0-rc2 release 2019-04-03 01:54:29 +00:00
Preetha Appan
ff1bac9f48 Address review comments 2019-03-29 08:57:49 -05:00
Preetha Appan
7490af2194 fix linting 2019-03-28 18:01:40 -05:00
Preetha Appan
1f88ccec55 Fix json parsing bug with plugins that don't provide args
This fixes a bug with JSON agent configuration parsing where the AST
for the plugin stanza had unnecessary flattening originating from hcl parsing
library. The workaround fixes the AST by popping off the flattened element and wrapping
it in a list. The workaround comes from similar code in terraform.

There were no existing test cases for json parsing so I added a few.
2019-03-28 16:33:30 -05:00