kumonos 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/DEVELOPMENT.md +8 -0
- data/README.md +5 -9
- data/example/envoy.json +5 -4
- data/exe/kumonos +13 -0
- data/lib/kumonos/envoy.rb +10 -4
- data/lib/kumonos/envoy_definition.rb +11 -2
- data/lib/kumonos/version.rb +1 -1
- data/lib/schemas/envoy.json +11 -7
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e7d2d1b04109039fbe3a9a4c36aa0edd9db1fe
|
4
|
+
data.tar.gz: bf27d37faee97d37fb4b970398b7fcbefc04645e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10ff432d483a1f4150a56de4c25d7d8db4c6933390dd4d7a6a22631a20050fd9a46eb7276c940c8e1c25f774721bfca24c49f317231bb7bf529b0dd44a552725
|
7
|
+
data.tar.gz: 374930e4888f593d3d0137b53b973839e7705071447eeb56fd80038ea816275d28953c0058558be7f6be8ca61e8b0f5e6a78fef97c040f2f682b3c14be6771a7
|
data/.gitignore
CHANGED
data/DEVELOPMENT.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Development
|
2
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests.
|
3
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
4
|
+
|
5
|
+
If you've installed [docker-compose](https://docs.docker.com/compose/), you can run the integration tests by `rake integration_test`. To run all the tests, `rake all`.
|
6
|
+
|
7
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
8
|
+
To release a new version, use `bump`, and then run `rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/).
|
data/README.md
CHANGED
@@ -2,19 +2,15 @@
|
|
2
2
|
[](https://travis-ci.org/taiki45/kumonos)
|
3
3
|
[](https://badge.fury.io/rb/kumonos)
|
4
4
|
|
5
|
-
|
5
|
+
A management tool for building Microservices "service mesh".
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
|
9
|
-
|
8
|
+
```
|
9
|
+
gem install kumonos
|
10
|
+
```
|
10
11
|
|
11
12
|
## Usage
|
12
|
-
TODO
|
13
|
-
|
14
|
-
## Development
|
15
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
16
|
-
|
17
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
13
|
+
TODO
|
18
14
|
|
19
15
|
## Contributing
|
20
16
|
Bug reports and pull requests are welcome on GitHub at https://github.com/taiki45/kumonos.
|
data/example/envoy.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"version": 1,
|
3
3
|
"ds": {
|
4
|
-
"name": "nginx",
|
5
4
|
"refresh_delay_ms": 30000,
|
6
5
|
"cluster": {
|
7
|
-
"name": "
|
6
|
+
"name": "ds",
|
8
7
|
"type": "strict_dns",
|
9
|
-
"
|
8
|
+
"tls": false,
|
9
|
+
"connect_timeout_ms": 1000,
|
10
10
|
"lb_type": "round_robin",
|
11
11
|
"hosts": [
|
12
12
|
{
|
@@ -17,8 +17,9 @@
|
|
17
17
|
},
|
18
18
|
"statsd": {
|
19
19
|
"name": "statsd",
|
20
|
-
"connect_timeout_ms":
|
20
|
+
"connect_timeout_ms": 1000,
|
21
21
|
"type": "strict_dns",
|
22
|
+
"tls": false,
|
22
23
|
"lb_type": "round_robin",
|
23
24
|
"hosts": [
|
24
25
|
{
|
data/exe/kumonos
CHANGED
@@ -21,6 +21,19 @@ class KumonosCli < Thor
|
|
21
21
|
puts JSON.dump(Kumonos::Envoy.generate(definition))
|
22
22
|
end
|
23
23
|
|
24
|
+
desc 'init_envoy', 'Generate envoy definition'
|
25
|
+
def init_envoy
|
26
|
+
path = 'envoy.json'
|
27
|
+
definition = JSON.parse(File.read(File.expand_path('../example/envoy.json', __dir__)))
|
28
|
+
definition.delete('statsd')
|
29
|
+
cluster = definition.fetch('ds').fetch('cluster')
|
30
|
+
cluster['hosts'] = [{ url: 'tcp://your-load-balancer-to-discovery-service:443' }]
|
31
|
+
cluster['tls'] = true
|
32
|
+
definition.fetch('ds')['cluster'] = cluster
|
33
|
+
File.write(path, JSON.pretty_generate(definition) + "\n")
|
34
|
+
puts path
|
35
|
+
end
|
36
|
+
|
24
37
|
desc 'clusters SERVIVE_DEFINITION', 'Generate clusters configuration'
|
25
38
|
method_option :output, aliases: '-o', desc: 'Output directory', required: true, type: :string
|
26
39
|
def clusters(filepath)
|
data/lib/kumonos/envoy.rb
CHANGED
@@ -5,7 +5,7 @@ module Kumonos
|
|
5
5
|
# @param [Kumonos::EnvoyDefinition] definition
|
6
6
|
# @return [Hash] envoy configuration hash
|
7
7
|
def generate(definition)
|
8
|
-
{
|
8
|
+
out = {
|
9
9
|
listeners: [
|
10
10
|
{
|
11
11
|
address: definition.listener.fetch(:address),
|
@@ -17,7 +17,7 @@ module Kumonos
|
|
17
17
|
stat_prefix: 'ingress_http',
|
18
18
|
access_log: [{ path: definition.listener.fetch(:access_log_path) }],
|
19
19
|
rds: {
|
20
|
-
cluster: definition.ds.fetch(:name),
|
20
|
+
cluster: definition.ds.fetch(:cluster).fetch(:name),
|
21
21
|
route_config_name: DEFAULT_ROUTE_NAME,
|
22
22
|
refresh_delay_ms: definition.ds.fetch(:refresh_delay_ms)
|
23
23
|
},
|
@@ -30,15 +30,21 @@ module Kumonos
|
|
30
30
|
access_log_path: definition.admin.fetch(:access_log_path),
|
31
31
|
address: definition.admin.fetch(:address)
|
32
32
|
},
|
33
|
-
statsd_tcp_cluster_name: definition.statsd.fetch(:name),
|
34
33
|
cluster_manager: {
|
35
|
-
clusters: [
|
34
|
+
clusters: [],
|
36
35
|
cds: {
|
37
36
|
cluster: definition.ds.fetch(:cluster),
|
38
37
|
refresh_delay_ms: definition.ds.fetch(:refresh_delay_ms)
|
39
38
|
}
|
40
39
|
}
|
41
40
|
}
|
41
|
+
|
42
|
+
unless definition.statsd.empty?
|
43
|
+
out[:statsd_tcp_cluster_name] = definition.statsd.fetch(:name)
|
44
|
+
out[:cluster_manager][:clusters] << definition.statsd
|
45
|
+
end
|
46
|
+
|
47
|
+
out
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -2,10 +2,13 @@ module Kumonos
|
|
2
2
|
EnvoyDefinition = Struct.new(:version, :ds, :statsd, :listener, :admin) do
|
3
3
|
class << self
|
4
4
|
def from_hash(h)
|
5
|
+
ds = symbolize_keys(h.fetch('ds'))
|
6
|
+
convert_tls_option!(ds.fetch(:cluster))
|
7
|
+
|
5
8
|
new(
|
6
9
|
h.fetch('version'),
|
7
|
-
|
8
|
-
symbolize_keys(h.fetch('statsd')),
|
10
|
+
ds,
|
11
|
+
convert_tls_option!(symbolize_keys(h.fetch('statsd', {}))),
|
9
12
|
symbolize_keys(h.fetch('listener')),
|
10
13
|
symbolize_keys(h.fetch('admin'))
|
11
14
|
)
|
@@ -13,6 +16,12 @@ module Kumonos
|
|
13
16
|
|
14
17
|
private
|
15
18
|
|
19
|
+
def convert_tls_option!(cluster)
|
20
|
+
tls = cluster.delete(:tls)
|
21
|
+
cluster[:ssl_context] = {} if tls
|
22
|
+
cluster
|
23
|
+
end
|
24
|
+
|
16
25
|
def symbolize_keys(hash)
|
17
26
|
new = hash.map do |k, v|
|
18
27
|
[
|
data/lib/kumonos/version.rb
CHANGED
data/lib/schemas/envoy.json
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
4
4
|
"type": "object",
|
5
5
|
"id": "kumonos-configuration",
|
6
|
-
"additionalProperties":
|
6
|
+
"additionalProperties": true,
|
7
7
|
"required": [
|
8
8
|
"version",
|
9
9
|
"ds",
|
10
|
-
"statsd",
|
11
10
|
"listener",
|
12
11
|
"admin"
|
13
12
|
],
|
@@ -21,15 +20,10 @@
|
|
21
20
|
"id": "/properties/ds",
|
22
21
|
"additionalProperties": false,
|
23
22
|
"required": [
|
24
|
-
"name",
|
25
23
|
"refresh_delay_ms",
|
26
24
|
"cluster"
|
27
25
|
],
|
28
26
|
"properties": {
|
29
|
-
"name": {
|
30
|
-
"type": "string",
|
31
|
-
"id": "/properties/ds/properties/name"
|
32
|
-
},
|
33
27
|
"refresh_delay_ms": {
|
34
28
|
"type": "integer",
|
35
29
|
"id": "/properties/ds/properties/refresh_delay_ms"
|
@@ -41,6 +35,7 @@
|
|
41
35
|
"required": [
|
42
36
|
"name",
|
43
37
|
"type",
|
38
|
+
"tls",
|
44
39
|
"connect_timeout_ms",
|
45
40
|
"lb_type",
|
46
41
|
"hosts"
|
@@ -54,6 +49,10 @@
|
|
54
49
|
"type": "string",
|
55
50
|
"id": "/properties/ds/properties/cluster/properties/type"
|
56
51
|
},
|
52
|
+
"tls": {
|
53
|
+
"type": "boolean",
|
54
|
+
"id": "/properties/ds/properties/cluster/properties/tls"
|
55
|
+
},
|
57
56
|
"connect_timeout_ms": {
|
58
57
|
"type": "integer",
|
59
58
|
"id": "/properties/ds/properties/cluster/properties/connect_timeout_ms"
|
@@ -92,6 +91,7 @@
|
|
92
91
|
"name",
|
93
92
|
"connect_timeout_ms",
|
94
93
|
"type",
|
94
|
+
"tls",
|
95
95
|
"lb_type",
|
96
96
|
"hosts"
|
97
97
|
],
|
@@ -108,6 +108,10 @@
|
|
108
108
|
"type": "string",
|
109
109
|
"id": "/properties/statsd/properties/type"
|
110
110
|
},
|
111
|
+
"tls": {
|
112
|
+
"type": "boolean",
|
113
|
+
"id": "/properties/statsd/properties/tls"
|
114
|
+
},
|
111
115
|
"lb_type": {
|
112
116
|
"type": "string",
|
113
117
|
"id": "/properties/statsd/properties/lb_type"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumonos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taiki Ono
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- ".rspec"
|
135
135
|
- ".rubocop.yml"
|
136
136
|
- ".travis.yml"
|
137
|
+
- DEVELOPMENT.md
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE.txt
|
139
140
|
- README.md
|