comap 1.1.0 → 1.2.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: e885917505c497f4477f19720189c8adff81b9b3b8870eb0f6cc225cb47d018d
4
- data.tar.gz: f67e4ce666a834a5fa71626efcbabef15a8cf67ed3ee6ca92fe60cbaabc34048
3
+ metadata.gz: 9bf1f10109fdb94f28dbcac76a165fddd04552fc7724b116e394b5214b053135
4
+ data.tar.gz: 6e210fdc81a6b989b5fc180fad62aba23f02913a3ce7c40d27fc8d38c313af37
5
5
  SHA512:
6
- metadata.gz: 38334bf34297c0441894776f7866ad071ad0397e6913f5919f109ef9552a9e028f5c7992a830a2ed13042570de9a658f2c576ebdcfb378a461c9e41715f4c8c2
7
- data.tar.gz: 4e46f655d3c12a12e66cbf5c503b1681738b7421b93a4850db9ea7505d29198be8df6af3efddb919570700ba4d894869c62b76c15b79276400f50a3daba1ba6a
6
+ metadata.gz: 842424574a377413c57a669e636d1d192bd8c88faf388e3873aa9ace4d3c58d62578f30bf7c75ff541fbf56a5f398fb648e23918c744931292fb9152797995ed
7
+ data.tar.gz: 473a19509462c6e7188f5fce623ba389b5da56061813e417048132473e5d336c963f824b34c63604064e2aa28e0cdb81fe85fa0857c0b9f15f2003860cc8991c
@@ -1,2 +1,97 @@
1
- include:
2
- - https://gitlab.com/chef-platform/test-cookbook/raw/master/.gitlab-ci.yml
1
+ stages:
2
+ - checks
3
+
4
+ image: sbernard/arch-kitchen-docker
5
+
6
+ variables:
7
+ CHECKS_REPO: https://gitlab.com/samuel.bernard/checks/raw/master
8
+
9
+ .checks_template:
10
+ stage: checks
11
+ except:
12
+ - tags
13
+ before_script:
14
+ - bundle install
15
+
16
+ foodcritic:
17
+ extends: .checks_template
18
+ script:
19
+ - bundle exec foodcritic -f any .
20
+
21
+ rubocop:
22
+ extends: .checks_template
23
+ script:
24
+ - bundle exec rubocop
25
+
26
+ lines_length:
27
+ extends: .checks_template
28
+ script:
29
+ - curl -s $CHECKS_REPO/check_lines_length.sh | bash
30
+
31
+ git_history:
32
+ extends: .checks_template
33
+ script:
34
+ - curl -s $CHECKS_REPO/check_git_history.sh | bash
35
+
36
+ rspec:
37
+ extends: .checks_template
38
+ script:
39
+ - bundle exec rspec
40
+
41
+ kitchen:
42
+ extends: .checks_template
43
+ retry: 2
44
+ tags:
45
+ - docker
46
+ - gce
47
+ before_script:
48
+ - >
49
+ curl -s $CHECKS_REPO/Gemfile_patches | while read line; do
50
+ if ! cat Gemfile | grep "$line"; then
51
+ echo "$line" >> Gemfile
52
+ fi
53
+ done
54
+ - bundle install
55
+ # Mount host kernel modules which may be needed by docker
56
+ - mkdir -p /mnt/host
57
+ - mount /dev/dm-0 /mnt/host
58
+ - ln -s /mnt/host/lib/modules /lib/modules
59
+ # Get some info on the system
60
+ - free -h
61
+ - df -h
62
+ # Put docker on tmpfs with overlay2
63
+ - >
64
+ if [ ! -e /var/run/docker.sock ]; then
65
+ if [ ! -d /var/lib/docker ]; then
66
+ mkdir -p $(dirname $CI_PROJECT_DIR)/varlibdocker;
67
+ ln -s $(dirname $CI_PROJECT_DIR)/varlibdocker /var/lib/docker
68
+ fi;
69
+ DOCKER_DRIVER=overlay2 dockerd &
70
+ fi
71
+ # Needed to solve some network problems in docker-in-docker mode
72
+ - if ! docker network ls | grep -q "kitchen"; then
73
+ docker network create
74
+ --driver bridge -o "com.docker.network.driver.mtu=1400" kitchen;
75
+ fi
76
+ - df -h /var/lib/docker
77
+ # On shared runner running coreos, we need to add privileged in driver
78
+ # for centos and debian images. This may change in the future
79
+ - 'if uname -r | grep "coreos" > /dev/null; then
80
+ sed -i "/^driver:/a\\ \\ privileged: true" .kitchen.yml; fi'
81
+ script:
82
+ - >
83
+ set +e;
84
+ imgs="$(bundle exec kitchen diagnose | grep '^ image:' | \
85
+ cut -d':' -f2 | uniq)";
86
+ for image in $imgs; do docker pull $image; done;
87
+ set -e
88
+ - free -h
89
+ - >
90
+ set +e;
91
+ if bundle exec kitchen diagnose | grep 'vagrant' > /dev/null; then
92
+ echo 'Vagrant driver, nothing to do'; exit 0
93
+ else set -e; bundle exec kitchen test $FLAG -c $CONC -d always;
94
+ fi;
95
+ # Some system info after the run
96
+ - free -h
97
+ - df -h
@@ -1,6 +1,25 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.2.0
5
+ -----
6
+
7
+ Main:
8
+
9
+ - feat: add service label to metrics
10
+
11
+ Tests:
12
+
13
+ - test: do not get ci conf from test cookbook
14
+ - test: use an extra dns resolver for swarm insiders
15
+ - test: add ssl script helper to gen docker pki
16
+ - test: update ssl cert with kitchen tld
17
+
18
+ Misc:
19
+
20
+ - style: fix rubocop offenses (add line after guard)
21
+ - chore: use latest dependencies (mostly for test)
22
+
4
23
  1.1.0
