fluent-plugin-kubernetes_metadata_filter 2.8.0 → 2.9.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: 452a507fb0cbb14f8eb17fe488d07a8ccd9b9f97bef38b592e56a5bb8acbe3bb
4
- data.tar.gz: ff1346d50b7b31ebfd7105523eec621baea0db0a771c193d48094b3c8818e502
3
+ metadata.gz: 7e6587af2b43e50ec81bc3f3899eee290024947534cdc7e9bd85146d6bf159e9
4
+ data.tar.gz: 5d67a5e2116fff691feb231220d2b74967448cad77f55e00c7f4e0e47ebdae3f
5
5
  SHA512:
6
- metadata.gz: 3f9257176000157861bf21980b91e0594494118d4d5cb10eee475127567c4803865e3c1404c02c1e035c015c264d0a3351660ed031566c5d399f774088205f21
7
- data.tar.gz: 439308c8a534c7e0c5cdcf70f8ccd26eeb4ab455abacff1d411f86ae57e4da7b6b422c42f772d84508360a3fec60ed415c454633fecde854b4c288d24cd6d39b
6
+ metadata.gz: fc6c5342bda21df42f692ad2c33b4fcd2097cf86c65de2bb5027193eb83d13513d31f4039b6bead77e27ab1cdbc85ddc5f643f012de073a169ff990f22eafbb9
7
+ data.tar.gz: f2432dcaf5a0784400dd3875c6a87d33f16fd1b09b7910860430245d0184deff4c4c78548c3c300f475f288bf556294d13af940cc2fa461c2b31199a9913d27a
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-kubernetes_metadata_filter (2.8.0)
4
+ fluent-plugin-kubernetes_metadata_filter (2.9.2)
5
5
  fluentd (>= 0.14.0, < 1.15)
6
- kubeclient (< 5)
6
+ kubeclient (>= 4.0.0, < 5.0.0)
7
7
  lru_redux
8
8
 
9
9
  GEM
@@ -11,7 +11,7 @@ GEM
11
11
  specs:
12
12
  addressable (2.8.0)
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
- ast (2.4.1)
14
+ ast (2.4.2)
15
15
  bump (0.10.0)
16
16
  charlock_holmes (0.7.7)
17
17
  codeclimate-test-reporter (0.6.0)
@@ -22,27 +22,27 @@ GEM
22
22
  github-linguist
23
23
  crack (0.4.5)
24
24
  rexml
25
- docile (1.3.5)
25
+ docile (1.4.0)
26
26
  domain_name (0.5.20190701)
27
27
  unf (>= 0.0.5, < 1.0.0)
28
28
  escape_utils (1.2.1)
29
- ffi (1.15.3)
29
+ ffi (1.15.4)
30
30
  ffi-compiler (1.0.1)
31
31
  ffi (>= 1.0.0)
32
32
  rake
33
- fluentd (1.14.0)
33
+ fluentd (1.14.2)
34
34
  bundler
35
35
  cool.io (>= 1.4.5, < 2.0.0)
36
36
  http_parser.rb (>= 0.5.1, < 0.8.0)
37
37
  msgpack (>= 1.3.1, < 2.0.0)
38
38
  serverengine (>= 2.2.2, < 3.0.0)
39
39
  sigdump (~> 0.2.2)
40
- strptime (>= 0.2.2, < 1.0.0)
40
+ strptime (>= 0.2.4, < 1.0.0)
41
41
  tzinfo (>= 1.0, < 3.0)
42
42
  tzinfo-data (~> 1.0)
43
43
  webrick (>= 1.4.2, < 1.8.0)
44
44
  yajl-ruby (~> 1.0)
45
- github-linguist (7.12.2)
45
+ github-linguist (7.17.0)
46
46
  charlock_holmes (~> 0.7.7)
47
47
  escape_utils (~> 1.2.0)
48
48
  mini_mime (~> 1.0)
@@ -70,41 +70,41 @@ GEM
70
70
  lru_redux (1.1.0)
71
71
  mime-types (3.3.1)
72
72
  mime-types-data (~> 3.2015)
73
- mime-types-data (3.2021.0704)
74
- mini_mime (1.0.2)
73
+ mime-types-data (3.2021.0901)
74
+ mini_mime (1.1.2)
75
75
  minitest (4.7.5)
76
76
  msgpack (1.4.2)
77
77
  multi_json (1.15.0)
