open-nomad/client/allocrunner/taskrunner
Seth Hoenig 519429a2de consul: probe consul namespace feature before using namespace api
This PR changes Nomad's wrapper around the Consul NamespaceAPI so that
it will detect if the Consul Namespaces feature is enabled before making
a request to the Namespaces API. Namespaces are not enabled in Consul OSS,
and require a suitable license to be used with Consul ENT.

Previously Nomad would check for a 404 status code when makeing a request
to the Namespaces API to "detect" if Consul OSS was being used. This does
not work for Consul ENT with Namespaces disabled, which returns a 500.

Now we avoid requesting the namespace API altogether if Consul is detected
to be the OSS sku, or if the Namespaces feature is not licensed. Since
Consul can be upgraded from OSS to ENT, or a new license applied, we cache
the value for 1 minute, refreshing on demand if expired.

Fixes https://github.com/hashicorp/nomad-enterprise/issues/575

Note that the ticket originally describes using attributes from https://github.com/hashicorp/nomad/issues/10688.
This turns out not to be possible due to a chicken-egg situation between
bootstrapping the agent and setting up the consul client. Also fun: the
Consul fingerprinter creates its own Consul client, because there is no
[currently] no way to pass the agent's client through the fingerprint factory.
2021-06-07 12:19:25 -05:00
..
getter update template and artifact interpolation to use client-relative paths 2021-01-04 22:25:34 +00:00
interfaces template: trigger change_mode for dynamic secrets on restore (#9636) 2020-12-16 13:36:19 -05:00
restarts lifecycle: add poststop hook (#8194) 2020-11-12 08:01:42 -08:00
state
template consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
testdata
artifact_hook.go update template and artifact interpolation to use client-relative paths 2021-01-04 22:25:34 +00:00
artifact_hook_test.go update template and artifact interpolation to use client-relative paths 2021-01-04 22:25:34 +00:00
connect_native_hook.go Automatically populate CONSUL_HTTP_ADDR for connect native tasks in host networking mode. Fixes #10239 2021-03-28 14:34:31 +02:00
connect_native_hook_test.go consul: probe consul namespace feature before using namespace api 2021-06-07 12:19:25 -05:00
device_hook.go
device_hook_test.go
dispatch_hook.go
dispatch_hook_test.go
driver_handle.go core: propagate remote task handles 2021-04-27 15:07:03 -07:00
envoy_bootstrap_hook.go consul/connect: add support for connect mesh gateways 2021-06-04 08:24:49 -05:00
envoy_bootstrap_hook_test.go consul: probe consul namespace feature before using namespace api 2021-06-07 12:19:25 -05:00
envoy_version_hook.go consul/connect: fix regression where client connect images ignored 2020-12-14 09:47:55 -06:00
envoy_version_hook_test.go update template and artifact interpolation to use client-relative paths 2021-01-04 22:25:34 +00:00
errors.go
errors_test.go
lazy_handle.go
lifecycle.go drivers: Capture exit code when task is killed (#10494) 2021-05-04 10:54:00 -04:00
logmon_hook.go
logmon_hook_test.go
logmon_hook_unix_test.go deps: bump gopsutil to v3.21.2 2021-03-30 16:02:51 -04:00
plugin_supervisor_hook.go Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
remotetask_hook.go core: propagate remote task handles 2021-04-27 15:07:03 -07:00
script_check_hook.go e2e: consul namespace tests from nomad ent 2021-04-19 15:35:31 -06:00
script_check_hook_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
service_hook.go core: propagate remote task handles 2021-04-27 15:07:03 -07:00
service_hook_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
sids_hook.go
sids_hook_test.go
stats_hook.go tests: deflake TestTaskRunner_StatsHook_Periodic (#9734) 2021-01-06 16:03:00 -05:00
stats_hook_test.go tests: deflake TestTaskRunner_StatsHook_Periodic (#9734) 2021-01-06 16:03:00 -05:00
task_dir_hook.go update template and artifact interpolation to use client-relative paths 2021-01-04 22:25:34 +00:00
task_runner.go drivers: Capture exit code when task is killed (#10494) 2021-05-04 10:54:00 -04:00
task_runner_getters.go lifecycle: add poststop hook (#8194) 2020-11-12 08:01:42 -08:00
task_runner_hooks.go core: propagate remote task handles 2021-04-27 15:07:03 -07:00
task_runner_test.go consul: probe consul namespace feature before using namespace api 2021-06-07 12:19:25 -05:00
tasklet.go
tasklet_test.go
template_hook.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
validate_hook.go s/0.13/1.0/g 2020-10-14 15:17:47 -07:00
validate_hook_test.go
vault_hook.go
vault_hook_test.go
volume_hook.go volumes: return better error messages for unsupported task drivers (#8030) 2020-05-21 09:18:02 -04:00
volume_hook_test.go volumes: return better error messages for unsupported task drivers (#8030) 2020-05-21 09:18:02 -04:00