5
24
  -----
6
25
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comap (1.1.0)
4
+ comap (1.2.0.pre.a)
5
5
  faraday (~> 0.13)
6
6
  json (~> 2.0)
7
7
  thin (~> 1.7)
@@ -12,8 +12,8 @@ GEM
12
12
  addressable (2.5.2)
13
13
  public_suffix (>= 2.0.2, < 4.0)
14
14
  ast (2.4.0)
15
- backports (3.11.3)
16
- berkshelf (7.0.4)
15
+ backports (3.11.4)
16
+ berkshelf (7.0.6)
17
17
  chef (>= 13.6.52)
18
18
  chef-config
19
19
  cleanroom (~> 1.0)
@@ -27,10 +27,10 @@ GEM
27
27
  solve (~> 4.0)
28
28
  thor (>= 0.20)
29
29
  builder (3.2.3)
30
- chef (14.2.0)
30
+ chef (14.3.37)
31
31
  addressable
32
32
  bundler (>= 1.10)
33
- chef-config (= 14.2.0)
33
+ chef-config (= 14.3.37)
34
34
  chef-zero (>= 13.0)
35
35
  diff-lcs (~> 1.2, >= 1.2.4)
36
36
  erubis (~> 2.7)
@@ -58,10 +58,10 @@ GEM
58
58
  specinfra (~> 2.10)
59
59
  syslog-logger (~> 1.6)
60
60
  uuidtools (~> 2.1.5)
61
- chef-config (14.2.0)
61
+ chef-config (14.3.37)
62
62
  addressable
63
63
  fuzzyurl
64
- mixlib-config (~> 2.0)
64
+ mixlib-config (>= 2.2.12, < 3.0)
65
65
  mixlib-shellout (~> 2.0)
66
66
  tomlrb (~> 1.2)
67
67
  chef-zero (14.0.6)
@@ -74,22 +74,22 @@ GEM
74
74
  concurrent-ruby (1.0.5)
75
75
  crack (0.4.3)
76
76
  safe_yaml (~> 1.0.0)
77
- cucumber-core (3.1.0)
77
+ cucumber-core (3.2.1)
78
78
  backports (>= 3.8.0)
79
79
  cucumber-tag_expressions (~> 1.1.0)
80
- gherkin (>= 5.0.0)
80
+ gherkin (~> 5.0)
81
81
  cucumber-tag_expressions (1.1.1)
82
82
  daemons (1.2.6)
83
83
  diff-lcs (1.3)
84
84
  erubis (2.7.0)
85
85
  eventmachine (1.2.7)
