hashicorp / hashicorp/consul-template
Bug: Deduplication mode with exec mode in the same consul-template config
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
### Consul Template version
```
2022-07-29T05:33:52.961Z [INFO] consul-template v0.29.1 (4525703)
```
### Configuration
```hcl
log_level = "trace"
# Setting this value to the empty string will cause consul-template
# to not listen for any reload signals but pass them down to nginx instead.
reload_signal = ""
consul {
retry {
enabled = true
attempts = 10
max_backoff = "1s"
}
}
# See: https://github.com/hashicorp/consul-template/blob/main/docs/modes.md#de-duplication-mode
deduplicate {
# This enables de-duplication mode.
enabled = true
# This is the prefix to the path in Consul's KV store where de-duplication
# templates will be pre-rendered and stored.
prefix = "consul-template/dedup/"
}
template {
source = "templates/service-gateway.conf.ctmpl"
destination = "local/nginx/conf.d/service-gateway.conf"
}
template {
source = "templates/http-status.conf.ctmpl"
destination = "local/nginx/conf.d/http-status.conf"
}
exec {
# We are setting the kill_timeout to the max 5m that Nomad is going to wait before killing consul-template itself
# This way we allow Nomad to be the one controlling the kill_timeout and not consul-template
kill_timeout = "5m"
# It is very important to use the "array" syntax when defining parameters to the command,
# otherwise consul-template does not pass signals correctly to the spawned process.
# See: https://github.com/hashicorp/consul-template#multiple-commands
command = ["nginx"]
}
```
### Command
```shell
consul-template -config /config.hcl -exec-kill-signal SIGQUIT -exec-reload-signal SIGHUP
```
### Debug output
Upon request
### Expected behavior
I would expect `deduplication` mode to work with the `exec` mode.
### Actual behavior
The leader consul-template renders templates and executes the process but all other consul-templates are blocked on waiting on changes for the templates and never execute the process defined in the `exec` stanza.
Contributor guide
Research direction
Start by reproducing the supplied consul-template command with deduplicate.enabled, the two template sources, and the exec.command configuration. Trace how deduplication handles non-leaders and how exec mode starts the process. Done means deduplication and exec mode work together, including for non-leader consul-template instances.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100