fluent-plugin-kubernetes_metadata_filter 2.1.1 → 2.1.2

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
  SHA1:
3
- metadata.gz: 149bef65a13bf7ef7fc0a3964b4f8ba0696489f8
4
- data.tar.gz: 99f30525e67d6d92593a1e6bbd5160b19889dab0
3
+ metadata.gz: fe17406dc7a359a7bb8b52271680b041397bf567
4
+ data.tar.gz: 449541c91baaa0a96ee27adf6a74464941c96916
5
5
  SHA512:
6
- metadata.gz: d06e30879346ca2cca50a377357860e353263e9887f00de254d9906632080d6ec61eca74657a68debd60bcb594df5afdaeca8d54596ee57690cd0c40851261ae
7
- data.tar.gz: 57c74b482aed9cece0895b9959929c16fc8fa55c705d93b889270171be55c5150682fb03d7c2a60fbbbfa91089998481a126d73aa3534951cc5772ebd1b6c055
6
+ metadata.gz: 7f8d366a2eb39f8c43ce9d240817cc251524ec58c2cde4186d85824b7d1e861b8396443d2c4a148ffc84892632f3ff4c87f4ca8396ddfb2c46d4f5bf55ee5caa
7
+ data.tar.gz: fdc11df9a3d428929e2aa986b48848cc7204273a83b212f77277a295990afd6fd968d24105c4ebb30be4abdbd629e899478a76f6a03be6582492324b6f26cb28
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fluent-plugin-kubernetes_metadata_filter"
7
- gem.version = "2.1.1"
7
+ gem.version = "2.1.2"
8
8
  gem.authors = ["Jimmi Dyson"]
9
9
  gem.email = ["jimmidyson@gmail.com"]
10
10
  gem.description = %q{Filter plugin to add Kubernetes metadata}
@@ -262,17 +262,25 @@ module Fluent::Plugin
262
262
 
263
263
  end
264
264
 
265
- def get_metadata_for_record(match_data, cache_key, create_time, batch_miss_cache)
265
+ def get_metadata_for_record(match_data, container_id, create_time, batch_miss_cache)
266
266
  namespace_name = match_data['namespace']
267
267
  pod_name = match_data['pod_name']
268
+ container_name = match_data['container_name']
268
269
  metadata = {
269
- 'container_name' => match_data['container_name'],
270
- 'namespace_name' => namespace_name,
271
- 'pod_name' => pod_name
270
+ 'container_name' => container_name,
271
+ 'namespace_name' => namespace_name,
272
+ 'pod_name' => pod_name
272
273
  }
273
274
  if @kubernetes_url.present?
274
- pod_metadata = get_pod_metadata(cache_key, namespace_name, pod_name, create_time, batch_miss_cache)
275
+ pod_metadata = get_pod_metadata(container_id, namespace_name, pod_name, create_time, batch_miss_cache)
276
+
277
+ if (pod_metadata.include? 'containers') && (pod_metadata['containers'].include? container_id)
278
+ metadata['container_image'] = pod_metadata['containers'][container_id]['image']
279
+ metadata['container_image_id'] = pod_metadata['containers'][container_id]['image_id']
280
+ end
281
+
275
282
  metadata.merge!(pod_metadata) if pod_metadata
283
+ metadata.delete('containers')
276
284
  end
277
285
  metadata
278
286
  end
@@ -291,6 +299,7 @@ module Fluent::Plugin
291
299
  end
292
300
 
293
301
  def filter_stream_from_files(tag, es)
302
+ return es if es.nil? || es.empty?
294
303
  new_es = Fluent::MultiEventStream.new
295
304
 
296
305
  match_data = tag.match(@tag_to_kubernetes_name_regexp_compiled)
@@ -314,6 +323,7 @@ module Fluent::Plugin
314
323
  end
315
324
 
316
325
  def filter_stream_from_journal(tag, es)
326
+ return es if es.nil? || es.empty?
317
327
  new_es = Fluent::MultiEventStream.new
318
328
  batch_miss_cache = {}
319
329
  es.each do |time, record|
@@ -83,6 +83,7 @@ module KubernetesMetadata
83
83
  end
84
84
  @id_cache[key] = ids unless batch_miss_cache.key?("#{namespace_name}_#{pod_name}")
85
85
  end
86
+
86
87
  # remove namespace info that is only used for comparison
87
88
  metadata.delete('creation_timestamp')
88
89
  metadata.delete_if{|k,v| v.nil?}