86
- faraday (0.15.2)
86
+ faraday (0.15.3)
87
87
  multipart-post (>= 1.2, < 3)
88
88
  ffi (1.9.25)
89
89
  ffi-yajl (2.3.1)
90
90
  libyajl2 (~> 1.2)
91
- foodcritic (14.0.0)
92
- cucumber-core (>= 1.3)
91
+ foodcritic (14.2.0)
92
+ cucumber-core (>= 1.3, < 4.0)
93
93
  erubis
94
94
  ffi-yajl (~> 2.0)
95
95
  nokogiri (>= 1.5, < 2.0)
@@ -103,7 +103,7 @@ GEM
103
103
  gyoku (1.3.1)
104
104
  builder (>= 2.1.2)
105
105
  hashdiff (0.3.7)
106
- hashie (3.5.7)
106
+ hashie (3.6.0)
107
107
  highline (1.7.10)
108
108
  httpclient (2.8.3)
109
109
  iniparse (1.4.4)
@@ -120,20 +120,20 @@ GEM
120
120
  multi_json (~> 1.10)
121
121
  mini_portile2 (2.3.0)
122
122
  minitar (0.6.1)
123
- mixlib-archive (0.4.8)
123
+ mixlib-archive (0.4.18)
124
124
  mixlib-log
125
125
  mixlib-authentication (2.1.1)
126
126
  mixlib-cli (1.7.0)
127
- mixlib-config (2.2.8)
127
+ mixlib-config (2.2.13)
128
128
  tomlrb
129
- mixlib-install (3.10.0)
129
+ mixlib-install (3.11.5)
130
130
  mixlib-shellout
131
131
  mixlib-versioning
132
132
  thor
133
133
  mixlib-log (2.0.4)
134
- mixlib-shellout (2.3.2)
134
+ mixlib-shellout (2.4.0)
135
135
  mixlib-versioning (1.2.2)
136
- molinillo (0.6.5)
136
+ molinillo (0.6.6)
137
137
  multi_json (1.13.1)
138
138
  multipart-post (2.0.0)
139
139
  net-scp (1.2.1)
@@ -147,17 +147,17 @@ GEM
147
147
  net-ssh (>= 2.6.5)
148
148
  net-ssh-gateway (>= 1.2.0)
149
149
  net-telnet (0.1.1)
150
- nokogiri (1.8.3)
150
+ nokogiri (1.8.5)
151
151
  mini_portile2 (~> 2.3.0)
152
152
  nori (2.6.0)
153
- octokit (4.9.0)
153
+ octokit (4.13.0)
154
154
  sawyer (~> 0.8.0, >= 0.5.3)
155
- ohai (14.2.0)
155
+ ohai (14.6.2)
156
156
  chef-config (>= 12.8, < 15)
157
157
  ffi (~> 1.9)
158
158
  ffi-yajl (~> 2.2)
159
159
  ipaddress
160
- mixlib-cli
160
+ mixlib-cli (>= 1.7.0)
161
161
  mixlib-config (~> 2.0)
162
162
  mixlib-log (~> 2.0, >= 2.0.1)
163
163
  mixlib-shellout (~> 2.0)
@@ -165,47 +165,47 @@ GEM
165
165
  systemu (~> 2.6.4)
166
166
  wmi-lite (~> 1.0)
167
167
  parallel (1.12.1)
168
- parser (2.5.1.0)
168
+ parser (2.5.1.2)
169
169
  ast (~> 2.4.0)
170
170
  plist (3.4.0)
171
171
  polyglot (0.3.5)
172
172
  powerpack (0.1.2)
173
173
  proxifier (1.0.3)
174
- public_suffix (3.0.2)
174
+ public_suffix (3.0.3)
175
175
  rack (2.0.5)
176
176
  rainbow (3.0.0)
177
177
  rake (12.3.1)
178
178
  retryable (2.0.4)
179
- rspec (3.7.0)
180
- rspec-core (~> 3.7.0)
181
- rspec-expectations (~> 3.7.0)
182
- rspec-mocks (~> 3.7.0)
183
- rspec-core (3.7.1)
184
- rspec-support (~> 3.7.0)
185
- rspec-expectations (3.7.0)
179
+ rspec (3.8.0)
180
+ rspec-core (~> 3.8.0)
181
+ rspec-expectations (~> 3.8.0)
182
+ rspec-mocks (~> 3.8.0)
183
+ rspec-core (3.8.0)
184
+ rspec-support (~> 3.8.0)
185
+ rspec-expectations (3.8.2)
186
186
  diff-lcs (>= 1.2.0, < 2.0)