78
78
  netrc (0.11.0)
79
- parallel (1.20.1)
80
- parser (3.0.0.0)
79
+ parallel (1.21.0)
80
+ parser (3.0.2.0)
81
81
  ast (~> 2.4.1)
82
- power_assert (1.2.0)
82
+ power_assert (2.0.1)
83
83
  public_suffix (4.0.6)
84
84
  rainbow (3.0.0)
85
- rake (13.0.3)
85
+ rake (13.0.6)
86
86
  recursive-open-struct (1.1.3)
87
- regexp_parser (2.0.3)
87
+ regexp_parser (2.1.1)
88
88
  rest-client (2.1.0)
89
89
  http-accept (>= 1.7.0, < 2.0)
90
90
  http-cookie (>= 1.0.2, < 2.0)
91
91
  mime-types (>= 1.16, < 4.0)
92
92
  netrc (~> 0.8)
93
93
  rexml (3.2.5)
94
- rr (1.2.1)
95
- rubocop (1.8.1)
94
+ rr (3.0.8)
95
+ rubocop (1.22.3)
96
96
  parallel (~> 1.10)
97
97
  parser (>= 3.0.0.0)
98
98
  rainbow (>= 2.2.2, < 4.0)
99
99
  regexp_parser (>= 1.8, < 3.0)
100
100
  rexml
101
- rubocop-ast (>= 1.2.0, < 2.0)
101
+ rubocop-ast (>= 1.12.0, < 2.0)
102
102
  ruby-progressbar (~> 1.7)
103
103
  unicode-display_width (>= 1.4.0, < 3.0)
104
- rubocop-ast (1.4.0)
105
- parser (>= 2.7.1.5)
104
+ rubocop-ast (1.12.0)
105
+ parser (>= 3.0.1.1)
106
106
  ruby-progressbar (1.11.0)
107
- rugged (1.1.0)
107
+ rugged (1.2.0)
108
108
  serverengine (2.2.4)
109
109
  sigdump (~> 0.2.2)
110
110
  sigdump (0.2.4)
@@ -113,7 +113,7 @@ GEM
113
113
  simplecov-html (~> 0.11)
114
114
  simplecov_json_formatter (~> 0.1)
115
115
  simplecov-html (0.12.3)
116
- simplecov_json_formatter (0.1.2)
116
+ simplecov_json_formatter (0.1.3)
117
117
  strptime (0.2.5)
118
118
  test-unit (3.0.9)
119
119
  power_assert
@@ -122,15 +122,15 @@ GEM
122
122
  test-unit (>= 2.5.2)
123
123
  tzinfo (2.0.4)
124
124
  concurrent-ruby (~> 1.0)
125
- tzinfo-data (1.2021.1)
125
+ tzinfo-data (1.2021.5)
126
126
  tzinfo (>= 1.0.0)
127
127
  unf (0.1.4)
128
128
  unf_ext
129
- unf_ext (0.0.7.7)
130
- unicode-display_width (2.0.0)
129
+ unf_ext (0.0.8)
130
+ unicode-display_width (2.1.0)
131
131
  vcr (6.0.0)
132
- webmock (3.11.1)
133
- addressable (>= 2.3.6)
132
+ webmock (3.14.0)
133
+ addressable (>= 2.8.0)
134
134
  crack (>= 0.3.2)
135
135
  hashdiff (>= 0.4.0, < 2.0.0)
136
136
  webrick (1.7.0)
