Commit Graph

61 Commits

Author SHA1 Message Date
Chelsea Komlo
9d006ecd0d Merge pull request #3492 from hashicorp/f-client-tls-reload
Client/Server TLS dynamic reload
2018-01-23 05:51:32 -05:00
Charlie Voiselle
aacefafe53 Allow . in Environment Variable Names
From [https://github.com/appc/spec/blob/master/spec/aci.md](https://github.com/appc/spec/blob/master/spec/aci.md):

>environment (list of objects, optional) represents the app's environment variables (ACE can append). The listed objects must have two key-value pairs: name and value. The name must consist solely of letters, digits, and underscores '_' as outlined in IEEE Std 1003.1-2008, 2016 Edition, with practical considerations dictating that the name may also include periods '.' and hyphens '-'. The value is an arbitrary string. These values are not evaluated in any way, and no substitutions are made.

Dotted environment variables are frequently used as a part of the Spring Boot pattern. (re: ZD-6116)

This PR specifically doesn't address the conversion of hyphens (`-`) due to an issue with rkt [[Nomad GH # 2358]](https://github.com/hashicorp/nomad/issues/2358).
2018-01-22 13:59:37 -08:00
Chelsea Holland Komlo
8de260f19b refactor creating a new tls configuration 2018-01-16 08:02:39 -05:00
Michael Schurter
98c72e953b Improve naming and docs 2018-01-08 13:36:07 -08:00
Michael Schurter
4eaa6700fa Logger backed by *testing.T
For capturing log output in tests and only displaying them on failure.

Pulled out of #3241
2018-01-08 12:53:58 -08:00
Preetha Appan
05d52b621c Changes service name validation logic to ignore any environment variables first. 2017-11-15 15:35:43 -06:00
Chelsea Komlo
fa9fd4422c Nomad agent reload TLS configuration on SIGHUP (#3479)
* Allow server TLS configuration to be reloaded via SIGHUP

* dynamic tls reloading for nomad agents

* code cleanup and refactoring

* ensure keyloader is initialized, add comments

* allow downgrading from TLS

* initalize keyloader if necessary

* integration test for tls reload

* fix up test to assert success on reloaded TLS configuration

* failure in loading a new TLS config should remain at current

Reload only the config if agent is already using TLS

* reload agent configuration before specific server/client

lock keyloader before loading/caching a new certificate

* introduce a get-or-set method for keyloader

* fixups from code review

* fix up linting errors

* fixups from code review

* add lock for config updates; improve copy of tls config

* GetCertificate only reloads certificates dynamically for the server

* config updates/copies should be on agent

* improve http integration test

* simplify agent reloading storing a local copy of config

* reuse the same keyloader when reloading

* Test that server and client get reloaded but keep keyloader

* Keyloader exposes GetClientCertificate as well for outgoing connections

* Fix spelling

* correct changelog style
2017-11-14 17:53:23 -08:00
Alex Dadgar
43764fdeec skip running test executables 2017-10-19 16:49:57 -07:00
Alex Dadgar
f6fbb36054 sync 2017-10-13 14:36:02 -07:00
Michael Schurter
04b8f8e7fc 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
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Michael Schurter
947516405a Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Alex Dadgar
3b300925a2 Fix alloc health with checks using interpolation
Fixes an issue in which the allocation health watcher was checking for
allocations health based on un-interpolated services and checks. Change
the interface for retrieving check information from Consul to retrieving
all registered services and checks by allocation. In the future this
will allow us to output nicer messages.

Fixes https://github.com/hashicorp/nomad/issues/2969
2017-08-07 16:27:08 -07:00
Alex Dadgar
4e71ba2e71 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
Alex Dadgar
3935656d14 Show submit time 2017-07-07 12:07:07 -07:00
Alex Dadgar
df40bd8a5f initial reconciler 2017-07-07 12:01:17 -07:00
Michael Schurter
887c7b0bfb Don't fail on first error detecting cpu stats
Since cpu.Counts() never returns an error this doesn't functionally
change anything today.
2017-07-03 14:51:02 -07:00
Michael Schurter
a96fb5dbb0 Move task env into execcontext
Also inject PATH into rkt commands since we're no longer appending host
env vars for it.
2017-05-23 13:53:34 -07:00
Alex Dadgar
7a78eeed16 Add a comment 2017-04-10 12:07:57 -07:00
Alex Dadgar
68ba51c600 Hash host ID so its stable and well distributed
This PR takes the host ID and runs it through a hash so that it is well
distributed. This makes it so that machines that report similar host IDs
are easily distinguished.

Instances of similar IDs occur on EC2 where the ID is prefixed and on
motherboards created in the same batch.

Fixes https://github.com/hashicorp/nomad/issues/2534
2017-04-10 11:44:51 -07:00
Alex Dadgar
c579f6163f Fix tests that exec nomad 2017-03-14 16:04:33 -07:00
Alex Dadgar
36dc330737 Various fixes
This PR:
* Uses Go 1.8 executable lookup
* Stores any err message from stats init method
* Allows overriding of Cpu Compute for hosts where it can't be detected
2017-03-14 12:56:31 -07:00
Michael Schurter
2452f32476 Round two of env var cleaning
Should bring us into conformance with IEEE Std 1003.1, 2004 Edition:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html

1 alloc/op and ~80ns/op on my machine.
2017-03-08 16:46:13 -08:00
Alex Dadgar
07f7e19578 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
Diptanu Choudhury
f551dcb83e Making the job spec return api.Job 2017-02-16 13:52:39 -08:00
Sean Chittenden
31333eecae Add better verification of a host's HostID. 2017-02-02 16:24:32 -08:00
Diptanu Choudhury
6d669fb48e Moved functions to helper from structs 2017-01-18 15:55:14 -08:00
Michael Schurter
4a3243aaf5 Add docs for generating example certificates 2016-11-15 17:22:54 -08:00
Michael Schurter
c9397c75a8 Fix tlsutil tests 2016-11-10 12:18:13 -08:00
Alex Dadgar
818196e4a1 get tlsutil tests to compile - need to regenerate the certificates 2016-11-09 14:41:08 -08:00
Michael Schurter
1ce766408b Remove incorrectly committed line and wrong comment 2016-11-01 15:57:21 -07:00
Michael Schurter
cd9fbfa0c7 Remove ServerName because we verify based on region 2016-11-01 14:17:31 -07:00
Diptanu Choudhury
7ee2a1515b Making Nomad TLS configs region aware 2016-11-01 11:55:29 -07:00
Diptanu Choudhury
f416ac7419 Moved tlsutil into helpers 2016-10-25 16:05:37 -07:00
Alex Dadgar
9ff2bf0bff Fix Vault parsing of booleans 2016-10-10 18:04:39 -07:00
Alex Dadgar
d87d988491 Floor CPU MHz and total compute and mark hostname as unique 2016-06-22 15:01:36 -07:00
Sean Chittenden
e26606acfd Memoize the CPU stats. Error if CPU fingerprinting fails. 2016-06-17 12:13:53 -07:00
Diptanu Choudhury
d1fdd27f86 Moving the clkspeed code to helper 2016-06-11 17:31:49 +02:00
Diptanu Choudhury
17a0e30068 Checking in the stats helper package 2016-06-10 23:46:33 +02:00
Sean Chittenden
29be52f762 Speling police 2016-05-15 09:41:34 -07:00
Alex Dadgar
fefc55906e Job diff using generic structures 2016-05-10 22:23:34 -07:00
Ivo Verberk
3fa40ea6c7 Add comments and fix a typo 2016-04-11 23:09:09 +02:00
Ivo Verberk
92bf6f1ad0 Add helper to validate raw configuration data 2016-04-10 00:42:43 +02:00
Diptanu Choudhury
cf1aba56a8 Interpolating service tags 2016-03-28 15:02:00 -07:00
Aleksejs Sinicins
2f10e75b57 Allow dashes in var names 2016-02-27 18:42:33 +02:00
Alex Dadgar
8b55fd6b70 Only interpret vars wrapped in braces 2016-02-04 17:26:46 -08:00
Alex Dadgar
e91abac0f6 Fix a bunch of tests
Up timeouts

trusty travis beta

Increase timeouts
2016-01-20 16:03:53 -08:00
Alex Dadgar
b8a42786f3 merge 2016-01-11 09:58:26 -08:00
Diptanu Choudhury
06443a6629 Using cgo dependencies to look up users 2015-12-15 11:12:13 -08:00
Chris Bednarski
ea2499251d Added build flag to user-lookup so it does not build on windows 2015-12-01 14:28:12 -08:00