consul-templaterb 1.27.1 → 1.29.0

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: 6c4d19fa22c559f4a7960529dd3960c1c741f631b1cf0b51f5d10155b2b8a131
4
- data.tar.gz: 926930e64938a40c2a2653abf9a84f0c86057201646a2f8e02fed06ed51927b8
3
+ metadata.gz: 76c96f61a1890c149604e52ed7d68bd239fe6b8df3bdf12b21fc5aacc07d985b
4
+ data.tar.gz: 7053673ba6ee2775cdc80a04fd2c8b2d8956b41f58108eac1617599d604072bd
5
5
  SHA512:
6
- metadata.gz: 5126d79bcbd0d469bcb7ec5d214c979990056c3c11e1547d4819849f3fcd7fddd1534354f565722a52dbb09ba26c63dd4553f40282fcafaccd7be6a2a1d9442f
7
- data.tar.gz: 7d6345911c69a8c0622f0b88343968ff951d8243db78d41b8cfad74e26ad5c87a39ae02e3bb24d4cf1615fe329fc53642f81aaf76591d1f5be4098c576baea96
6
+ metadata.gz: 75c8c5f6b55d8246942f0e86a7d2041d54822b980379c49e06b51f2d806f316dc8f35674751eb6610b50ec465140ac8412133765378aa60d47057557dbd694a8
7
+ data.tar.gz: 24366dc573380c88460224829282e80ed8e39f3312daf885cd28c8d5e3028c87d0239b4b0fdc8920820e101c58e5e47121ab181ff1fae6cbf769b4152c2e20c2
@@ -2,11 +2,48 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
- ## 1.27.1 (July 28 2020)
5
+ ## 1.29.0 (Oct 6, 2020)
6
+
7
+ IMPROVEMENTS:
8
+
9
+ * When no template has been specified, stop early with an error message
10
+
11
+ ## 1.28.2 (Oct 5, 2020)
12
+
13
+ NEW FEATURES:
14
+
15
+ * Added new decorator to compute node names in consul-ui ([#70](https://github.com/criteo/consul-templaterb/pull/70))
16
+
17
+ ## 1.28.1 (Sept 30, 2020)
18
+
19
+ IMPROVEMENTS:
20
+
21
+ * Reduced size of GEM from 400k o 100k by removing not needed files
22
+
23
+ ## 1.28.0 (Sept 25, 2020)
24
+
25
+ NEW FEATURES:
26
+
27
+ * Added `-W` or `--wait-between-reload-signal` to avoid sending too many signals
28
+ to a process executed. This avoids for instance reloading too much a HAProxy configuration
29
+ without having to play with `-w` as described in [#69](https://github.com/criteo/consul-templaterb/issues/69)
30
+
31
+ BUG FIXES:
32
+
33
+ * Removed warnings at runtime with Ruby 2.7+
34
+ * Minor JS fix in Consul-UI (Added missing unused parameter to function `serviceTitleGenerator`)
35
+
36
+ ## 1.27.2 (Sept 4, 2020)
37
+
38
+ IMPROVEMENTS:
39
+
40
+ * Consul-UI now supports navigation between nodes and services in both ways
41
+
42
+ ## 1.27.1 (July 28, 2020)
6
43
 
7
44
  BUGIX:
8
45
 
9
- * Fix collision in JSON queries when using payload in requests #68
46
+ * Fix collision in JSON queries when using payload in requests [#68](https://github.com/criteo/consul-templaterb/pull/68)
10
47
 
11
48
  ## 1.27.0 (June 5, 2020)
12
49
 
@@ -19,15 +56,15 @@ NEW FEATURES:
19
56
 
20
57
  ## 1.26.3 (April 15, 2020)
21
58
 
22
- BUGFIX:
59
+ BUG FIXES:
23
60
 
24
61
  * Removed all Criteo specific decorators from Consul-UI
25
62
 
26
63
  ## 1.26.2 (April 15, 2020)
27
64
 
28
- BUGFIX:
65
+ BUG FIXES:
29
66
 
30
- * Fixed broken Dockerfile (was missing the new `decorator.js.erb` file). Fixes #61 (Thanks to @ simongareste)
67
+ * Fixed broken Dockerfile (was missing the new `decorator.js.erb` file). Fixes #61 (Thanks to [@simongareste](https://github.com/simongareste))
31
68
 
32
69
  NEW FEATURES:
33
70
 
@@ -35,7 +72,7 @@ NEW FEATURES:
35
72
 
36
73
  ## 1.26.1 (March 27, 2020)
37
74
 
38
- BUGFIX:
75
+ BUG FIXES:
39
76
 
40
77
  * Using `agent: http://vault_or_consul_agent:port>` was not properly taken into account in some endpoints
41
78
 
@@ -53,7 +90,7 @@ NEW FEATURES:
53
90
 
54
91
  ## 1.25.2 (February 29, 2020)
55
92
 
56
- BUGFIX:
93
+ BUG FIXES:
57
94
 
58
95
  * Update rake to 12.3.3 to fix [CVE-2020-8130](https://github.com/advisories/GHSA-jppv-gw3r-w3q8)
59
96
 
@@ -72,7 +109,7 @@ NEW FEATURES:
72
109
 
73
110
  ## 1.24.1 (February 19, 2020)
74
111
 
75
- BUGFIX:
112
+ BUG FIXES:
76
113
 
77
114
  * Properly set service meta in node meta decorator
78
115
 
@@ -89,7 +126,7 @@ NEW FEATURES:
89
126
  * Implementation of #59 - implementation of `--retry` and `--vault-retry` new flags
90
127
  Those flags work in a similar way as in consul-template: stop program after X failures
91
128
  of consul or vault endpoints
92
- * Added --fail-fast that stop the programs immediately if vault or consul are not available
129
+ * Added `--fail-fast` that stop the programs immediately if vault or consul are not available
93
130
  at startup (also works with `--once`)
94
131
 
95
132
  ## 1.22.0 (January 17, 2020)
@@ -100,7 +137,7 @@ NEW FEATURES:
100
137
 
101
138
  ## 1.21.8 (January 2, 2020)
102
139
 
103
- BUGFIX:
140
+ BUG FIXES:
104
141
 
105
142
  * Escape properly metadata containing double quotes in prometheus exporter
106
143
 
@@ -114,13 +151,13 @@ IMPROVEMENTS:
114
151
 
115
152
  IMPROVEMENTS:
116
153
 
117
- * Added node_meta_info for serviceInstanceDecorator and serviceMetaDecorator
154
+ * Added `node_meta_info` for `serviceInstanceDecorator` and `serviceMetaDecorator` in Consul-UI
118
155
 
119
156
  ## 1.21.5 (December 6, 2019)
120
157
 
121
158
  NEW FEATURES:
122
159
 
123
- * Added clean() method in nodes.js to allow nexw behaviors
160
+ * Added `clean()` method in nodes.js to allow new behaviors
124
161
 
125
162
  ## 1.21.4 (November 28, 2019)
126
163
 
@@ -151,7 +188,7 @@ IMPROVEMENTS:
151
188
  ## 1.21.0 (November 21, 2019)
152
189
 
153
190
  * added function `templates` to list all templates being rendered
154
- * added support for JS decorators in consul-ui (thanks to @Thib17)
191
+ * added support for JS decorators in consul-ui (thanks to [@Thib17](https://github.com/Thib17))
155
192
 
156
193
  ## 1.20.0 (October 16, 2019)
157
194
 
@@ -170,7 +207,7 @@ NEW FEATURES:
170
207
 
171
208
  * Added new function `checks_for_node`
172
209
 
173
- BUGFIXs:
210
+ BUG FIXES:
174
211
 
175
212
  * Avoid try publishing several times Gem on rubygems.org
176
213
 
@@ -192,13 +229,13 @@ IMPROVEMENTS:
192
229
 
193
230
  ## 1.18.3 (September 2, 2019)
194
231
 
195
- BUGFIX:
232
+ BUG FIXES:
196
233
 
197
234
  * When vault receives at timeout, correctly reschedule it
198
235
 
199
236
  ## 1.18.2 (August 28, 2019)
200
237
 
201
- BUGFIX:
238
+ BUG FIXES:
202
239
 
203
240
  * In Consul UI, showing data from KV with markup was not properly handled
204
241
 
@@ -214,7 +251,7 @@ Support any request method for remote_resource.as_json (#41)
214
251
 
215
252
  ## 1.18.1 (July 27, 2019)
216
253
 
217
- BUGFIX:
254
+ BUG FIXES:
218
255
 
219
256
  Fixed wrong lazy initialization in `remote_resource.as_json` that
220
257
  cause too many connections to be opened.
@@ -223,13 +260,13 @@ cause too many connections to be opened.
223
260
 
224
261
  NEW FEATURES:
225
262
 
226
- * Support for `remote_resource` provided by @kamaradclimber
263
+ * Support for `remote_resource` provided by [@kamaradclimber](https://github.com/kamaradclimber)
227
264
  * Added support for `remote_resource.as_json` to fetch JSON remote resource from a web server
228
265
  * Added `samples/list_ruby_versions_from_rubygems.txt.erb` to demonstrate usage
229
266
 
230
267
  ## 1.17.3 (July 18, 2019)
231
268
 
232
- BUGFIX:
269
+ BUG FIXES:
233
270
 
234
271
  * Added gem parallel as a dependency to allow `samples/prometheus_consul_coordinates.erb`
235
272
  to work properly
@@ -354,7 +391,7 @@ NEW FEATURES:
354
391
 
355
392
  ## 1.10.1 (February 28, 2019)
356
393
 
357
- BUGFIX:
394
+ BUG FIXES:
358
395
 
359
396
  * Ensure that timeline sort properly events when healthchecks are removed (eg: maintenance)
360
397
 
@@ -377,7 +414,7 @@ IMPROVEMENTS:
377
414
 
378
415
  ## 1.9.8 (January 16, 2019)
379
416
 
380
- BUGFIX:
417
+ BUG FIXES:
381
418
 
382
419
  * When default value was the same as real value, endpoints were always marked as
383
420
  dirty, thus rendering of templates did never succeed.
@@ -393,7 +430,7 @@ IMPROVEMENTS:
393
430
 
394
431
  ## 1.9.6 (January 15, 2019)
395
432
 
396
- BUGFIX:
433
+ BUG FIXES:
397
434
 
398
435
  * Keep connections open properly as it increase timeouts on Consul servers on
399
436
  very large templates
@@ -404,7 +441,7 @@ IMPROVEMENTS:
404
441
 
405
442
  ## 1.9.5 (January 14, 2019)
406
443
 
407
- BUGFIX:
444
+ BUG FIXES:
408
445
 
409
446
  * Ensure to always re-open Connection to Consul agent in case of network error
410
447
 
@@ -454,11 +491,11 @@ IMPROVEMENTS:
454
491
 
455
492
  OPTIMIZATIONS:
456
493
 
457
- * Better network issue because of X-Consul-Index parsing bug
494
+ * Better network usage because of X-Consul-Index parsing bug
458
495
 
459
- NEW FEATURES:
496
+ BUG FIXES:
460
497
 
461
- * value.endpoint.x_consul_index now works as expected
498
+ * `value.endpoint.x_consul_index` now works as expected
462
499
 
463
500
  IMPROVEMENTS:
464
501
 
@@ -498,7 +535,7 @@ NEW FEATURES:
498
535
 
499
536
  ## 1.8.1 (December 12, 2018)
500
537
 
501
- BUGFIX:
538
+ BUG FIXES:
502
539
 
503
540
  * Properly fill `template_info` strtucture when hot reload is performed so templates using
504
541
  `template_info()` new function can behave nicely.
@@ -607,8 +644,8 @@ IMPROVEMENTS:
607
644
  * [Prometheus template](samples/metrics.erb) to export easily Consul
608
645
  informations about nodes, datacenters and all services states
609
646
  * Code style cleanup + travis now enforces Rubocop
610
- * Remove criteo references in spec files thanks to @pierrecdn
611
- * Bitrate display more consistent thanks to @pierrecdn
647
+ * Remove criteo references in spec files thanks to [@pierrecdn](https://github.com/pierrecdn)
648
+ * Bitrate display more consistent thanks to [@pierrecdn](https://github.com/pierrecdn)
612
649
 
613
650
  ## 1.5.3 (September 24, 2018)
614
651
 
data/README.md CHANGED
@@ -165,9 +165,19 @@ USAGE: consul-templaterb [[options]]
165
165
  -f, --[no-]fail-fast If consul/vault endpoints fail at startup, fail immediately
166
166
  -g, --no-gzip-compression Disable GZIP compression in HTTP requests
167
167
  -c, --consul-addr=<address> Address of Consul, eg: http://localhost:8500
168
+ --consul-cert-chain=<path/to/cert_chain>
169
+ Path to Consul TLS client certificate chain to use
170
+ --consul-private-key=<path/to/private_key>
171
+ Path to Consul TLS client private key to use
172
+ --skip-consul-verify-tls Skip verifying Consul TLS via certificate authority (DANGEROUS)
168
173
  -l, --log-level=<log_level> Log level, default=info, any of none|error|info|debug
169
174
  --consul-token=<token> Use a token to connect to Consul
170
175
  -V, --vault-addr=<address> Address of Vault, eg: http://localhost:8200
176
+ --vault-cert-chain=<path/to/cert_chain>
177
+ Path to Vault TLS client certificate chain to use
178
+ --vault-private-key=<path/to/private_key>
179
+ Path to Vault TLS client private key to use
180
+ --skip-vault-verify-tls Skip verifying Vault TLS via certificate authority (DANGEROUS)
171
181
  --vault-token=<token> Token used to authenticate against vault.
172
182
  --[no-]vault-renew Control auto-renewal of the Vault token. Default: activated
173
183
  --vault-retry, --vault-retry-attempts [RETRIES]
@@ -178,10 +188,11 @@ USAGE: consul-templaterb [[options]]
178
188
  -r, --retry-delay=<min_duration> Min Retry delay on Error/Missing Consul Index
179
189
  -k, --hot-reload=<behavior> Control hot reload behaviour, one of :[die (kill daemon on hot reload failure), keep (on error, keep running), disable (hot reload disabled)]
180
190
  -K, --sig-term=kill_signal Signal to send to next --exec command on kill, default=TERM
191
+ -M, --debug-memory-usage Display messages when RAM grows
181
192
  -T, --trim-mode=trim_mode ERB Trim mode to use (- by default)
182
193
  -R, --sig-reload=reload_signal Signal to send to next --exec command on reload (NONE supported), default=HUP
183
- -M, --debug-memory-usage Display messages when RAM grows
184
- -e, --exec=<command> Execute the following command
194
+ -W, --wait-signal=min_duration Wait at least n seconds before each reload signal being sent to next --exec process
195
+ -e, --exec=<command> Execute the following command in as a subprocess when all templates are ready
185
196
  -d, --debug-network-usage Debug the network usage
186
197
  -t erb_file:[output]:[command]:[params_file],
187
198
  --template Add a erb template, its output and optional reload command
@@ -235,7 +246,11 @@ nor write the file.
235
246
  Signals can be customized per process. Two signals are supported with options `--sig-reload` and
236
247
  `--sig-term`. When the option is added, the next `--exec` options to start a process will use the
237
248
  given signal. By default, HUP will be sent to reload events (you can use NONE to avoid sending any
238
- reload signal), TERM will be used when leaving consul-templaterb.
249
+ reload signal), TERM will be used when leaving consul-templaterb. A minimum duration between reload
250
+ signals can be specified for each sub process by prepending `--wait-signal=min_duration` to `--exec`
251
+ command.
252
+ In such case, the signal will be sent every `min_duration` as a maximum (very useful for templates
253
+ changing a lot, but you don't want to trigger too many reloads, for instance for a load-balancer).
239
254
 
240
255
  ### Bandwidth limitation
241
256
 
@@ -388,7 +388,7 @@ name or its ID. If DC is specified, will lookup for given node in another datace
388
388
 
389
389
  [Find all the checks](https://www.consul.io/api/health.html#list-checks-for-service) of a given service.
390
390
 
391
- ## def checks_in_state(check_state, dc: nil, [agent: consul_agent_address])
391
+ ## checks_in_state(check_state, dc: nil, [agent: consul_agent_address])
392
392
 
393
393
  [Find all the checks in a given state](https://www.consul.io/api-docs/health#list-checks-in-state) in the whole cluster.
394
394
 
@@ -94,6 +94,7 @@ consul_engine = Consul::Async::ConsulTemplateEngine.new
94
94
  @programs = {}
95
95
  cur_sig_reload = 'HUP'.freeze
96
96
  cur_sig_term = 'TERM'.freeze
97
+ cur_min_duration_between_signals = 1
97
98
 
98
99
  optparse = OptionParser.new do |opts|
99
100
  opts.banner = usage_text
@@ -215,6 +216,10 @@ optparse = OptionParser.new do |opts|
215
216
  cur_sig_term = compute_signal(sig, nil)
216
217
  end
217
218
 
219
+ opts.on('-M', '--debug-memory-usage', 'Display messages when RAM grows') do
220
+ consul_engine.debug_memory = true
221
+ end
222
+
218
223
  opts.on('-T', '--trim-mode=trim_mode', String,
219
224
  "ERB Trim mode to use (#{options[:erb][:trim_mode]} by default)") do |trim_mode|
220
225
  options[:erb][:trim_mode] = trim_mode
@@ -225,25 +230,36 @@ optparse = OptionParser.new do |opts|
225
230
  cur_sig_reload = compute_signal(sig, 'NONE')
226
231
  end
227
232
 
228
- opts.on('-M', '--debug-memory-usage', 'Display messages when RAM grows') do
229
- consul_engine.debug_memory = true
233
+ opts.on('-W', '--wait-signal=min_duration', Float, 'Wait at least n seconds before each reload signal being sent to next --exec process') do |min_duration|
234
+ raise "-wait-between-reload-signal=#{min_duration} must be greater than 0" unless min_duration.positive?
235
+
236
+ cur_min_duration_between_signals = min_duration
230
237
  end
231
238
 
232
- opts.on('-e', '--exec=<command>', String, 'Execute the following command') do |cmd|
239
+ opts.on('-e', '--exec=<command>', String, 'Execute the following command in as a subprocess when all templates are ready') do |cmd|
233
240
  sig_reload = cur_sig_reload
234
241
  sig_term = cur_sig_term
242
+ sig_min_interval = cur_min_duration_between_signals
235
243
  consul_engine.add_template_callback do |all_ready, template_manager, results|
236
244
  if all_ready
237
245
  modified = results.any?(&:modified)
238
246
  if @programs[cmd].nil?
239
- warn "[EXEC] Starting process: #{cmd}... on_reload=#{sig_reload || 'NONE'} on_term=#{sig_term}"
247
+ warn "[EXEC] Starting process: #{cmd}... on_reload=#{sig_reload || 'NONE'} on_term=#{sig_term}, delay between reloads=#{sig_min_interval}s"
240
248
  @programs[cmd] = Consul::Async::ProcessHandler.new(cmd, sig_reload: sig_reload, sig_term: sig_term)
241
249
  @programs[cmd].start
242
250
  else
251
+
243
252
  # At least one template has been modified
244
- @programs[cmd].reload if modified
253
+ process_to_reload = @programs[cmd]
254
+ if modified && !process_to_reload.reload_scheduled
255
+ process_to_reload.reload_scheduled = true
256
+ now = Time.now
257
+ delay = sig_min_interval - (now - @programs[cmd].last_signal_sent)
258
+ delay = 0 if delay.negative?
259
+ EventMachine.add_timer(delay) { process_to_reload.reload }
260
+ end
245
261
  begin
246
- @programs[cmd].process_status
262
+ process_to_reload.process_status
247
263
  rescue Consul::Async::ProcessDoesNotExist => e
248
264
  warn "[FATAL] The process is dead, aborting run: #{e.inspect}"
249
265
  template_manager.terminate
@@ -359,6 +375,11 @@ ARGV.each do |tpl|
359
375
  consul_engine.add_template(tpl, dest)
360
376
  end
361
377
 
378
+ if consul_engine.templates.count.zero?
379
+ puts 'You must specify at least one template as arg or using -t'
380
+ exit 255
381
+ end
382
+
362
383
  template_manager = Consul::Async::EndPointsManager.new(consul_conf, vault_conf, consul_engine.templates, options[:erb][:trim_mode])
363
384
 
364
385
  Signal.trap('USR1', 'IGNORE') unless Gem.win_platform?
@@ -59,7 +59,7 @@ module Consul
59
59
  return false unless new_template != @template
60
60
 
61
61
  # We render to ensure the template is valid
62
- render(new_template, current_template_info)
62
+ render(new_template, current_template_info: current_template_info)
63
63
  @template = new_template.freeze
64
64
  true
65
65
  end
@@ -7,7 +7,8 @@ module Consul
7
7
  # Handle the full lifecycle of a process and allows to forward
8
8
  # Posix signals to child process when needed.
9
9
  class ProcessHandler
10
- attr_reader :command, :sig_reload, :sig_term, :pid, :exit_status
10
+ attr_reader :command, :sig_reload, :sig_term, :pid, :exit_status, :last_signal_sent, :reload_scheduled
11
+ attr_writer :reload_scheduled
11
12
  def initialize(command, sig_reload: 'HUP', sig_term: 'TERM')
12
13
  raise 'empty sig_term is not supported' unless sig_term
13
14
 
@@ -16,18 +17,23 @@ module Consul
16
17
  @sig_term = sig_term
17
18
  @pid = nil
18
19
  @exit_status = nil
20
+ @last_signal_sent = Time.now
21
+ @reload_scheduled = false
19
22
  end
20
23
 
21
24
  def start
22
25
  return pid unless pid.nil?
23
26
 
24
27
  @pid = Process.spawn(command)
28
+ @last_signal_sent = Time.now
25
29
  end
26
30
 
27
31
  def reload
28
32
  return if sig_reload.nil?
29
33
 
34
+ @last_signal_sent = Time.now
30
35
  warn "Sending SIG #{sig_reload} to #{pid}..."
36
+ @reload_scheduled = false
31
37
  begin
32
38
  Process.kill(sig_reload, pid)
33
39
  rescue Errno::ESRCH => e
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.27.1'.freeze
3
+ VERSION = '1.29.0'.freeze
4
4
  end
5
5
  end
@@ -15,6 +15,10 @@
15
15
  content: '⚠ ';
16
16
  }
17
17
 
18
+ .btn-outline-success a:hover, .btn-outline-warning a:hover, .btn-outline-danger a:hover{
19
+ color: #fff;
20
+ }
21
+
18
22
  #service-wrapper, #instances-wrapper, #keys-wrapper {
19
23
  overflow-y: scroll;
20
24
  border-top-left-radius: 0px;