data/README.md CHANGED
@@ -45,8 +45,10 @@ This must used named capture groups for `container_name`, `pod_name` & `namespac
45
45
  * `cache_size` - size of the cache of Kubernetes metadata to reduce requests to the API server (default: `1000`)
46
46
  * `cache_ttl` - TTL in seconds of each cached element. Set to negative value to disable TTL eviction (default: `3600` - 1 hour)
47
47
  * `watch` - set up a watch on pods on the API server for updates to metadata (default: `true`)
48
- * `de_dot` - replace dots in labels and annotations with configured `de_dot_separator`, required for ElasticSearch 2.x compatibility (default: `true`)
48
+ * `de_dot` - replace dots in labels and annotations with configured `de_dot_separator`, required for Datadog and ElasticSearch 2.x compatibility (default: `true`)
49
49
  * `de_dot_separator` - separator to use if `de_dot` is enabled (default: `_`)
50
+ * `de_slash` - replace slashes in labels and annotations with configured `de_slash_separator`, required for Datadog compatibility (default: `false`)
51
+ * `de_slash_separator` - separator to use if `de_slash` is enabled (default: `__`)
50
52
  * *DEPRECATED* `use_journal` - If false, messages are expected to be formatted and tagged as if read by the fluentd in\_tail plugin with wildcard filename. If true, messages are expected to be formatted as if read from the systemd journal. The `MESSAGE` field has the full message. The `CONTAINER_NAME` field has the encoded k8s metadata (see below). The `CONTAINER_ID_FULL` field has the full container uuid. This requires docker to use the `--log-driver=journald` log driver. If unset (the default), the plugin will use the `CONTAINER_NAME` and `CONTAINER_ID_FULL` fields
51
53
  if available, otherwise, will use the tag in the `tag_to_kubernetes_name_regexp` format.
52
54
  * `container_name_to_kubernetes_regexp` - The regular expression used to extract the k8s metadata encoded in the journal `CONTAINER_NAME` field default: See [code](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter/blob/master/lib/fluent/plugin/filter_kubernetes_metadata.rb#L68)
@@ -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 = '2.8.0'
8
+ gem.version = '2.9.2'
9
9
  gem.authors = ['Jimmi Dyson']
10
10
  gem.email = ['jimmidyson@gmail.com']
11
11
  gem.description = 'Filter plugin to add Kubernetes metadata'
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.required_ruby_version = '>= 2.5.0'
19
19
 
20
20
  gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 1.15']
21
- gem.add_runtime_dependency 'kubeclient', '< 5'
21
+ gem.add_runtime_dependency 'kubeclient', ['>= 4.0.0', '< 5.0.0']
22
22
  gem.add_runtime_dependency 'lru_redux'
23
23
 
24
24
  gem.add_development_dependency 'bump'
@@ -58,6 +58,8 @@ module Fluent::Plugin
58
58
  config_param :secret_dir, :string, default: '/var/run/secrets/kubernetes.io/serviceaccount'
59
59
  config_param :de_dot, :bool, default: true
60
60
  config_param :de_dot_separator, :string, default: '_'
61
+ config_param :de_slash, :bool, default: false
62
+ config_param :de_slash_separator, :string, default: '__'
61
63
  # if reading from the journal, the record will contain the following fields in the following
62
64
  # format:
63
65
  # CONTAINER_NAME=k8s_$containername.$containerhash_$podname_$namespacename_$poduuid_$rand32bitashex
@@ -166,6 +168,10 @@ module Fluent::Plugin
166
168
  raise Fluent::ConfigError, "Invalid de_dot_separator: cannot be or contain '.'"
167
169
  end
168
170
 
171
+ if @de_slash && @de_slash_separator.include?('/')
172
+ raise Fluent::ConfigError, "Invalid de_slash_separator: cannot be or contain '/'"
173
+ end
174
+
169
175
  if @cache_ttl < 0
170
176
  log.info 'Setting the cache TTL to :none because it was <= 0'
171
177
  @cache_ttl = :none
@@ -381,6 +387,16 @@ module Fluent::Plugin
381
387
  end
382
388
  end
383
389
 
390
+ def de_slash!(h)
391
+ h.keys.each do |ref|
392
+ next unless h[ref] && ref =~ /\//
393
+
394
+ v = h.delete(ref)
395
+ newref = ref.to_s.gsub('/', @de_slash_separator)
396
+ h[newref] = v
397
+ end
398
+ end
399
+
384
400
  # copied from activesupport
385
401
  def present?(object)
386
402
  object.respond_to?(:empty?) ? !object.empty? : !!object
@@ -47,6 +47,10 @@ module KubernetesMetadata
47
47
  de_dot!(labels) unless @skip_labels
48
48
  de_dot!(annotations)
49
49
  end
50
+ if @de_slash
51
+ de_slash!(labels) unless @skip_labels
52
+ de_slash!(annotations)
53
+ end
50
54
  kubernetes_metadata = {
51
55
  'namespace_id' => namespace_object[:metadata][:uid],
52
56
  'creation_timestamp' => namespace_object[:metadata][:creationTimestamp]
@@ -65,13 +69,17 @@ module KubernetesMetadata
65
69
  de_dot!(labels) unless @skip_labels
66
70
  de_dot!(annotations)
67
71
  end
72
+ if @de_slash
73
+ de_slash!(labels) unless @skip_labels
74
+ de_slash!(annotations)
75
+ end
68
76
 
69
77
  # collect container information
70
78
  container_meta = {}
71
79
  begin
72
80
  pod_object[:status][:containerStatuses].each do |container_status|
73
81
  # get plain container id (eg. docker://hash -> hash)
74
- container_id = container_status[:containerID].sub(%r{^[-_a-zA-Z0-9]+://}, '')
82
+ container_id = container_status[:containerID] ? container_status[:containerID].sub(%r{^[-_a-zA-Z0-9]+://}, '') : container_status[:name]
75
83
  container_meta[container_id] = if @skip_container_metadata
76
84
  {
77
85
  'name' => container_status[:name]
@@ -83,9 +91,9 @@ module KubernetesMetadata
83
91
  'image_id' => container_status[:imageID]
84
92
  }
85
93
  end
86
- end
87
- rescue StandardError
88
- log.debug("parsing container meta information failed for: #{pod_object[:metadata][:namespace]}/#{pod_object[:metadata][:name]} ")
94
+ end if pod_object[:status] && pod_object[:status][:containerStatuses]
95
+ rescue StandardError=>e
96
+ log.warn("parsing container meta information failed for: #{pod_object[:metadata][:namespace]}/#{pod_object[:metadata][:name]}: #{e}")
89
97
  end
90
98
 
91
99
  kubernetes_metadata = {
@@ -0,0 +1,145 @@
1
+ #
2
+ # Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
3
+ # Kubernetes metadata
4
+ #
5
+ # Copyright 2015 Red Hat, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ---
20
+ http_interactions:
21
+ - request:
22
+ method: get
23
+ uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
24
+ body:
25
+ encoding: US-ASCII
26
+ string: ''
27
+ headers:
28
+ Accept:
29
+ - "*/*; q=0.5, application/xml"
30
+ Accept-Encoding:
31
+ - gzip, deflate
32
+ User-Agent:
33
+ - Ruby
34
+ response:
35
+ status:
36
+ code: 200
37
+ message: OK
38
+ headers:
39
+ Content-Type:
40
+ - application/json
41
+ Date:
42
+ - Fri, 08 May 2015 10:35:37 GMT
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: |-
48
+ {
49
+ "kind": "Pod",
50
+ "apiVersion": "v1",
51
+ "metadata": {
52
+ "name": "fabric8-console-controller-98rqc",
53
+ "generateName": "fabric8-console-controller-",
54
+ "namespace": "default",
55
+ "selfLink": "/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc",
56
+ "uid": "c76927af-f563-11e4-b32d-54ee7527188d",
57
+ "resourceVersion": "122",
58
+ "creationTimestamp": "2015-05-08T09:22:42Z",
59
+ "labels": {
60
+ "component": "fabric8Console"
61
+ }
62
+ },
63
+ "spec": {
64
+ "volumes": [
65
+ {
66
+ "name": "openshift-cert-secrets",
67
+ "hostPath": null,
68
+ "emptyDir": null,
69
+ "gcePersistentDisk": null,
70
+ "gitRepo": null,
71
+ "secret": {
72
+ "secretName": "openshift-cert-secrets"
73
+ },
74
+ "nfs": null,
75
+ "iscsi": null,
76
+ "glusterfs": null
77
+ }
78
+ ],
79
+ "containers": [
80
+ {
81
+ "name": "fabric8-console-container",
82
+ "image": "fabric8/hawtio-kubernetes:latest",
83
+ "ports": [
84
+ {
85
+ "containerPort": 9090,
86
+ "protocol": "TCP"
87
+ }
88
+ ],
89
+ "env": [
90
+ {
91
+ "name": "OAUTH_CLIENT_ID",
92
+ "value": "fabric8-console"
93
+ },
94
+ {
95
+ "name": "OAUTH_AUTHORIZE_URI",
96
+ "value": "https://localhost:8443/oauth/authorize"
97
+ }
98
+ ],
99
+ "resources": {},
100
+ "volumeMounts": [
101
+ {
102
+ "name": "openshift-cert-secrets",
103
+ "readOnly": true,
104
+ "mountPath": "/etc/secret-volume"
105
+ }
106
+ ],
107
+ "terminationMessagePath": "/dev/termination-log",
108
+ "imagePullPolicy": "IfNotPresent",
109
+ "capabilities": {}
110
+ }
111
+ ],
112
+ "restartPolicy": "Always",
113
+ "dnsPolicy": "ClusterFirst",
114
+ "nodeName": "jimmi-redhat.localnet"
115
+ },
116
+ "status": {
117
+ "phase": "Running",
118
+ "Condition": [
119
+ {
120
+ "type": "Ready",
121
+ "status": "True"
122
+ }
123
+ ],
124
+ "hostIP": "172.17.42.1",
125
+ "podIP": "172.17.0.8",
126
+ "containerStatuses": [
127
+ {
128
+ "name": "fabric8-console-container",
129
+ "state": {
130
+ "waiting": {
131
+ "reason": "ContainerCreating"
132
+ }
133
+ },
134
+ "lastState": {},
135
+ "ready": true,
136
+ "restartCount": 0,
137
+ "image": "fabric8/hawtio-kubernetes:latest",
138
+ "imageID": ""
139
+ }
140
+ ]
141
+ }
142
+ }
143
+ http_version:
144
+ recorded_at: Fri, 08 May 2015 10:35:37 GMT
145
+ recorded_with: VCR 2.9.3
@@ -165,6 +165,43 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
165
165
  plugin.filter_stream('tag', Fluent::MultiEventStream.new)
166
166
  end
167
167
 
168
+ sub_test_case 'parsing_pod_metadata' do
169
+ test 'when container_status is missing from the pod status' do
170
+ VCR.use_cassettes(
171
+ [
172
+ { name: 'valid_kubernetes_api_server' },
173
+ { name: 'kubernetes_get_api_v1' },
174
+ { name: 'kubernetes_get_namespace_default' },
175
+ { name: 'kubernetes_get_pod_container_init' }
176
+ ]) do
177
+ filtered = emit({}, '
178
+ kubernetes_url https://localhost:8443
179
+ watch false
180
+ cache_size 1
181
+ ')
182
+ expected_kube_metadata = {
183
+ 'docker' => {
184
+ 'container_id' => '49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459'
185
+ },
186
+ 'kubernetes' => {
187
+ 'container_name'=>'fabric8-console-container',
188
+ 'host' => 'jimmi-redhat.localnet',
189
+ 'pod_name' => 'fabric8-console-controller-98rqc',
190
+ 'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
191
+ 'namespace_name' => 'default',
192
+ 'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
193
+ 'pod_ip' => '172.17.0.8',
194
+ 'master_url' => 'https://localhost:8443',
195
+ 'labels' => {
196
+ 'component' => 'fabric8Console'
197
+ }
198
+ }
199
+ }
200
+ assert_equal(expected_kube_metadata, filtered[0])
201
+ end
202
+ end
203
+ end
204
+
168
205
  test 'inability to connect to the api server handles exception and doensnt block pipeline' do
169
206
  VCR.use_cassettes([{ name: 'valid_kubernetes_api_server' }, { name: 'kubernetes_get_api_v1' }]) do
170
207
  driver = create_driver('
@@ -432,13 +469,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
432
469
  assert_equal(msg, filtered[0])
433
470
  end
434
471
 
435
- test 'with kubernetes dotted labels, de_dot enabled' do
472
+ test 'with kubernetes dotted and slashed labels, de_dot and de_slash enabled' do
436
473
  VCR.use_cassettes([{ name: 'valid_kubernetes_api_server' }, { name: 'kubernetes_get_api_v1' },
437
- { name: 'kubernetes_docker_metadata_dotted_labels' }]) do
474
+ { name: 'kubernetes_docker_metadata_dotted_slashed_labels' }]) do
438
475
  filtered = emit({}, '
439
476
  kubernetes_url https://localhost:8443
440
477
  watch false
441
478
  cache_size 1
479
+ de_dot true
480
+ de_slash true
442
481
  ')
443
482
  expected_kube_metadata = {
444
483
  'docker' => {
@@ -452,14 +491,14 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
452
491
  'container_image_id' => 'docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303',
453
492
  'namespace_id' => '898268c8-4a36-11e5-9d81-42010af0194c',
454
493
  'namespace_labels' => {
455
- 'kubernetes_io/namespacetest' => 'somevalue'
494
+ 'kubernetes_io__namespacetest' => 'somevalue'
456
495
  },
457
496
  'namespace_name' => 'default',
458
497
  'pod_id' => 'c76927af-f563-11e4-b32d-54ee7527188d',
459
498
  'pod_ip' => '172.17.0.8',
460
499
  'master_url' => 'https://localhost:8443',
461
500
  'labels' => {
462
- 'kubernetes_io/test' => 'somevalue'
501
+ 'kubernetes_io__test' => 'somevalue'
463
502
  }
464
503
  }
465
504
  }
@@ -467,14 +506,15 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
467
506
  end
468
507
  end
469
508
 
470
- test 'with kubernetes dotted labels, de_dot disabled' do
509
+ test 'with kubernetes dotted and slashed labels, de_dot and de_slash disabled' do
471
510
  VCR.use_cassettes([{ name: 'valid_kubernetes_api_server' }, { name: 'kubernetes_get_api_v1' },
472
- { name: 'kubernetes_docker_metadata_dotted_labels' }]) do
511
+ { name: 'kubernetes_docker_metadata_dotted_slashed_labels' }]) do
473
512
  filtered = emit({}, '
474
513
  kubernetes_url https://localhost:8443
475
514
  watch false
476
515
  cache_size 1
477
516
  de_dot false
517
+ de_slash false
478
518
  ')
479
519
  expected_kube_metadata = {
480
520
  'docker' => {
@@ -506,11 +546,21 @@ class KubernetesMetadataFilterTest < Test::Unit::TestCase
506
546
  test 'invalid de_dot_separator config' do
507
547
  assert_raise Fluent::ConfigError do
508
548
  create_driver('
549
+ de_dot true
509
550
  de_dot_separator contains.
510
551
  ')
511
552
  end
512
553
  end
513
554
 
555
+ test 'invalid de_slash_separator config' do
556
+ assert_raise Fluent::ConfigError do
557
+ create_driver('
558
+ de_slash true
559
+ de_slash_separator contains/
560
+ ')
561
+ end
562
+ end
563
+
514
564
  test 'with records from journald and docker & kubernetes metadata' do
515
565
  # with use_journal true should ignore tags and use CONTAINER_NAME and CONTAINER_ID_FULL
516
566
  tag = 'var.log.containers.junk1_junk2_junk3-49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed450.log'
@@ -69,6 +69,8 @@ class WatchTest < Test::Unit::TestCase
69
69
 
70
70
  def logger.error(message, error)
71
71
  end
72
+ def logger.warn(message)
73
+ end
72
74
  logger
73
75
  end
74
76
  end
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.8.0
4
+ version: 2.9.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: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: kubeclient
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 4.0.0
37
40
  - - "<"
38
41
  - !ruby/object:Gem::Version
39
- version: '5'
42
+ version: 5.0.0
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 4.0.0
44
50
  - - "<"
45
51
  - !ruby/object:Gem::Version
46
- version: '5'
52
+ version: 5.0.0
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: lru_redux
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -224,12 +230,13 @@ files:
224
230
  - lib/fluent/plugin/kubernetes_metadata_watch_pods.rb
225
231
  - test/cassettes/invalid_api_server_config.yml
226
232
  - test/cassettes/kubernetes_docker_metadata_annotations.yml
227
- - test/cassettes/kubernetes_docker_metadata_dotted_labels.yml
233
+ - test/cassettes/kubernetes_docker_metadata_dotted_slashed_labels.yml
228
234
  - test/cassettes/kubernetes_get_api_v1.yml
229
235
  - test/cassettes/kubernetes_get_api_v1_using_token.yml
230
236
  - test/cassettes/kubernetes_get_namespace_default.yml
231
237
  - test/cassettes/kubernetes_get_namespace_default_using_token.yml
232
238
  - test/cassettes/kubernetes_get_pod.yml
239
+ - test/cassettes/kubernetes_get_pod_container_init.yml
233
240
  - test/cassettes/kubernetes_get_pod_using_token.yml
234
241
  - test/cassettes/metadata_from_tag_and_journald_fields.yml
235
242
  - test/cassettes/metadata_from_tag_journald_and_kubernetes_fields.yml
@@ -263,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
270
  - !ruby/object:Gem::Version
264
271
  version: '0'
265
272
  requirements: []
266
- rubygems_version: 3.1.4
273
+ rubygems_version: 3.0.9
267
274
  signing_key:
268
275
  specification_version: 4
269
276
  summary: Fluentd filter plugin to add Kubernetes metadata