open-nomad/client
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
..
allocdir
allochealth
allocrunner consul: probe consul namespace feature before using namespace api 2021-06-07 12:19:25 -05:00
allocwatcher
config client: disable cpuset cgroup managment if init fails 2021-04-14 14:44:08 -04:00
consul
devicemanager
dynamicplugins
fingerprint consul: probe consul namespace feature before using namespace api 2021-06-07 12:19:25 -05:00
interfaces
lib nit: code cleanup/organization 2021-04-16 15:14:29 -04:00
logmon
pluginmanager CSI: Include MountOptions in capabilities sent to CSI for all RPCs 2021-05-24 10:59:54 -04:00
servers
state
stats
structs csi: accept list of caps during validation in volume register 2021-06-04 07:57:26 -04:00
taskenv expose NOMAD_MEMORY_MAX_LIMIT env var (#10514) 2021-05-05 12:09:56 -04:00
testutil client/ar: thread through cpuset manager 2021-04-13 13:28:36 -04:00
vaultclient
acl.go
acl_test.go
agent_endpoint.go
agent_endpoint_test.go
alloc_endpoint.go client: fix multiple imports (#10537) 2021-05-13 14:30:31 -04:00
alloc_endpoint_test.go client: fix multiple imports (#10537) 2021-05-13 14:30:31 -04:00
alloc_watcher_e2e_test.go
client.go core: propagate remote task handles 2021-04-27 15:07:03 -07:00
client_stats_endpoint.go
client_stats_endpoint_test.go
client_test.go client: fix multiple imports (#10537) 2021-05-13 14:30:31 -04:00
csi_endpoint.go
csi_endpoint_test.go csi: accept list of caps during validation in volume register 2021-06-04 07:57:26 -04:00
driver_manager_test.go
enterprise_client_oss.go
fingerprint_manager.go
fingerprint_manager_test.go
fs_endpoint.go
fs_endpoint_test.go
gc.go
gc_test.go
heartbeatstop.go
heartbeatstop_test.go
node_updater.go
rpc.go
rpc_test.go
testing.go
util.go
util_test.go