Open jshrack-ssi opened 6 years ago
I believe the problem is that the custom resource job isn't honoring the attribute node['prometheus']['job_config_cookbook_name']
to set the alternate template cookbook source. It's defaulting to prometheus
and overriding the original template resource's setting.
If you add source node['prometheus']['job_config_cookbook_name']
to every prometheus_job resource then it works, but of course you can't use the one from the default recipe of this cookbook without cloning/redefining it.
Hey @jshrack-ssi try it now off the master branch, I think I have a fix in that lets the cookbook honor the node['prometheus']['job_config_cookbook_name']
attribute correctly.
Oh, and in response to your original comment about the config template resource with action :nothing, that resource is being edited by the custom job resource in resources/job.rb
each time you call prometheus_job
. That's where the default value of prometheus
was overwriting the cookbook
parameter of the template resource.
When specifying a wrapper cookbook as the template source for prometheus.yml it does not work. This appears to be due to the fact the following block is set to action :nothing-
template node['prometheus']['flags']['config.file'] do action :nothing cookbook node['prometheus']['job_config_cookbook_name'] source node['prometheus']['job_config_template_name'] mode '0644' owner node['prometheus']['user'] group node['prometheus']['group'] variables( rule_filenames: node['prometheus']['rule_filenames'] ) notifies :reload, 'service[prometheus]' end
This would seem contrary to supporting external template control. I don't see anywhere in the cookbook that would otherwise call this code block.