Commit Graph

2919 Commits

Author SHA1 Message Date
Chris Baker
0cd707e3a9 moved JSON handlers and extension code around a bit for proper order of
initialization
2021-03-22 14:12:42 +00:00
Chris Baker
93d5187e7b removed deprecated fields from Drain structs and API
node drain: use msgtype on txn so that events are emitted
wip: encoding extension to add Node.Drain field back to API responses

new approach for hiding Node.SecretID in the API, using `json` tag
documented this approach in the contributing guide
refactored the JSON handlers with extensions
modified event stream encoding to use the go-msgpack encoders with the extensions
2021-03-21 15:30:11 +00:00
Tim Gross
7c7569674c CSI: unique volume per allocation
Add a `PerAlloc` field to volume requests that directs the scheduler to test
feasibility for volumes with a source ID that includes the allocation index
suffix (ex. `[0]`), rather than the exact source ID.

Read the `PerAlloc` field when making the volume claim at the client to
determine if the allocation index suffix (ex. `[0]`) should be added to the
volume source ID.
2021-03-18 15:35:11 -04:00
Tim Gross
a1eaad9cf7 CSI: remove prefix matching from CSIVolumeByID and fix CLI prefix matching (#10158)
Callers of `CSIVolumeByID` are generally assuming they should receive a single
volume. This potentially results in feasibility checking being performed
against the wrong volume if a volume's ID is a prefix substring of other
volume (for example: "test" and "testing").

Removing the incorrect prefix matching from `CSIVolumeByID` breaks prefix
matching in the command line client. Add the required elements for prefix
matching to the commands and API.
2021-03-18 14:32:40 -04:00
Tim Gross
618d64ba37 csi: volume init command
Create a convenience command for generating example CSI volume specifications,
similar to the existing `nomad job init` or `nomad quota init` commands.
2021-03-18 14:24:40 -04:00
Charlie Voiselle
d914990e5f Fixup uses of sanity (#10187)
* Fixup uses of `sanity`
* Remove unnecessary comments.

These checks are better explained by earlier comments about
the context of the test. Per @tgross, moved the tests together
to better reinforce the overall shared context.

* Update nomad/fsm_test.go
2021-03-16 18:05:08 -04:00
Tim Gross
efc37542e7 csi: don't truncate CSI volume IDs
Volume IDs are not UUIDs, so truncating them to the short ID isn't really
necessary and makes for especially awkward UX when per-alloc volumes are in
use.
2021-03-12 10:39:09 -05:00
James Rasell
ded978c34c Merge pull request #10140 from hashicorp/b-gh-10070
agent: return req error if prometheus metrics are disabled.
2021-03-10 17:11:39 +01:00
Tim Gross
a0aef186ec CLI 'nomad ui -authenticate' flag for one-time token exchange
Includes swapping the previously documented `-login` flag for `-authenticate`
to align better with Waypoint.
2021-03-10 08:17:56 -05:00
Tim Gross
f9cf36d43a HTTP API support for 'nomad ui -login'
Endpoints for requesting and exchanging one-time tokens via the HTTP
API. Includes documentation updates.
2021-03-10 08:17:56 -05:00
James Rasell
09cf00f330 agent: return req error if prometheus metrics are disabled.
If the user has disabled Prometheus metrics and a request is
sent to the metrics endpoint requesting Prometheus formatted
metrics, then the request should fail.
2021-03-09 15:28:58 +01:00
Dave May
83af6f5785 debug: update defaults to commonly used values 2021-03-09 08:31:38 -05:00
Andre Ilhicas
f3aabdc5c2 consul/connect: enable setting local_bind_address in upstream 2021-02-26 11:37:31 +00:00
Dave May
d1648243f4 Handle Consul API URL protocol mismatch (#10082) 2021-02-25 08:22:44 -05:00
Drew Bailey
6fc62aa235 Merge pull request #9955 from hashicorp/on-update-services
Service and Check on_update configuration option (readiness checks)
2021-02-24 10:11:05 -05:00
Kris Hicks
eae3836b3d cli: Update namespace helptext guide URL (#10074)
The old URL redirects to https://learn.hashicorp.com/nomad
2021-02-23 08:31:19 -08:00
Seth Hoenig
e3af469519 consul/connect: Fix bug where connect sidecar services would be unnecessarily re-registered
This PR fixes a bug where sidecar services would be re-registered into Consul every ~30
seconds, caused by the parent service having its tags field set and the sidecar_service
tags unset. Nomad would directly compare the tags between its copy of the sidecar service
definition and the tags of the sidecar service reported by Consul. This does not work,
because Consul will under-the-hood set the sidecar service tags to inherit the parent
service tags if the sidecar service tags are unset. The comparison then done by Nomad
would not match, if the parent sidecar tags are set.

Fixes #10025
2021-02-22 12:02:58 -06:00
Karan Sharma
f159903e39 feat: Add -task to alloc logs command (#10026) 2021-02-16 11:21:06 -05:00
AndrewChubatiuk
77ec3d1fab pr comments 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
66e3e95aaf fixed typo 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
501d27c9b5 fixed typo 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
8e09d7c394 fixed typo 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
02aa923a57 fixed tests 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
f6e875dcb8 fixed connect port label 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
625bd98915 fixed connect port label 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
4ed7323c8d fixed connect port label 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
b7d1aee621 tests fix 2021-02-13 02:42:14 +02:00
AndrewChubatiuk
b860cc44a0 allocate sidecar task port on host_network interface 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
2d13826e22 fixed tests 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
93cd0d2e88 fixed tests 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
1d5981015a fixed tests 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
b3323a562b removed proxy suffix 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
f43e153a61 fixed variable initialization 2021-02-13 02:42:13 +02:00
AndrewChubatiuk
4e8142dabb customized default sidecar checks 2021-02-13 02:42:13 +02:00
Buck Doyle
288e50ad32 Add handling for license requests in OSS (#9963)
This changes the license-fetching endpoint to respond with 204 in
OSS instead of 501. It closes #9827.
2021-02-08 12:53:06 -06:00
Drew Bailey
5c30148334 OnUpdate configuration for services and checks
Allow for readiness type checks by configuring nomad to ignore warnings
or errors reported by a service check. This allows the deployment to
progress and while Consul handles introducing the sercive into a
resource pool once the check passes.
2021-02-08 08:32:40 -05:00
Seth Hoenig
b682371a22 drivers/exec+java: Add configuration to restore previous PID/IPC namespace behavior.
This PR adds default_pid_mode and default_ipc_mode options to the exec and java
task drivers. By default these will default to "private" mode, enabling PID and
IPC isolation for tasks. Setting them to "host" mode disables isolation. Doing
so is not recommended, but may be necessary to support legacy job configurations.

Closes #9969
2021-02-05 15:52:11 -06:00
Chris Baker
b0ccf3ca5c scaling policy -verbose flag, plus testing and other recommendations from review 2021-02-04 15:08:13 +00:00
Chris Baker
bfec8a7e4d updated "scaling policy info" with prefix search and auto-complete 2021-02-03 21:29:44 +00:00
Chris Baker
fbdbd7736c bad boolean logic for List-on-Info commands 2021-02-03 21:29:05 +00:00
Mahmood Ali
4b25371842 tests: update test with a real invalid hcl2 2021-02-01 11:12:22 -05:00
Chris Baker
7f06adf1af Merge tag 'v1.0.3' into post-release-1.0.3
Version 1.0.3
2021-01-29 19:30:08 +00:00
Seth Hoenig
ceae8ad1cf consul/connect: Add support for Connect terminating gateways
This PR implements Nomad built-in support for running Consul Connect
terminating gateways. Such a gateway can be used by services running
inside the service mesh to access "legacy" services running outside
the service mesh while still making use of Consul's service identity
based networking and ACL policies.

https://www.consul.io/docs/connect/gateways/terminating-gateway

These gateways are declared as part of a task group level service
definition within the connect stanza.

service {
  connect {
    gateway {
      proxy {
        // envoy proxy configuration
      }
      terminating {
        // terminating-gateway configuration entry
      }
    }
  }
}

Currently Envoy is the only supported gateway implementation in
Consul. The gateay task can be customized by configuring the
connect.sidecar_task block.

When the gateway.terminating field is set, Nomad will write/update
the Configuration Entry into Consul on job submission. Because CEs
are global in scope and there may be more than one Nomad cluster
communicating with Consul, there is an assumption that any terminating
gateway defined in Nomad for a particular service will be the same
among Nomad clusters.

Gateways require Consul 1.8.0+, checked by a node constraint.

Closes #9445
2021-01-25 10:36:04 -06:00
Drew Bailey
3cb1132693 prevent double job status update (#9768)
* Prevent Job Statuses from being calculated twice

https://github.com/hashicorp/nomad/pull/8435 introduced atomic eval
insertion iwth job (de-)registration. This change removes a now obsolete
guard which checked if the index was equal to the job.CreateIndex, which
would empty the status. Now that the job regisration eval insetion is
atomic with the registration this check is no longer necessary to set
the job statuses correctly.

* test to ensure only single job event for job register

* periodic e2e

* separate job update summary step

* fix updatejobstability to use copy instead of modified reference of job

* update envoygatewaybindaddresses copy to prevent job diff on null vs empty

* set ConsulGatewayBindAddress to empty map instead of nil

fix nil assertions for empty map

rm unnecessary guard
2021-01-22 09:18:17 -05:00
Dennis Schön
bbebfeb5a4 validate connect block allowed only within group.service 2021-01-20 14:34:23 -05:00
Dennis Schön
afa0018587 don't prefix json logging 2021-01-20 09:09:31 -05:00
Kris Hicks
2cd7136bc7 Fix some errcheck errors (#9811)
* Throw away result of multierror.Append

When given a *multierror.Error, it is mutated, therefore the return
value is not needed.

* Simplify MergeMultierrorWarnings, use StringBuilder

* Hash.Write() never returns an error

* Remove error that was always nil

* Remove error from Resources.Add signature

When this was originally written it could return an error, but that was
refactored away, and callers of it as of today never handle the error.

* Throw away results of io.Copy during Bridge

* Handle errors when computing node class in test
2021-01-14 12:46:35 -08:00
Nomad Release bot
4c1d4fc6a5 Generate files for 1.0.2 release 2021-01-13 16:52:51 +00:00
Dave May
332a195ed4 nomad agent-info: Add json/gotemplate formatting (#9788)
* nomad agent-info: Add json/gotemplate formatting
* Add CHANGELOG entry
* update docs
2021-01-13 09:42:46 -05:00
Seth Hoenig
a92cc30e47 command: generate bindata assetfs 2021-01-10 17:09:08 -06:00