@@ -54,10 +54,28 @@ module KubernetesMetadata
54
54
  self.de_dot!(labels)
55
55
  self.de_dot!(annotations)
56
56
  end
57
+
58
+ # collect container informations
59
+ container_meta = {}
60
+ begin
61
+ pod_object['status']['containerStatuses'].each do|container_status|
62
+ # get plain container id (eg. docker://hash -> hash)
63
+ container_id = container_status['containerID'].sub /^[-_a-zA-Z0-9]+:\/\//, ''
64
+ container_meta[container_id] = {
65
+ 'name' => container_status['name'],
66
+ 'image' => container_status['image'],
67
+ 'image_id' => container_status['imageID']
68
+ }
69
+ end
70
+ rescue
71
+ log.debug("parsing container meta information failed for: #{pod_object['metadata']['namespace']}/#{pod_object['metadata']['name']} ")
72
+ end
73
+
57
74
  kubernetes_metadata = {
58
75
  'namespace_name' => pod_object['metadata']['namespace'],
59
76
  'pod_id' => pod_object['metadata']['uid'],
60
77
  'pod_name' => pod_object['metadata']['name'],
78
+ 'containers' => syms_to_strs(container_meta),
61
79
  'labels' => labels,
62
80
  'host' => pod_object['spec']['nodeName'],
63
81
  'master_url' => @kubernetes_url
@@ -174,7 +174,7 @@ http_interactions:
174
174
  "restartCount": 2,
175
175
  "image": "fabric8/hawtio-kubernetes:latest",
176
176
  "imageID": "docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303",
177
- "containerID": "docker://1b1d1f61c1205fe73328c75b2945e2ce05acfba2fde16299a8103fb22e9ec58a"
177
+ "containerID": "docker://49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459"
178
178
  },
179
179
  {
180
180
  "name": "POD",
@@ -158,6 +158,24 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
158
158
  d.filtered.map{|e| e.last}
159
159
  end
160
160
 
161
+ test 'nil event stream from journal' do
162
+ #not certain how this is possible but adding test to properly
163
+ #guard against this condition we have seen
164
+
165
+ plugin = create_driver.instance
166
+ plugin.filter_stream_from_journal('tag', nil)
167
+ plugin.filter_stream_from_journal('tag', Fluent::MultiEventStream.new)
168
+ end
169
+
170
+ test 'nil event stream from files' do
171
+ #not certain how this is possible but adding test to properly
172
+ #guard against this condition we have seen
173
+
174
+ plugin = create_driver.instance
175
+ plugin.filter_stream_from_files('tag', nil)
176
+ plugin.filter_stream_from_files('tag', Fluent::MultiEventStream.new)
177
+ end
178
+
161
179
  test 'inability to connect to the api server handles exception and doensnt block pipeline' do
162
180
  VCR.use_cassette('kubernetes_docker_metadata') do
163
181
  driver = create_driver('
@@ -206,11 +224,11 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
206
224
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
207
225
  },
208
226
  'kubernetes' => {
209
- 'pod_name' => 'fabric8-console-controller-98rqc',
210
- 'container_name' => 'fabric8-console-container',
211
- 'namespace_name' => 'default',
212
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
213
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
227
+ 'pod_name' => 'fabric8-console-controller-98rqc',
228
+ 'container_name' => 'fabric8-console-container',
229
+ 'namespace_name' => 'default',
230
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
231
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
214
232
  }
215
233
  }
216
234
 
@@ -237,13 +255,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
237
255
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
238
256
  },
239
257
  'kubernetes' => {
240
- 'host' => 'jimmi-redhat.localnet',
241
- 'pod_name' => 'fabric8-console-controller-98rqc',
242
- 'container_name' => 'fabric8-console-container',
243
- 'namespace_name' => 'default',
244
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
245
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
246
- 'master_url' => 'https://localhost:8443',
258
+ 'host' => 'jimmi-redhat.localnet',
259
+ 'pod_name' => 'fabric8-console-controller-98rqc',
260
+ 'container_name' => 'fabric8-console-container',
261
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
262
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
263
+ 'namespace_name' => 'default',
264
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
265
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
266
+ 'master_url' => 'https://localhost:8443',
247
267
  'labels' => {
248
268
  'component' => 'fabric8Console'
249
269
  }
@@ -263,13 +283,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
263
283
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
264
284
  },
