Template signal de-duplication

Hi,

I have haproxy running on nomad. Using the template feature, I generate the backends and the route-map dynamically from Consul data in different files.

What I see now is that when there’s an update it renders the first template, then the second one firing a reload signal for each rendered template.

Is it possible to say that nomad should render both templates and then signal once?

I found a discussion in Github issues for consul template about exactly this topic, and consul-template is somehow already able to de-duplicate this.
But it appears nomad does not make use of this functionality, or it only works with commands and not with kill signals.

Thanks!

Hey Roman,

I’m not a Nomad expert, but I maintain Consul-Template and can take a stab at this from that angle.

First a question that may help. Have you tried setting the wait parameter. This setting has the effect of making consul-template wait a bit after getting a new value (the minimum wait setting) before rendering the templates. It is meant to help with situations where you might get flapping values, but it might help here by delaying the rendering until all the values are in and it can render all the templates in one go and only reload once. Not 100% on this but it is worth a try.

The ticket you link to in consul-template about how it de-duplicates the template commands… is a red herring I think. In consul-template there are 2 types of commands/executables, there is the primary managed process that consul-template starts and monitors, then there are template-commands that are commands associated with each individual template that get run when just that template is rendered. It is that second type that is de-duplicated and I don’t think that is how Nomad uses consul-template, I think it is the first managed process that you are discussing.

Good luck and I hope this helps.

1 Like

One last thing I thought of while re-reading that… If the type of command is the second, template-command, that deduplication is more a side effect of how it is used inside consul-template and was not really a specific feature. So I’m not sure how that would work in relation to Nomad.

1 Like

Thanks for your explanation!

Yes, I’ve tried that. Unfortunately, the process is still signaled multiple times.