consul-templaterb 1.18.3 → 1.18.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b12634693cd840c5981486ee1f2daef7b2d6a35ef3df18d726653a23d1d68a1
4
- data.tar.gz: efad7e3762bf953e5029c3ddc2aa9fa8de5d06728d482f0af0679af69ad49c12
3
+ metadata.gz: 0dc3089b2ac9f444e1b9b0d01e1f0615db553d441fec27cfb957f9971ecd4e5e
4
+ data.tar.gz: 14695f0f6de3dd032aaf15316b5136e695f3ec61e1879592379515419431771e
5
5
  SHA512:
6
- metadata.gz: 17b0e0a59eb862d07946543bbfc170ac827ffdcdfb1c28e691e03352678abc30b7f195241fa311b66a05c263d42606bcb76d86a49445136d0ec3f7643e4cfafd
7
- data.tar.gz: dd427f30e6f07cbd908cf1bab8bfd262c4fabd468dabc41fb5502264df8980813f8d40f9257fc02f4b39f14ca835368778bd375539c110734fb04d9a969f2094
6
+ metadata.gz: 8b9f4fdbd637ad60ddb4de4068db591d851e342e91717587ec773e4351de6b58ed11cdee8f5452345f41061d397bc613621d4994e737a6701459dd9c4ea7887a
7
+ data.tar.gz: 2c455c1fd909169d491387bb05be7d19fffe90ba3660788dc6135d2e905fc8a8a10bd1b1e8c640b875918db24efdd41f3d588cbff81025c3ea2b10e8666ea40f
data/.gitignore CHANGED
@@ -12,6 +12,8 @@
12
12
  /samples/**/*.html
13
13
  /samples/**/*.txt
14
14
  /samples/**/*.cfg
15
+ /samples/hosts
16
+ /samples/hosts_per_services
15
17
  /samples/prometheus_consul_coordinates
16
18
  /samples/ready
17
19
  /samples/render_template_from_kv
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.18.4
6
+
7
+ IMPROVEMENTS:
8
+
9
+ * `samples/metrics.erb` now export prometheus tag containing service.kind, can
10
+ be used to group/ignore services with connect enabled
11
+ * Better support for filtering Connect proxies in service list in consul-ui
12
+ * Added new samples `samples/hosts*` samples to generate /etc/hosts files
13
+
5
14
  ## 1.18.3 (September 2, 2019)
6
15
 
7
16
  BUGFIX:
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.18.3'.freeze
3
+ VERSION = '1.18.4'.freeze
4
4
  end
5
5
  end
@@ -172,7 +172,7 @@ class ConsulService {
172
172
  filter = new RegExp(safeReg);
173
173
  }
174
174
  consulService.serviceFilterCount = 0;
