fluent-plugin-kubernetes_metadata_filter 3.1.0 → 3.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
  SHA256:
3
- metadata.gz: 58d897a095da0f86d4df33f0b5c58c82d85076803d6d0dbedc5de3a31d43d156
4
- data.tar.gz: 462a281ecfee82ba19b551e42a0a7b5231588d8e0c822c7c1056520184ba1200
3
+ metadata.gz: 4dda6d742dd87da5fb17389aa54f6c5fe1e17beb39ad2ad66d1e990b1a013e95
4
+ data.tar.gz: 0c5b3e36fe6c0b3017c9057b88df9349b8866e5d2901cf779b4f2f94da5e5fc5
5
5
  SHA512:
6
- metadata.gz: 895146267be4067440ecd5e0466f8b62c0d618aed2dcc2e1cb335035d99ec1f9b3f1e4b39cadc16e641206877ebd92b012bca7f82da941a06ca55c5c7615d842
7
- data.tar.gz: fdd45eff7c2ba1c1aeca22fe524dbfc9d2d0f94509f7731d1f199c925213fc7e57ad6fd75c2578b794e2f6ef8e20016aa06ed13d6cd90583794ebb960811dfc6
6
+ metadata.gz: 42fae7c4dd1f717d95d8015a9a66f2b65fafa80d55fb7751a3bdc374edeb06433974045a6f365ecd654734b957d3d48ab04cf15d64d4cc91f0c589792616f491
7
+ data.tar.gz: a20b407a2e4edb14c25f4a6fbad5bd6a4c016364ce785bebddab12b9b06d803f9ce189c5eaebdcd7b0826366568465b41f7fcef0691162c3f4a92ae7be077a86
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-kubernetes_metadata_filter (3.1.0)
4
+ fluent-plugin-kubernetes_metadata_filter (3.1.2)
5
5
  fluentd (>= 0.14.0, < 1.16)
6
6
  kubeclient (>= 4.0.0, < 5.0.0)
7
7
  lru_redux
@@ -30,7 +30,7 @@ GEM
30
30
  ffi-compiler (1.0.1)
31
31
  ffi (>= 1.0.0)
32
32
  rake
33
- fluentd (1.15.1)
33
+ fluentd (1.15.2)
34
34
  bundler
35
35
  cool.io (>= 1.4.5, < 2.0.0)
36
36
  http_parser.rb (>= 0.5.1, < 0.9.0)
@@ -62,7 +62,7 @@ GEM
62
62
  http_parser.rb (0.8.0)
63
63
  jsonpath (1.1.2)
64
64
  multi_json
65
- kubeclient (4.9.3)
65
+ kubeclient (4.10.0)
66
66
  http (>= 3.0, < 5.0)
67
67
  jsonpath (~> 1.0)
68
68
  recursive-open-struct (~> 1.1, >= 1.1.1)
@@ -73,7 +73,7 @@ GEM
73
73
  mime-types-data (3.2022.0105)
74
74
  mini_mime (1.1.2)
75
75
  minitest (4.7.5)
76
- msgpack (1.5.4)
76
+ msgpack (1.6.0)
77
77
  multi_json (1.15.0)
78
78
  netrc (0.11.0)
79
79
  parallel (1.22.1)
@@ -122,7 +122,7 @@ GEM
122
122
  test-unit (>= 2.5.2)
123
123
  tzinfo (2.0.5)
124
124
  concurrent-ruby (~> 1.0)
125
- tzinfo-data (1.2022.1)
125
+ tzinfo-data (1.2022.4)
126
126
  tzinfo (>= 1.0.0)
127
127
  unf (0.1.4)
128
128
  unf_ext
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'fluent-plugin-kubernetes_metadata_filter'
8
- gem.version = '3.1.0'
8
+ gem.version = '3.1.2'
9
9
  gem.authors = ['OpenShift Cluster Logging','Jimmi Dyson']
10
10
  gem.email = ['team-logging@redhat.com','jimmidyson@gmail.com']
11
11
  gem.description = 'Filter plugin to add Kubernetes metadata'
@@ -331,6 +331,11 @@ module Fluent::Plugin
331
331
  metadata['kubernetes'].merge!(pod_metadata) if pod_metadata
332
332
  metadata['kubernetes'].delete('containers')
333
333
  end
334
+ metadata['kubernetes'].tap do |kube|
335
+ kube.each_pair do |k,v|
336
+ kube[k.dup] = v.dup
337
+ end
338
+ end
334
339
  metadata.delete('docker') if metadata['docker'] && (metadata['docker']['container_id'].nil? || metadata['docker']['container_id'].empty?)
335
340
  metadata
336
341
  end
@@ -52,7 +52,7 @@ module KubernetesMetadata
52
52
  # recreate client to refresh token
53
53
  log.info("Encountered '401 Unauthorized' exception in watch, recreating client to refresh token")
54
54
  create_client()
55
- namespace_watcher = nil
55
+ pod_watcher = nil
56
56
  else
57
57
  # treat all other errors the same as StandardError, log, swallow and reset
58
58
  @stats.bump(:pod_watch_failures)
@@ -373,6 +373,23 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
373
373
  end
374
374
  end
375
375
 
376
+ test 'kubernetes metadata is cloned so it further processing does not modify the cache' do
377
+
378
+ VCR.use_cassettes([{ name: 'valid_kubernetes_api_server' }, { name: 'kubernetes_get_api_v1' }, { name: 'kubernetes_get_pod' }, { name: 'kubernetes_get_namespace_default' }]) do
379
+
380
+ d = create_driver('
381
+ kubernetes_url https://localhost:8443
382
+ watch false
383
+ cache_size 1')
384
+ d.run(default_tag: VAR_LOG_POD_TAG) do
385
+ d.feed(@time, { 'time' => '2015-05-08T09:22:01Z' })
386
+ d.feed(@time, { 'time' => '2015-05-08T09:22:01Z' })
387
+ end
388
+ filtered = d.filtered.map(&:last)
389
+ assert_not_equal(filtered[0]['kubernetes']['labels'].object_id, filtered[1]['kubernetes']['labels'].object_id, "Exp. meta to be cloned")
390
+ end
391
+ end
392
+
376
393
  test 'with docker & kubernetes metadata & namespace_id enabled' do
377
394
  VCR.use_cassettes([{ name: 'valid_kubernetes_api_server' }, { name: 'kubernetes_get_api_v1' }, { name: 'kubernetes_get_pod' },
378
395
  { name: 'kubernetes_get_namespace_default', options: { allow_playback_repeats: true } }]) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kubernetes_metadata_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenShift Cluster Logging
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-08 00:00:00.000000000 Z
12
+ date: 2022-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd