consul-templaterb 1.25.2 → 1.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -7
- data/.travis.yml +5 -5
- data/CHANGELOG.md +43 -0
- data/Dockerfile +1 -1
- data/INTERNALS.md +2 -0
- data/README.md +3 -1
- data/TemplateAPI.md +184 -164
- data/bin/consul-templaterb +30 -0
- data/docs/article-06_Template-based_discovery_with_consul-templaterb.md +124 -0
- data/docs/images/consul-templaterb.png +0 -0
- data/docs/images/consul-templaterb.svg +3 -0
- data/lib/consul/async/consul_endpoint.rb +28 -7
- data/lib/consul/async/consul_template.rb +56 -34
- data/lib/consul/async/json_endpoint.rb +15 -2
- data/lib/consul/async/vault_endpoint.rb +25 -6
- data/lib/consul/async/version.rb +1 -1
- data/samples/all_services.txt.erb +1 -1
- data/samples/all_services_multi_agents.txt.erb +69 -0
- data/samples/checks_in_warning_or_critical_state.yaml.erb +13 -0
- data/samples/consul-ui/README.md +19 -0
- data/samples/consul-ui/decorators.js.erb +2 -171
- data/samples/display_timestamped_changes.txt.erb +17 -0
- data/samples/find_all_invalid_dns_labels.json.erb +12 -0
- data/samples/find_nodes_in_catalog_but_not_in_members.json.erb +28 -0
- data/samples/metrics.erb +14 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea2191ec559b6c2ccc871a6cac0083fd894200bd268421eb25b12361a8fc4373
|
4
|
+
data.tar.gz: db35acece2ea661ef35cefad9c1a94dd452e533458cff6cfa97f3114d5cc502f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4a2b9e2ee7ba6d811b8d20202c2c0bc998afe5fcbd08c1325f573a38b422a5d94a21666efff14526d44071aa2faeb36e2157f72a097d36dad8309b30418aef
|
7
|
+
data.tar.gz: 28087756e716a4a6e2c8526b4920571118a3c6b2896ff2e302d52281fccfb277b5741b1a0c8b2be132ba7c405c6ea689767369b90c8db052562348739d3ba04d
|
data/.rubocop.yml
CHANGED
@@ -7,28 +7,28 @@ Layout/LineLength:
|
|
7
7
|
Max: 175
|
8
8
|
|
9
9
|
Metrics/AbcSize:
|
10
|
-
Max:
|
10
|
+
Max: 87
|
11
11
|
|
12
12
|
Metrics/BlockLength:
|
13
|
-
Max:
|
13
|
+
Max: 182
|
14
14
|
|
15
15
|
Metrics/BlockNesting:
|
16
16
|
Max: 4
|
17
17
|
|
18
18
|
Metrics/ClassLength:
|
19
|
-
Max:
|
19
|
+
Max: 285
|
20
20
|
|
21
21
|
Metrics/CyclomaticComplexity:
|
22
|
-
Max:
|
22
|
+
Max: 21
|
23
23
|
|
24
24
|
Metrics/MethodLength:
|
25
|
-
Max:
|
25
|
+
Max: 68
|
26
26
|
|
27
27
|
Metrics/ParameterLists:
|
28
|
-
Max:
|
28
|
+
Max: 18
|
29
29
|
|
30
30
|
Metrics/PerceivedComplexity:
|
31
|
-
Max:
|
31
|
+
Max: 24
|
32
32
|
|
33
33
|
# We use `dc` as a parameter in many methods
|
34
34
|
Naming/MethodParameterName:
|
data/.travis.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.4.
|
4
|
-
- 2.5.
|
5
|
-
- 2.6.
|
6
|
-
- 2.7.
|
3
|
+
- 2.4.10
|
4
|
+
- 2.5.8
|
5
|
+
- 2.6.6
|
6
|
+
- 2.7.1
|
7
7
|
jobs:
|
8
8
|
include:
|
9
9
|
- stage: Gem release
|
10
|
-
rvm: 2.5.
|
10
|
+
rvm: 2.5.8
|
11
11
|
script: echo "Publishing consul-templaterb on rubygems.org ..."
|
12
12
|
deploy:
|
13
13
|
provider: rubygems
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,49 @@
|
|
2
2
|
|
3
3
|
## (UNRELEASED)
|
4
4
|
|
5
|
+
## 1.27.0 (June 5, 2020)
|
6
|
+
|
7
|
+
NEW FEATURES:
|
8
|
+
|
9
|
+
* For Consul 1.7+, now support `checks_in_state(check_state, dc: nil, [agent: consul_agent_address])`,
|
10
|
+
fixes feature [#65](https://github.com/criteo/consul-templaterb/issues/65)
|
11
|
+
* New options to support/disable TLS validation thanks to [@jeromegn](https://github.com/jeromegn)
|
12
|
+
[#66](https://github.com/criteo/consul-templaterb/pull/66)
|
13
|
+
|
14
|
+
## 1.26.3 (April 15, 2020)
|
15
|
+
|
16
|
+
BUGFIX:
|
17
|
+
|
18
|
+
* Removed all Criteo specific decorators from Consul-UI
|
19
|
+
|
20
|
+
## 1.26.2 (April 15, 2020)
|
21
|
+
|
22
|
+
BUGFIX:
|
23
|
+
|
24
|
+
* Fixed broken Dockerfile (was missing the new `decorator.js.erb` file). Fixes #61 (Thanks to @ simongareste)
|
25
|
+
|
26
|
+
NEW FEATURES:
|
27
|
+
|
28
|
+
* Added `consul_members_count` metric in [samples/metrics.erb](samples/metrics.erb)
|
29
|
+
|
30
|
+
## 1.26.1 (March 27, 2020)
|
31
|
+
|
32
|
+
BUGFIX:
|
33
|
+
|
34
|
+
* Using `agent: http://vault_or_consul_agent:port>` was not properly taken into account in some endpoints
|
35
|
+
|
36
|
+
## 1.26.0 (March 5, 2020)
|
37
|
+
|
38
|
+
NEW FEATURES:
|
39
|
+
|
40
|
+
* Using `agent: http://vault_or_consul_agent:port>` on most methods will now override the agent
|
41
|
+
used to perform Consul queries. It might be useful for very large clusters or large WAN federations,
|
42
|
+
because you can perform some requests on some agents, and some others on other agenrs. Might
|
43
|
+
also be useful to federate data from preprod/prod for instance.
|
44
|
+
* Added agent attribute for all methods in documentation
|
45
|
+
* Added [samples/all_services_multi_agents.txt.erb](samples/all_services_multi_agents.txt.erb) as an
|
46
|
+
example of new feature.
|
47
|
+
|
5
48
|
## 1.25.2 (February 29, 2020)
|
6
49
|
|
7
50
|
BUGFIX:
|
data/Dockerfile
CHANGED
@@ -12,4 +12,4 @@ ENV LANG C.UTF-8
|
|
12
12
|
ENV CONSUL_HTTP_ADDR http://consul-relay.service.consul.preprod.crto.in:8500
|
13
13
|
|
14
14
|
ENTRYPOINT ["/usr/local/bin/bundle", "exec", "consul-templaterb"]
|
15
|
-
CMD ["--template", "samples/consul-ui/consul-keys-ui.html.erb", "--template", "samples/consul-ui/consul-nodes-ui.html.erb", "--template", "samples/consul-ui/consul-services-ui.html.erb", "--template", "samples/consul-ui/consul-timeline-ui.html.erb", "--template", "samples/consul-ui/consul_keys.json.erb", "--template", "samples/consul-ui/consul_nodes.json.erb", "--template", "samples/consul-ui/consul_services.json.erb", "--template", "samples/consul-ui/timeline.json.erb", "--template", "samples/consul-ui/consul-services-ui.html.erb:samples/consul-ui/index.html:touch samples/consul-ui/ready", "--sig-reload=NONE", "--exec=nginx -c /usr/src/app/docker-nginx-conf/nginx.conf"]
|
15
|
+
CMD ["--template", "samples/consul-ui/consul-keys-ui.html.erb", "--template", "samples/consul-ui/decorators.js.erb", "--template", "samples/consul-ui/consul-nodes-ui.html.erb", "--template", "samples/consul-ui/consul-services-ui.html.erb", "--template", "samples/consul-ui/consul-timeline-ui.html.erb", "--template", "samples/consul-ui/consul_keys.json.erb", "--template", "samples/consul-ui/consul_nodes.json.erb", "--template", "samples/consul-ui/consul_services.json.erb", "--template", "samples/consul-ui/timeline.json.erb", "--template", "samples/consul-ui/consul-services-ui.html.erb:samples/consul-ui/index.html:touch samples/consul-ui/ready", "--sig-reload=NONE", "--exec=nginx -c /usr/src/app/docker-nginx-conf/nginx.conf"]
|
data/INTERNALS.md
CHANGED
@@ -12,6 +12,8 @@ the list of services registered in the cluster).
|
|
12
12
|
|
13
13
|
For each endpoint, `consul-templaterb` performs a watch by getting information about the last transaction on this endpoints, storing it locally and watching at Consul to get updates about the data within this endpoint.
|
14
14
|
|
15
|
+
![Main Loop](docs/images/consul-templaterb.svg)
|
16
|
+
|
15
17
|
## How it works
|
16
18
|
|
17
19
|
There is a loop in the engine, every second, all templates are rendered using the `ERB` template engine.
|
data/README.md
CHANGED
@@ -33,6 +33,8 @@ with fully [working examples](samples/).
|
|
33
33
|
It also allows displaying a very nice and hi-performance HTML5 UI for Consul,
|
34
34
|
see [consul-ui](samples/consul-ui) for details.
|
35
35
|
|
36
|
+
There is an article [docs/article-06_Template-based_discovery_with_consul-templaterb.md](docs/article-06_Template-based_discovery_with_consul-templaterb.md) summarizing why we developped this tool (also available on [medium](https://medium.com/criteo-labs/template-based-discovery-with-consul-templaterb-8ff88434c457)).
|
37
|
+
|
36
38
|
## Video introduction to consul-templaterb
|
37
39
|
|
38
40
|
[![Introduction to Consul-templaterb](docs/images/consul-ui_001.png)](https://youtu.be/zLzrLGLLl4Q)
|
@@ -330,7 +332,7 @@ Please consult [CHANGELOG.md](CHANGELOG.md) for fixed bugs.
|
|
330
332
|
|
331
333
|
## TODO
|
332
334
|
|
333
|
-
* [x] Hashi's Vault support
|
335
|
+
* [x] Hashi's Vault support
|
334
336
|
* [ ] Implement automatic dynamic rate limit
|
335
337
|
* [x] More samples: apache, nginx, a full website displaying consul information...
|
336
338
|
* [x] Optimize rendering speed at start-up: an iteration is done every second by default, but it would be possible to speed
|
data/TemplateAPI.md
CHANGED
@@ -7,6 +7,10 @@ annoted with `[]`.
|
|
7
7
|
Most of them support the optional dc attribute to use data from another datacenter. If the `dc`
|
8
8
|
attribute is not specified, the function will output data from the current datacenter.
|
9
9
|
|
10
|
+
Starting with version 1.26.0, most methods also support the
|
11
|
+
`agent: "http://address_of_vault_or_consul_agent:port"` to use another agent than the one specified in command line. It opens the way to use different agents/DC or to create templates federating several different not-linked clusters (ex: prod/preprod).
|
12
|
+
Example on how using it: [samples/all_services_multi_agents.txt.erb](samples/all_services_multi_agents.txt.erb).
|
13
|
+
|
10
14
|
To ease template development, `consul-templaterb` supports HOT reload of templates, thus it is possible to
|
11
15
|
develop the templates interactively. While developing, it is possible to use the switch `--hot-reload=keep`,
|
12
16
|
thus the application will display a warning if the template is invalid and won't stop
|
@@ -44,154 +48,162 @@ to avoid having to write .result in all templates, some shortcuts have been adde
|
|
44
48
|
|
45
49
|
Also available for all results:
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
51
|
+
<details id="common-methods-available-for-all-objects">
|
52
|
+
<summary>Common methods available for all objects</summary>
|
53
|
+
<div class="samples">
|
54
|
+
<ul>
|
55
|
+
<li>.all?</li>
|
56
|
+
<li>.any?</li>
|
57
|
+
<li>.assoc</li>
|
58
|
+
<li>.chunk</li>
|
59
|
+
<li>.chunk_while</li>
|
60
|
+
<li>.class</li>
|
61
|
+
<li>.clear</li>
|
62
|
+
<li>.collect</li>
|
63
|
+
<li>.collect_concat</li>
|
64
|
+
<li>.compact</li>
|
65
|
+
<li>.count</li>
|
66
|
+
<li>.cycle</li>
|
67
|
+
<li>.detect</li>
|
68
|
+
<li>.dig</li>
|
69
|
+
<li>.display</li>
|
70
|
+
<li>.drop</li>
|
71
|
+
<li>.drop_while</li>
|
72
|
+
<li>.dup</li>
|
73
|
+
<li>.each</li>
|
74
|
+
<li>.each_cons</li>
|
75
|
+
<li>.each_entry</li>
|
76
|
+
<li>.each_slice</li>
|
77
|
+
<li>.each_with_index</li>
|
78
|
+
<li>.each_with_object</li>
|
79
|
+
<li>.empty?</li>
|
80
|
+
<li>.entries</li>
|
81
|
+
<li>.enum_for</li>
|
82
|
+
<li>.eql?</li>
|
83
|
+
<li>.equal?</li>
|
84
|
+
<li>.extend</li>
|
85
|
+
<li>.fetch</li>
|
86
|
+
<li>.find</li>
|
87
|
+
<li>.find_all</li>
|
88
|
+
<li>.find_index</li>
|
89
|
+
<li>.first</li>
|
90
|
+
<li>.flat_map</li>
|
91
|
+
<li>.flatten</li>
|
92
|
+
<li>.grep</li>
|
93
|
+
<li>.grep_v</li>
|
94
|
+
<li>.group_by</li>
|
95
|
+
<li>.hash</li>
|
96
|
+
<li>.include?</li>
|
97
|
+
<li>.index</li>
|
98
|
+
<li>.inject</li>
|
99
|
+
<li>.inspect</li>
|
100
|
+
<li>.is_a?</li>
|
101
|
+
<li>.itself</li>
|
102
|
+
<li>.keep_if</li>
|
103
|
+
<li>.kind_of?</li>
|
104
|
+
<li>.lazy</li>
|
105
|
+
<li>.length</li>
|
106
|
+
<li>.map</li>
|
107
|
+
<li>.max</li>
|
108
|
+
<li>.max_by</li>
|
109
|
+
<li>.member?</li>
|
110
|
+
<li>.min</li>
|
111
|
+
<li>.min_by</li>
|
112
|
+
<li>.minmax</li>
|
113
|
+
<li>.minmax_by</li>
|
114
|
+
<li>.nil?</li>
|
115
|
+
<li>.none?</li>
|
116
|
+
<li>.object_id</li>
|
117
|
+
<li>.one?</li>
|
118
|
+
<li>.partition</li>
|
119
|
+
<li>.pp</li>
|
120
|
+
<li>.rassoc</li>
|
121
|
+
<li>.reduce</li>
|
122
|
+
<li>.reject</li>
|
123
|
+
<li>.replace</li>
|
124
|
+
<li>.reverse_each</li>
|
125
|
+
<li>.select</li>
|
126
|
+
<li>.shift</li>
|
127
|
+
<li>.size</li>
|
128
|
+
<li>.slice</li>
|
129
|
+
<li>.slice_after</li>
|
130
|
+
<li>.slice_before</li>
|
131
|
+
<li>.slice_when</li>
|
132
|
+
<li>.sort</li>
|
133
|
+
<li>.sort_by</li>
|
134
|
+
<li>.sum</li>
|
135
|
+
<li>.take</li>
|
136
|
+
<li>.take_while</li>
|
137
|
+
<li>.tap</li>
|
138
|
+
<li>.to_a</li>
|
139
|
+
<li>.to_enum</li>
|
140
|
+
<li>.to_h</li>
|
141
|
+
<li>.to_s</li>
|
142
|
+
<li>.uniq</li>
|
143
|
+
<li>.values_at</li>
|
144
|
+
<li>.yield_self</li>
|
145
|
+
<li>.zip</li>
|
146
|
+
</ul></div></details>
|
147
|
+
|
148
|
+
<details>
|
149
|
+
<summary id="methods-available-for-array-objects">Methods available for Array objects</summary>
|
150
|
+
<div class="samples">
|
151
|
+
<ul>
|
152
|
+
<li>.append</li>
|
153
|
+
<li>.at</li>
|
154
|
+
<li>.bsearch</li>
|
155
|
+
<li>.bsearch_index</li>
|
156
|
+
<li>.combination</li>
|
157
|
+
<li>.concat</li>
|
158
|
+
<li>.each_index</li>
|
159
|
+
<li>.fill</li>
|
160
|
+
<li>.insert</li>
|
161
|
+
<li>.join</li>
|
162
|
+
<li>.last</li>
|
163
|
+
<li>.pack</li>
|
164
|
+
<li>.permutation</li>
|
165
|
+
<li>.pop</li>
|
166
|
+
<li>.prepend</li>
|
167
|
+
<li>.product</li>
|
168
|
+
<li>.push</li>
|
169
|
+
<li>.repeated_combination</li>
|
170
|
+
<li>.repeated_permutation</li>
|
171
|
+
<li>.reverse</li>
|
172
|
+
<li>.rindex</li>
|
173
|
+
<li>.rotate</li>
|
174
|
+
<li>.sample</li>
|
175
|
+
<li>.shuffle</li>
|
176
|
+
<li>.to_ary</li>
|
177
|
+
<li>.transpose</li>
|
178
|
+
<li>.unshift</li>
|
179
|
+
</ul></div></details>
|
180
|
+
|
181
|
+
<details id="Methods-available-for-hash-objects">
|
182
|
+
<summary>Methods available for hash objects</summary>
|
183
|
+
<ul>
|
184
|
+
<li>.compare_by_identity</li>
|
185
|
+
<li>.compare_by_identity?</li>
|
186
|
+
<li>.each_key</li>
|
187
|
+
<li>.each_pair</li>
|
188
|
+
<li>.each_value</li>
|
189
|
+
<li>.fetch_values</li>
|
190
|
+
<li>.has_key?</li>
|
191
|
+
<li>.has_value?</li>
|
192
|
+
<li>.invert</li>
|
193
|
+
<li>.key</li>
|
194
|
+
<li>.key?</li>
|
195
|
+
<li>.keys</li>
|
196
|
+
<li>.merge</li>
|
197
|
+
<li>.rehash</li>
|
198
|
+
<li>.store</li>
|
199
|
+
<li>.to_hash</li>
|
200
|
+
<li>.to_proc</li>
|
201
|
+
<li>.transform_keys</li>
|
202
|
+
<li>.transform_values</li>
|
203
|
+
<li>.update</li>
|
204
|
+
<li>.value?</li>
|
205
|
+
<li>.values</li>
|
206
|
+
</ul></div></details>
|
195
207
|
|
196
208
|
## coordinate
|
197
209
|
|
@@ -203,7 +215,7 @@ The coordinate object allow to interact with the coordinates of DCs and nodes as
|
|
203
215
|
[List the Wan Coordinates](https://www.consul.io/api/coordinate.html#read-wan-coordinates) from local DC to
|
204
216
|
other DCs. If dc is set, it will perform the same operation but from another DC.
|
205
217
|
|
206
|
-
### coordinate.nodes([dc: datacenter])
|
218
|
+
### coordinate.nodes([dc: datacenter], [agent: consul_agent_address])
|
207
219
|
|
208
220
|
[Read all LAN nodes coordinates](https://www.consul.io/api/coordinate.html#read-lan-coordinates-for-all-nodes).
|
209
221
|
If If dc is set, it will perform the same operation but for another DC.
|
@@ -213,7 +225,7 @@ If If dc is set, it will perform the same operation but for another DC.
|
|
213
225
|
Computes the rtt between 2 nodes returned by `coordinate.nodes` or `coordinate.datacenters`. A re-implementation of Golang sample code
|
214
226
|
[Working with Coordinates](https://www.consul.io/docs/internals/coordinates.html#working-with-coordinates).
|
215
227
|
|
216
|
-
## datacenters()
|
228
|
+
## datacenters([agent: consul_agent_address])
|
217
229
|
|
218
230
|
[Get the list of datacenters as string array](https://www.consul.io/api/catalog.html#list-datacenters).
|
219
231
|
|
@@ -233,7 +245,7 @@ Full example: [samples/consul_template.txt.erb](samples/consul_template.txt.erb)
|
|
233
245
|
</div>
|
234
246
|
</details>
|
235
247
|
|
236
|
-
## services([dc: datacenter], [tag: tagToFilterWith])
|
248
|
+
## services([dc: datacenter], [tag: tagToFilterWith], [agent: consul_agent_address])
|
237
249
|
|
238
250
|
[List the services matching the optional tag filter](https://www.consul.io/api/catalog.html#list-services),
|
239
251
|
if tag is not specified, will match all the services. Note that this endpoint performs client side tag
|
@@ -270,7 +282,7 @@ Full example: [samples/consul_template.txt.erb](samples/consul_template.txt.erb)
|
|
270
282
|
</div>
|
271
283
|
</details>
|
272
284
|
|
273
|
-
## service(serviceName, [dc: datacenter], [tag: tagToFilterWith], [passing: true])
|
285
|
+
## service(serviceName, [dc: datacenter], [tag: tagToFilterWith], [passing: true], [agent: consul_agent_address])
|
274
286
|
|
275
287
|
[List the instances](https://www.consul.io/api/health.html#list-nodes-for-service) of a service having the given
|
276
288
|
optional tag. If no tag is specified, will return all instances of service. By default, it will return all the
|
@@ -342,7 +354,7 @@ Full example: [samples/consul_template.txt.erb](samples/consul_template.txt.erb)
|
|
342
354
|
</div>
|
343
355
|
</details>
|
344
356
|
|
345
|
-
## nodes([dc: datacenter])
|
357
|
+
## nodes([dc: datacenter], [agent: consul_agent_address])
|
346
358
|
|
347
359
|
[List all the nodes of selected datacenter](https://www.consul.io/api/catalog.html#list-nodes). No filtering is
|
348
360
|
applied.
|
@@ -363,20 +375,29 @@ Full example: [samples/consul_template.txt.erb](samples/consul_template.txt.erb)
|
|
363
375
|
</div>
|
364
376
|
</details>
|
365
377
|
|
366
|
-
## node(nodeNameOrId, [dc: datacenter])
|
378
|
+
## node(nodeNameOrId, [dc: datacenter], [agent: consul_agent_address])
|
367
379
|
|
368
380
|
[List all the services of a given Node](https://www.consul.io/api/catalog.html#list-services-for-node) using its
|
369
381
|
name or its ID. If DC is specified, will lookup for given node in another datacenter.
|
370
382
|
|
371
|
-
## checks_for_node(name, dc: nil, passing: false, tag: nil)
|
383
|
+
## checks_for_node(name, dc: nil, passing: false, tag: nil, [agent: consul_agent_address])
|
372
384
|
|
373
385
|
[Find all the checks](https://www.consul.io/api/health.html#list-checks-for-node) of a given node name.
|
374
386
|
|
375
|
-
## checks_for_service(name, dc: nil, passing: false, tag: nil)
|
387
|
+
## checks_for_service(name, dc: nil, passing: false, tag: nil, [agent: consul_agent_address])
|
376
388
|
|
377
389
|
[Find all the checks](https://www.consul.io/api/health.html#list-checks-for-service) of a given service.
|
378
390
|
|
379
|
-
##
|
391
|
+
## def checks_in_state(check_state, dc: nil, [agent: consul_agent_address])
|
392
|
+
|
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
|
+
|
395
|
+
The filter check_state must be one of any|critical|warning|passing.
|
396
|
+
|
397
|
+
Warning: this endpoint might be very frequently updated in a
|
398
|
+
large cluster if you are using `any` value. This endpoint is supported with Consul 1.7+.
|
399
|
+
|
400
|
+
## kv(name, [dc: nil], [keys: false], [recurse: false], [agent: consul_agent_address])
|
380
401
|
|
381
402
|
[Read keys from KV Store](https://www.consul.io/api/kv.html#read-key). It can be used for both listing the keys and
|
382
403
|
getting the values. See the file in samples [keys.html.erb](samples/keys.html.erb) for a working example.
|
@@ -451,7 +472,7 @@ value123 : <%= result.get_decoded('/my/multiple/values/value123') %>
|
|
451
472
|
Since `kv('/my/multiple/values', recurse: true)` will retrieve all values at once, it might be more
|
452
473
|
efficient in some cases than retrieving all values one by one.
|
453
474
|
|
454
|
-
## agent_members(wan: false)
|
475
|
+
## agent_members(wan: false, [agent: consul_agent_address])
|
455
476
|
|
456
477
|
[Get the Serf information](https://www.consul.io/api/agent.html#list-members) from Consul Agent point of view.
|
457
478
|
This is a list of Serf information containing serf information. This information is not consistent and should be used with care, most of the time, you should prefer `nodes()`.
|
@@ -470,13 +491,13 @@ The returned value is an array containing the following objects containing the f
|
|
470
491
|
|
471
492
|
See [samples/members.json.erb](samples/members.json.erb) for example of usage.
|
472
493
|
|
473
|
-
## agent_metrics()
|
494
|
+
## agent_metrics([agent: consul_agent_address])
|
474
495
|
|
475
496
|
[Get the metrics of Consul Agent](https://www.consul.io/api/agent.html#view-metrics). Since this endpoint does
|
476
497
|
not support blocking queries, data will be refreshed every few seconds, but will not use blocking queries
|
477
498
|
mechanism.
|
478
499
|
|
479
|
-
## agent_self()
|
500
|
+
## agent_self([agent: consul_agent_address])
|
480
501
|
|
481
502
|
[Get the configuration of Consul Agent](https://www.consul.io/api/agent.html#read-configuration).
|
482
503
|
Since this endpoint does not support blocking queries, data will be refreshed every few seconds,
|
@@ -542,7 +563,7 @@ consul-templaterb --template "source.html.erb:dest.html:reload_command:params.ya
|
|
542
563
|
|
543
564
|
See [samples/consul-ui/consul-services-ui.html.erb](samples/consul-ui/consul-services-ui.html.erb) for example of usage.
|
544
565
|
|
545
|
-
## secrets(prefix)
|
566
|
+
## secrets(prefix, [agent: vault_agent_address])
|
546
567
|
|
547
568
|
It requires that a Vault token is given either in parameter or in environment variable
|
548
569
|
The [policies](https://www.vaultproject.io/docs/concepts/policies.html) should be properly set.
|
@@ -568,7 +589,7 @@ Full example: [samples/vault-ldap.txt.erb](samples/vault-ldap.txt.erb)
|
|
568
589
|
</div>
|
569
590
|
</details>
|
570
591
|
|
571
|
-
## secret(path, [data = nil])
|
592
|
+
## secret(path, [data = nil], [agent: vault_agent_address])
|
572
593
|
|
573
594
|
It requires that a Vault token is given either in parameter or in environment variable
|
574
595
|
The [policies](https://www.vaultproject.io/docs/concepts/policies.html) should be properly set.
|
@@ -689,5 +710,4 @@ Here are templates rendered by consul-templaterb:
|
|
689
710
|
```
|
690
711
|
|
691
712
|
</div>
|
692
|
-
</details>
|
693
|
-
|
713
|
+
</details>
|