265
285
  'kubernetes' => {
266
- 'host' => 'jimmi-redhat.localnet',
267
- 'pod_name' => 'fabric8-console-controller-98rqc',
268
- 'container_name' => 'fabric8-console-container',
269
- 'namespace_name' => 'default',
270
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
271
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
272
- 'master_url' => 'https://localhost:8443',
286
+ 'host' => 'jimmi-redhat.localnet',
287
+ 'pod_name' => 'fabric8-console-controller-98rqc',
288
+ 'container_name' => 'fabric8-console-container',
289
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
290
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
291
+ 'namespace_name' => 'default',
292
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
293
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
294
+ 'master_url' => 'https://localhost:8443',
273
295
  'labels' => {
274
296
  'component' => 'fabric8Console'
275
297
  }
@@ -292,13 +314,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
292
314
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
293
315
  },
294
316
  'kubernetes' => {
295
- 'host' => 'jimmi-redhat.localnet',
296
- 'pod_name' => 'fabric8-console-controller-98rqc',
297
- 'container_name' => 'fabric8-console-container',
298
- 'namespace_name' => 'default',
299
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
300
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
301
- 'master_url' => 'https://localhost:8443',
317
+ 'host' => 'jimmi-redhat.localnet',
318
+ 'pod_name' => 'fabric8-console-controller-98rqc',
319
+ 'container_name' => 'fabric8-console-container',
320
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
321
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
322
+ 'namespace_name' => 'default',
323
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
324
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
325
+ 'master_url' => 'https://localhost:8443',
302
326
  'labels' => {
303
327
  'component' => 'fabric8Console'
304
328
  }
@@ -321,13 +345,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
321
345
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
322
346
  },
323
347
  'kubernetes' => {
324
- 'host' => 'jimmi-redhat.localnet',
325
- 'pod_name' => 'fabric8-console-controller-98rqc',
326
- 'container_name' => 'fabric8-console-container',
327
- 'namespace_name' => 'default',
328
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
329
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
330
- 'master_url' => 'https://localhost:8443',
348
+ 'host' => 'jimmi-redhat.localnet',
349
+ 'pod_name' => 'fabric8-console-controller-98rqc',
350
+ 'container_name' => 'fabric8-console-container',
351
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
352
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
353
+ 'namespace_name' => 'default',
354
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
355
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
356
+ 'master_url' => 'https://localhost:8443',
331
357
  'labels' => {
332
358
  'component' => 'fabric8Console'
333
359
  }
@@ -344,9 +370,9 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
344
370
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
345
371
  },
346
372
  'kubernetes' => {
347
- 'pod_name' => 'fabric8-console-controller-98rqc',
348
- 'container_name' => 'fabric8-console-container',
349
- 'namespace_name' => 'default',
373
+ 'pod_name' => 'fabric8-console-controller-98rqc',
374
+ 'container_name' => 'fabric8-console-container',
375
+ 'namespace_name' => 'default',
350
376
  }
351
377
  }
352
378
  assert_equal(expected_kube_metadata, filtered[0])
@@ -366,11 +392,11 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
366
392
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
367
393
  },
368
394
  'kubernetes' => {
369
- 'pod_name' => 'fabric8-console-controller-98rqc',
370
- 'container_name' => 'fabric8-console-container',
371
- 'namespace_name' => '.orphaned',
395
+ 'pod_name' => 'fabric8-console-controller-98rqc',
396
+ 'container_name' => 'fabric8-console-container',
397
+ 'namespace_name' => '.orphaned',
372
398
  'orphaned_namespace' => 'default',
373
- 'namespace_id' => 'orphaned'
399
+ 'namespace_id' => 'orphaned'
374
400
  }
375
401
  }
376
402
  assert_equal(expected_kube_metadata, filtered[0])
@@ -389,9 +415,9 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
389
415
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
390
416
  },
391
417
  'kubernetes' => {
392
- 'pod_name' => 'fabric8-console-controller.98rqc',
393
- 'container_name' => 'fabric8-console-container',
394
- 'namespace_name' => 'default'
418
+ 'pod_name' => 'fabric8-console-controller.98rqc',
419
+ 'container_name' => 'fabric8-console-container',
420
+ 'namespace_name' => 'default'
395
421
  }
396
422
  }
397
423
  assert_equal(expected_kube_metadata, filtered[0])
@@ -423,16 +449,18 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
423
449
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
424
450
  },
