consul-template v0.19.0 (33b34b3)
consul {
address = "127.0.0.1:8500"
}
reload_signal = "SIGHUP"
kill_signal = "SIGINT"
max_stale = "10s"
log_level = "warn"
template {
source = "/home/cionix/consul-tool-issue.tmpl"
destination = "/home/cionix/consul-tool-issue.tmpl.out"
wait {
min = "2s"
max = "8s"
}
}
template {
source = "/home/cionix/consul-tool-issue-1.tmpl"
destination = "/home/cionix/consul-tool-issue-1.tmpl.out"
wait {
min = "2s"
max = "8s"
}
/home/cionix/consul-tool-issue.tmpl
{{ key "folder/test" }}
/home/cionix/consul-tool-issue-1.tmpl
{{ timestamp "unix" }}
consul-template -log-level=trace -config "/etc/consul-template/conf/config.hcl"
https://gist.github.com/marcelki/ab337ce4ad5328b22462cea2ff66bfc3
Render templates and update when changes occur.
Consul-template updates the template at the configured at the configured min wait quiescence timer.
What's kinda weird is that:
Are there any other GitHub issues (open or closed) that should
be linked here? For example:
We've recently experienced the same thing. Wasn't sure if this is a bug or just a misunderstanding on my part on how the quiescence timer works.
I was able to reproduce this I think.
With the provided config and templates it would refresh the templates every few seconds. The content of the 2 templates didn't matter, timestamp or just the kv value, it would keep refreshing.
I noticed the refresh of the 2 templates alternated at the wait-min setting. So if template-1 was set with a wait-min of 1s and template-2 was set to 3s. You'd kick it off and after 1 second template-1 would refresh, then after 3 seconds template-2 would refresh, then after another 1 second template-1 would refresh again, etc. It was as if the (psuedo-)code looked like...
while true {
for template in list-of-templates {
time.Sleep(template.wait-min)
template.Refresh()
}
}
Note that if there is only 1 template in the configuration file it would never refresh unless the kv value changed. Also note that, as I mentioned, the template containing a timestamp field made no difference (other than making it easier to see what was going on).
It looks like this might be a duplicate of #1140 with the addition of a timestamp to make it so the template changes every time. I double checked and it is only rendering in memory each loop and only writes to disk if something changed. So the timestamp is triggering the disk write to it changing the template every time.
Even though this one was first I'm going to close it as a duplicate of #1140 as there has been more discussion there and it seems a better place to centralize the discussion.
Most helpful comment
We've recently experienced the same thing. Wasn't sure if this is a bug or just a misunderstanding on my part on how the quiescence timer works.