175
- var showProxiesInList = this.showProxiesInList;
175
+ var showProxiesInList = consulService.showProxiesInList;
176
176
  consulService.serviceList.children('.serviceListItem').each(function (){
177
177
  var ui = $(this);
178
178
  if(serviceMatcher(this, filter, showProxiesInList)) {
@@ -282,7 +282,7 @@ class ServiceTimeline {
282
282
  console.log("Failed to compile regexp for '" + serviceVal + "', using strict lookup due to: " + e);
283
283
  filter = new RegExp(safeReg);
284
284
  }
285
- var showProxiesInList = this.showProxiesInList;
285
+ var showProxiesInList = serviceTimeline.showProxiesInList;
286
286
  serviceTimeline.serviceList.children('.serviceListItem').each(function (){
287
287
  var ui = $(this);
288
288
  if(this.getElementsByClassName('service-name')[0].innerHTML == 'All' || this.getElementsByClassName('service-name')[0].innerHTML.match(filter)) {
@@ -0,0 +1,28 @@
1
+ # If you export HOSTS_FOR_ALL_DCS, then your /etc/hosts will contain
2
+ # all consul registered nodes for all DCs, otherwise, only local
3
+ # nodes will be dumped
4
+ # This file is auto-generated and generates a suitable /etc/hosts
5
+ 127.0.0.1 localhost localhost.localdomain
6
+
7
+ # The following lines are desirable for IPv6 capable hosts
8
+ ::1 ip6-localhost ip6-loopback
9
+ fe00::0 ip6-localnet
10
+ ff00::0 ip6-mcastprefix
11
+ ff02::1 ip6-allnodes
12
+ ff02::2 ip6-allrouters
13
+ ff02::3 ip6-allhosts
14
+
15
+ <%
16
+ dcs = if ENV['HOSTS_FOR_ALL_DCS']
17
+ datacenters
18
+ else
19
+ # Only for local DC
20
+ [nil]
21
+ end
22
+ dcs.each do |current_dc|
23
+ nodes(dc: current_dc).each do |snode|
24
+ %><%= snode['Address'] %> <%= snode['Node'] %>
25
+ <%
26
+ end
27
+ end
28
+ %>
@@ -0,0 +1,49 @@
1
+ <%
2
+ # This template generate a file suitable to use as an /etc/hosts file
3
+ # by populating it with all the service address of nodes
4
+ #
5
+ # This template can be configure the following way with environment variables
6
+ # Environment variables to filter services/instances
7
+ # SERVICES_MATCH_FILTER: regexp to filter services (default: .*)
8
+ # SERVICES_TAG_FILTER: basic tag filter for service (default: all services)
9
+ # INSTANCE_MUST_TAG: Second level of filtering (optional, default to SERVICES_TAG_FILTER)
10
+ # INSTANCE_EXCLUDE_TAG: Exclude instances having the given tag (default: canary)
11
+ # EXCLUDE_SERVICES: comma-separated services regexps to exclude (default: lbl7.*,netsvc-probe.*,consul-probed.*)
12
+
13
+ services_match_filter = Regexp.new(ENV['SERVICES_MATCH_FILTER'] || '.*')
14
+ service_tag_filter = ENV['SERVICES_TAG_FILTER'] || nil
15
+ instance_must_tag = ENV['INSTANCE_MUST_TAG'] || service_tag_filter
16
+ instance_exclude_tag = ENV['INSTANCE_EXCLUDE_TAG']
17
+
18
+ # Services to hide
19
+ services_blacklist_raw = (ENV['EXCLUDE_SERVICES'] || 'lbl7.*,netsvc-probe.*,consul-probed.*').split(',')
20
+ services_blacklist = services_blacklist_raw.map { |v| Regexp.new(v) }
21
+ %>
22
+ # This file is auto-generated and generates a suitable /etc/hosts
23
+ 127.0.0.1 localhost localhost.localdomain
24
+
25
+ # The following lines are desirable for IPv6 capable hosts
26
+ ::1 ip6-localhost ip6-loopback
27
+ fe00::0 ip6-localnet
28
+ ff00::0 ip6-mcastprefix
29
+ ff02::1 ip6-allnodes
30
+ ff02::2 ip6-allrouters
31
+ ff02::3 ip6-allhosts
32
+
33
+ <%
34
+ all_nodes = {}
35
+ services(tag: service_tag_filter).each do |service_name, tags|
36
+ if services_match_filter.match(service_name) && !services_blacklist.any? {|r| r.match(service_name)} && (instance_must_tag.nil? || tags.include?(instance_must_tag))
37
+ service(service_name).each do |snode|
38
+ tags_of_instance = snode['Service']['Tags']
39
+ if (instance_must_tag.nil? || tags_of_instance.include?(instance_must_tag)) && !tags_of_instance.include?(instance_exclude_tag)
40
+ # This is gonna exclude sync tools such as consul-k8s setting external-source
41
+ all_nodes[snode['Node']['Node']] = snode['Node']['Address'] unless snode.service_or_node_meta_value('external-source')
42
+ end
43
+ end
44
+ end
45
+ end
46
+ %><%
47
+ all_nodes.keys.sort.each do |node_name|
48
+ %><%= node_name %> <%= all_nodes[node_name] %>
49
+ <% end %>
@@ -29,6 +29,8 @@
29
29
  srv.each do |snode|
30
30
  key = "#{snode['Service']['Service']}"
31
31
  metas = {}
32
+ service_kind = snode['Service']['Kind']
33
+ metas['__service_kind'] = service_kind if service_kind
32
34
  service_metas_to_export.each do |k|
33
35
  meta = snode.service_or_node_meta_value(k)
34
36
  if meta
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-templaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.3
4
+ version: 1.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SRE Core Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-02 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -225,6 +225,8 @@ files:
225
225
  - samples/debug/compare_connect_services.txt.erb
226
226
  - samples/ha_proxy.cfg.erb
227
227
  - samples/haproxy_dns.cfg.erb
228
+ - samples/hosts.erb
229
+ - samples/hosts_per_services.erb
228
230
  - samples/keys.html.erb
229
231
  - samples/kv_yaml_to_json.json.erb
230
232
  - samples/list_ruby_versions_from_rubygems.txt.erb
@@ -261,7 +263,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
263
  - !ruby/object:Gem::Version
262
264
  version: '0'
263
265
  requirements: []
264
- rubygems_version: 3.0.3
266
+ rubyforge_project:
267
+ rubygems_version: 2.7.7
265
268
  signing_key:
266
269
  specification_version: 4
267
270
  summary: Implementation of Consul template using Ruby and .erb templating language