425
451
  'kubernetes' => {
426
- 'host' => 'jimmi-redhat.localnet',
427
- 'pod_name' => 'fabric8-console-controller-98rqc',
428
- 'container_name' => 'fabric8-console-container',
429
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
430
- 'namespace_labels' => {
452
+ 'host' => 'jimmi-redhat.localnet',
453
+ 'pod_name' => 'fabric8-console-controller-98rqc',
454
+ 'container_name' => 'fabric8-console-container',
455
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
456
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
457
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
458
+ 'namespace_labels' => {
431
459
  'kubernetes_io/namespacetest' => 'somevalue'
432
460
  },
433
- 'namespace_name' => 'default',
434
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
435
- 'master_url' => 'https://localhost:8443',
461
+ 'namespace_name' => 'default',
462
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
463
+ 'master_url' => 'https://localhost:8443',
436
464
  'labels' => {
437
465
  'kubernetes_io/test' => 'somevalue'
438
466
  }
@@ -455,16 +483,18 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
455
483
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
456
484
  },
457
485
  'kubernetes' => {
458
- 'host' => 'jimmi-redhat.localnet',
459
- 'pod_name' => 'fabric8-console-controller-98rqc',
460
- 'container_name' => 'fabric8-console-container',
461
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
462
- 'namespace_labels' => {
486
+ 'host' => 'jimmi-redhat.localnet',
487
+ 'pod_name' => 'fabric8-console-controller-98rqc',
488
+ 'container_name' => 'fabric8-console-container',
489
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
490
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
491
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
492
+ 'namespace_labels' => {
463
493
  'kubernetes.io/namespacetest' => 'somevalue'
464
494
  },
465
- 'namespace_name' => 'default',
466
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
467
- 'master_url' => 'https://localhost:8443',
495
+ 'namespace_name' => 'default',
496
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
497
+ 'master_url' => 'https://localhost:8443',
468
498
  'labels' => {
469
499
  'kubernetes.io/test' => 'somevalue'
470
500
  }
@@ -502,13 +532,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
502
532
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
503
533
  },
504
534
  'kubernetes' => {
505
- 'host' => 'jimmi-redhat.localnet',
506
- 'pod_name' => 'fabric8-console-controller-98rqc',
507
- 'container_name' => 'fabric8-console-container',
508
- 'namespace_name' => 'default',
509
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
510
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
511
- 'master_url' => 'https://localhost:8443',
535
+ 'host' => 'jimmi-redhat.localnet',
536
+ 'pod_name' => 'fabric8-console-controller-98rqc',
537
+ 'container_name' => 'fabric8-console-container',
538
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
539
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
540
+ 'namespace_name' => 'default',
541
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
542
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
543
+ 'master_url' => 'https://localhost:8443',
512
544
  'labels' => {
513
545
  'component' => 'fabric8Console'
514
546
  }
@@ -538,13 +570,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
538
570
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
539
571
  },
540
572
  'kubernetes' => {
541
- 'host' => 'jimmi-redhat.localnet',
542
- 'pod_name' => 'fabric8-console-controller-98rqc',
543
- 'container_name' => 'fabric8-console-container',
544
- 'namespace_name' => 'default',
545
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
546
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
547
- 'master_url' => 'https://localhost:8443',
573
+ 'host' => 'jimmi-redhat.localnet',
574
+ 'pod_name' => 'fabric8-console-controller-98rqc',
575
+ 'container_name' => 'fabric8-console-container',
576
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
577
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
578
+ 'namespace_name' => 'default',
579
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
580
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
581
+ 'master_url' => 'https://localhost:8443',
548
582
  'labels' => {
549
583
  'component' => 'fabric8Console'
550
584
  }
@@ -567,14 +601,16 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
567
601
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
568
602
  },
569
603
  'kubernetes' => {
570
- 'host' => 'jimmi-redhat.localnet',
571
- 'pod_name' => 'fabric8-console-controller-98rqc',
572
- 'container_name' => 'fabric8-console-container',
573
- 'namespace_name' => 'default',
574
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
575
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
576
- 'master_url' => 'https://localhost:8443',
577
- 'labels' => {
604
+ 'host' => 'jimmi-redhat.localnet',
605
+ 'pod_name' => 'fabric8-console-controller-98rqc',
606
+ 'container_name' => 'fabric8-console-container',
607
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
608
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
609
+ 'namespace_name' => 'default',
610
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
611
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
612
+ 'master_url' => 'https://localhost:8443',
613
+ 'labels' => {
578
614
  'component' => 'fabric8Console'
579
615
  },
580
616
  'annotations' => {
@@ -607,13 +643,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
607
643
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
608
644
  },
609
645
  'kubernetes' => {
610
- 'host' => 'jimmi-redhat.localnet',
611
- 'pod_name' => 'fabric8-console-controller-98rqc',
612
- 'container_name' => 'fabric8-console-container',
613
- 'namespace_name' => 'default',
614
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
615
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
616
- 'master_url' => 'https://localhost:8443',
646
+ 'host' => 'jimmi-redhat.localnet',
647
+ 'pod_name' => 'fabric8-console-controller-98rqc',
648
+ 'container_name' => 'fabric8-console-container',
649
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
650
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
651
+ 'namespace_name' => 'default',
652
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
653
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
654
+ 'master_url' => 'https://localhost:8443',
617
655
  'labels' => {
618
656
  'component' => 'fabric8Console'
619
657
  }
@@ -636,14 +674,16 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
636
674
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
637
675
  },
638
676
  'kubernetes' => {
639
- 'host' => 'jimmi-redhat.localnet',
640
- 'pod_name' => 'fabric8-console-controller-98rqc',
641
- 'container_name' => 'fabric8-console-container',
642
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
643
- 'namespace_name' => 'default',
644
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
645
- 'master_url' => 'https://localhost:8443',
646
- 'labels' => {
677
+ 'host' => 'jimmi-redhat.localnet',
678
+ 'pod_name' => 'fabric8-console-controller-98rqc',
679
+ 'container_name' => 'fabric8-console-container',
680
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
681
+ 'namespace_name' => 'default',
682
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
683
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
684
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
685
+ 'master_url' => 'https://localhost:8443',
686
+ 'labels' => {
647
687
  'component' => 'fabric8Console'
648
688
  },
649
689
  'annotations' => {
@@ -672,14 +712,16 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
672
712
  'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
673
713
  },
674
714
  'kubernetes' => {
675
- 'host' => 'jimmi-redhat.localnet',
676
- 'pod_name' => 'fabric8-console-controller-98rqc',
677
- 'container_name' => 'fabric8-console-container',
678
- 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
679
- 'namespace_name' => 'default',
680
- 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
681
- 'master_url' => 'https://localhost:8443',
682
- 'labels' => {
715
+ 'host' => 'jimmi-redhat.localnet',
716
+ 'pod_name' => 'fabric8-console-controller-98rqc',
717
+ 'container_name' => 'fabric8-console-container',
718
+ 'container_image' => 'fabric8/hawtio-kubernetes:latest',
719
+ 'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
720
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
721
+ 'namespace_name' => 'default',
722
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
723
+ 'master_url' => 'https://localhost:8443',
724
+ 'labels' => {
683
725
  'component' => 'fabric8Console'
684
726
  }
685
727
  }
@@ -35,7 +35,14 @@ class DefaultPodWatchStrategyTest < WatchTest
35
35
  'labels' => {},
36
36
  },
37
37
  'spec' => {
38
- 'nodeName' => 'aNodeName'
38
+ 'nodeName' => 'aNodeName',
39
+ 'containers' => [{
40
+ 'name' => 'foo',
41
+ 'image' => 'bar',
42
+ }, {
43
+ 'name' => 'bar',
44
+ 'image' => 'foo',
45
+ }]
39
46
  }
40
47
  }
41
48
  )
@@ -49,8 +56,33 @@ class DefaultPodWatchStrategyTest < WatchTest
49
56
  'labels' => {},
50
57
  },
51
58
  'spec' => {
52
- 'nodeName' => 'aNodeName'
53
- }
59
+ 'nodeName' => 'aNodeName',
60
+ 'containers' => [{
61
+ 'name' => 'foo',
62
+ 'image' => 'bar',
63
+ }, {
64
+ 'name' => 'bar',
65
+ 'image' => 'foo',
66
+ }]
67
+ },
68
+ 'status' => {
69
+ 'containerStatuses' => [
70
+ {
71
+ 'name' => 'fabric8-console-container',
72
+ 'state' => {
73
+ 'running' => {
74
+ 'startedAt' => '2015-05-08T09:22:44Z'
75
+ }
76
+ },
77
+ 'lastState' => {},
78
+ 'ready' => true,
79
+ 'restartCount' => 0,
80
+ 'image' => 'fabric8/hawtio-kubernetes:latest',
81
+ 'imageID' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
82
+ 'containerID' => 'docker://49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
83
+ }
84
+ ]
85
+ }
54
86
  }
55
87
  )
56
88
  @deleted = OpenStruct.new(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kubernetes_metadata_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmi Dyson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd