open-nomad/client/allocrunner
Seth Hoenig 0e44094d1a client: enable configuring enable_tag_override for services
Consul provides a feature of Service Definitions where the tags
associated with a service can be modified through the Catalog API,
overriding the value(s) configured in the agent's service configuration.

To enable this feature, the flag enable_tag_override must be configured
in the service definition.

Previously, Nomad did not allow configuring this flag, and thus the default
value of false was used. Now, it is configurable.

Because Nomad itself acts as a state machine around the the service definitions
of the tasks it manages, it's worth describing what happens when this feature
is enabled and why.

Consider the basic case where there is no Nomad, and your service is provided
to consul as a boring JSON file. The ultimate source of truth for the definition
of that service is the file, and is stored in the agent. Later, Consul performs
"anti-entropy" which synchronizes the Catalog (stored only the leaders). Then
with enable_tag_override=true, the tags field is available for "external"
modification through the Catalog API (rather than directly configuring the
service definition file, or using the Agent API). The important observation
is that if the service definition ever changes (i.e. the file is changed &
config reloaded OR the Agent API is used to modify the service), those
"external" tag values are thrown away, and the new service definition is
once again the source of truth.

In the Nomad case, Nomad itself is the source of truth over the Agent in
the same way the JSON file was the source of truth in the example above.
That means any time Nomad sets a new service definition, any externally
configured tags are going to be replaced. When does this happen? Only on
major lifecycle events, for example when a task is modified because of an
updated job spec from the 'nomad job run <existing>' command. Otherwise,
Nomad's periodic re-sync's with Consul will now no longer try to restore
the externally modified tag values (as long as enable_tag_override=true).

Fixes #2057
2020-02-10 08:00:55 -06:00
..
interfaces allow only positive shutdown delay 2019-12-16 11:38:30 -05:00
state stale allocation data leads to incorrect (and even negative) metrics (#5637) 2019-05-07 15:54:36 -04:00
taskrunner tests: set consul token for nomad client for testing SIDS TR hook 2020-01-31 19:06:15 -06:00
alloc_runner.go nomad: proxy requests for Service Identity tokens between Clients and Consul 2020-01-31 19:03:53 -06:00
alloc_runner_hooks.go client: fix trace log message in alloc hook update (#6881) 2019-12-19 16:44:04 -05:00
alloc_runner_test.go allow only positive shutdown delay 2019-12-16 11:38:30 -05:00
alloc_runner_unix_test.go client: improve group service stanza interpolation and check_re… (#6586) 2019-11-18 13:04:01 -05:00
allocdir_hook.go client: cleanup and document context uses 2019-03-12 15:03:54 -07:00
config.go client: enable nomad client to request and set SI tokens for tasks 2020-01-31 19:03:38 -06:00
consulsock_hook.go connect: remove proxy socket for restarted client 2019-09-25 14:58:17 -04:00
consulsock_hook_test.go connect: add unix socket to proxy grpc for envoy (#6232) 2019-09-03 08:43:38 -07:00
groupservice_hook.go client: enable configuring enable_tag_override for services 2020-02-10 08:00:55 -06:00
groupservice_hook_test.go shutdown delay for task groups 2019-12-16 11:38:16 -05:00
health_hook.go add default update stanza and max_parallel=0 disables deployments (#6191) 2019-09-02 10:30:09 -07:00
health_hook_test.go client: improve group service stanza interpolation and check_re… (#6586) 2019-11-18 13:04:01 -05:00
migrate_hook.go client: cleanup and document context uses 2019-03-12 15:03:54 -07:00
network_hook.go driver/networking: don't recreate existing network namespaces 2019-09-25 14:58:17 -04:00
network_hook_test.go driver/networking: don't recreate existing network namespaces 2019-09-25 14:58:17 -04:00
network_manager_linux.go spellcheck: Fix spelling of retrieve 2019-12-05 18:59:47 -06:00
network_manager_linux_test.go ar: rearrange network hook to support building on windows 2019-07-31 01:03:19 -04:00
network_manager_nonlinux.go ar: refactor network bridge config to use go-cni lib (#6255) 2019-09-04 16:33:25 -04:00
networking.go ar: refactor network bridge config to use go-cni lib (#6255) 2019-09-04 16:33:25 -04:00
networking_bridge_linux.go client/networking: wrap error message from CNI plugin (#6316) 2019-09-13 08:20:05 -04:00
testing.go client: enable nomad client to request and set SI tokens for tasks 2020-01-31 19:03:38 -06:00
upstream_allocs_hook.go client: cleanup and document context uses 2019-03-12 15:03:54 -07:00
util.go allocrunnerv2 -> allocrunner 2018-10-16 16:56:56 -07:00