hashicorp / hashicorp/consul

TTLs based on tags

Open
#7,741 0 comments 0 reactions 0 assignees View on GitHub
theme/dns theme/service-metadata type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

Via #4509 and #4605 TTLs for service prefixes became available. This is, according to documentation, to serve the use-case for a more specific service. The following prefix `db*` allows a TTLs for every service that starts with `db`. If you want, however, a different TTL for the same service on a different ethernet interface, you should add a new service and rename it to start with the ethernet interface name. And then change config to use a `service_ttl` for `eth0-*` This leads to unclear naming of services.

The solution could be to allow postfixes on `service_ttl` or implement TTL based on tags. As @pierresouchay already suggests in #4509 it is probably best to implement tag based TTLs, because radix trees work great with prefixes, not with postfixes.

My suggestion would be to add the config `service_tag_ttl`, a map with the tag as the key and the ttl as value. It should have precedence over `service_ttl`. Prefixes or other wildcard functionality is not required.

```json
"service_tag_ttl": {
"eth0": "5s"
},
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.