187
- rspec-support (~> 3.7.0)
187
+ rspec-support (~> 3.8.0)
188
188
  rspec-its (1.2.0)
189
189
  rspec-core (>= 3.0.0)
190
190
  rspec-expectations (>= 3.0.0)
191
- rspec-mocks (3.7.0)
191
+ rspec-mocks (3.8.0)
192
192
  diff-lcs (>= 1.2.0, < 2.0)
193
- rspec-support (~> 3.7.0)
194
- rspec-support (3.7.1)
193
+ rspec-support (~> 3.8.0)
194
+ rspec-support (3.8.0)
195
195
  rspec_junit_formatter (0.2.3)
196
196
  builder (< 4)
197
197
  rspec-core (>= 2, < 4, != 2.12.0)
198
- rubocop (0.57.2)
198
+ rubocop (0.59.2)
199
199
  jaro_winkler (~> 1.5.1)
200
200
  parallel (~> 1.10)
201
- parser (>= 2.5)
201
+ parser (>= 2.5, != 2.5.1.1)
202
202
  powerpack (~> 0.1)
203
203
  rainbow (>= 2.2.2, < 4.0)
204
204
  ruby-progressbar (~> 1.7)
205
205
  unicode-display_width (~> 1.0, >= 1.0.1)
206
- ruby-progressbar (1.9.0)
206
+ ruby-progressbar (1.10.0)
207
207
  rubyntlm (0.6.2)
208
- rubyzip (1.2.1)
208
+ rubyzip (1.2.2)
209
209
  rufus-lru (1.1.0)
210
210
  safe_yaml (1.0.4)
211
211
  sawyer (0.8.1)
@@ -221,14 +221,14 @@ GEM
221
221
  solve (4.0.0)
222
222
  molinillo (~> 0.6)
223
223
  semverse (>= 1.1, < 3.0)
224
- specinfra (2.73.4)
224
+ specinfra (2.76.2)
225
225
  net-scp
226
- net-ssh (>= 2.7, < 5.0)
227
- net-telnet
226
+ net-ssh (>= 2.7)
227
+ net-telnet (= 0.1.1)
228
228
  sfl
229
229
  syslog-logger (1.6.8)
230
230
  systemu (2.6.5)
231
- test-kitchen (1.22.0)
231
+ test-kitchen (1.23.2)
232
232
  mixlib-install (~> 3.6)
233
233
  mixlib-shellout (>= 1.2, < 3.0)
234
234
  net-scp (~> 1.1)
@@ -264,7 +264,7 @@ GEM
264
264
  winrm-elevated (1.1.0)
265
265
  winrm (~> 2.0)
266
266
  winrm-fs (~> 1.0)
267
- winrm-fs (1.2.0)
267
+ winrm-fs (1.3.0)
268
268
  erubis (~> 2.7)
269
269
  logging (>= 1.6.1, < 3.0)
270
270
  rubyzip (~> 1.1)
@@ -287,4 +287,4 @@ DEPENDENCIES
287
287
  webmock (~> 2.0)
288
288
 
289
289
  BUNDLED WITH
290
- 1.16.2
290
+ 1.16.6
data/README.md CHANGED
@@ -12,7 +12,8 @@ By design, a single COMAP instance should monitor a single service.
12
12
  It is best used within a container belonging to the same network as the
13
13
  services it follows.
14
14
 
15
- A *container* label is added to each metric with the original container name.
15
+ A *service* and *container* labels is added to each metric with respectively
16
+ service name and original container name.
16
17
 
17
18
  Aggregated metrics intended to be fetched as a target by Prometheus are exposed
18
19
  on port 9397.
@@ -101,11 +102,11 @@ on 9397 port
101
102
 
102
103
  [root@comap-swarm-manager-centos-7 /]# curl localhost:9397
103
104
  # TYPE metrics_sample_seconds gauge
104
- metrics_sample_seconds{container="metrics.1"} 42
105
- metrics_sample_seconds{container="metrics.2"} 42
105
+ metrics_sample_seconds{service="metrics",container="metrics.1"} 42
106
+ metrics_sample_seconds{service="metrics",container="metrics.2"} 42
106
107
  # TYPE metrics_sample_2_seconds gauge
107
- metrics_sample_2_seconds{container="metrics.1"} 24
108
- metrics_sample_2_seconds{container="metrics.2"} 24
108
+ metrics_sample_2_seconds{service="metrics",container="metrics.1"} 24
109
+ metrics_sample_2_seconds{service="metrics",container="metrics.2"} 24
109
110
 
110
111
  Development
111
112
  -----------
@@ -33,6 +33,7 @@ module COMAP
33
33
  )
34
34
  raise ArgumentError, 'No services given' if services.empty?
35
35
  raise ArgumentError, 'No network given' if network.nil?
36
+
36
37
  ssl_hash = parse_ssl(docker_ssl)
37
38
  @client = DockerClient.new(docker_host, docker_port, ssl_hash)
38
39
  @network = network
@@ -60,6 +61,7 @@ module COMAP
60
61
  def service_metrics(service, port)
61
62
  containers(service).sort_by { |c| c['slot'] }.map do |container|
62
63
  next puts "#{service} service not found" if container.empty?
64
+
63
65
  url = "http://#{container['ip']}:#{port}/#{@metrics_path}"
64
66
  container_metrics(url, service, container['slot'])
65
67
  end.reduce(&merge_proc)
@@ -68,9 +70,11 @@ module COMAP
68
70
  def container_metrics(url, service, slot)
69
71
  data = scrape_metrics(url, service)
70
72
  return {} if data.nil?
73
+
71
74
  data.lines.each_with_object({}) do |value, hash|
72
75
  next hash[value] = nil if value.start_with?('#')
73
- (hash[hash.keys.last] ||= []) << add_label(value, "#{service}.#{slot}")
76
+
77
+ (hash[hash.keys.last] ||= []) << add_label(value, service, slot)
74
78
  end.compact
75
79
  end
76
80
 
@@ -83,8 +87,8 @@ module COMAP
83
87
  puts "Could not connect to #{service} endpoint #{url}"
84
88
  end
85
89
 
86
- def add_label(line, label)
87
- replace = %(container="#{label}")
90
+ def add_label(line, service, slot)
91
+ replace = %(service="#{service}",container="#{service}.#{slot}")
88
92
  if line[/{.*?\}/].nil?
89
93
  line.sub(/ /, "{#{replace}} ")
90
94
  else
@@ -17,5 +17,5 @@
17
17
 
18
18
  # Define version
19
19
  module COMAP
20
- VERSION = '1.1.0'
20
+ VERSION = '1.2.0'
21
21
  end
@@ -15,6 +15,17 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
+ # Launch dns service
19
+ docker_image 'andyshinn/dnsmasq'
20
+
21
+ docker_container 'dnsmasq' do
22
+ repo 'andyshinn/dnsmasq'
23
+ network_mode 'host'
24
+ cap_add ['NET_ADMIN']
25
+ restart_policy 'unless-stopped'
26
+ subscribes :redeploy, 'docker_image[andyshinn/dnsmasq]', :immediately
27
+ end
28
+
18
29
  # Create secrets
19
30
  dir = '/root/.docker'
20
31
  %w[ca.pem cert.pem key.pem].each do |secret|
@@ -53,7 +64,7 @@ docker_platform_service 'metrics-global' do
53
64
  action :create
54
65
  end
55
66
 
56
- server = 'https://comap-swarm-manager-centos-7'
67
+ server = 'https://comap-swarm-manager-centos-7.kitchen'
57
68
  ssl = {
58
69
  'client_cert' => '/run/secrets/cert.pem',
59
70
  'client_key' => '/run/secrets/key.pem',
@@ -68,6 +79,7 @@ ssl_opt = ssl.map { |k, v| "#{k}=#{v}" }.join(',')
68
79
  options(
69
80
  mode: 'replicated',
70
81
  network: 'kitchen',
82
+ dns: node['ipaddress'],
71
83
  publish: "#{port}:9397",
72
84
  secret: %w[cert.pem key.pem ca.pem]
73
85
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Arrambourg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-07-10 00:00:00.000000000 Z
12
+ date: 2018-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler