fluent-plugin-kubernetes-objects 1.1.8 → 1.1.11
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/Gemfile.lock +20 -16
- data/VERSION +1 -1
- data/fluent-plugin-kubernetes-objects.gemspec +1 -1
- data/lib/fluent/plugin/in_kubernetes_objects.rb +28 -15
- data/test/fluent/plugin/in_kubernetes_objects_test.rb +26 -2
- data/test/test_helper.rb +21 -0
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 168ae6862575cb688a5ace5531696af279ddd206aebcbf766ce180db6701455d
|
|
4
|
+
data.tar.gz: 101051ee22a5f01605ce41d7ad6a061df76bcccc35c972c478a7423620f205d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd2f8d7394710699313059decd82ad47070dca1af377a6b27b4f08f697eb236c1282e2a84e74c9ffb0671d6b5e7185d241c35327ec93ebf0419a77a9fd30b5f8
|
|
7
|
+
data.tar.gz: '09e3862f49c87309ab218364d7762ce6b88c2c6731ceb40225637021946fdb2388040bd85c7a4dad4fb0efeea975eff81588d30e2bf94ee4505a60d39fc212f9'
|
data/Gemfile.lock
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fluent-plugin-kubernetes-objects (1.1.
|
|
4
|
+
fluent-plugin-kubernetes-objects (1.1.11)
|
|
5
5
|
fluentd (>= 1.9.1)
|
|
6
6
|
http_parser.rb (= 0.5.3)
|
|
7
|
-
kubeclient (~> 4.
|
|
7
|
+
kubeclient (~> 4.9.3)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
12
|
addressable (2.8.0)
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
|
14
|
-
concurrent-ruby (1.1.
|
|
14
|
+
concurrent-ruby (1.1.10)
|
|
15
15
|
cool.io (1.7.1)
|
|
16
16
|
crack (0.4.5)
|
|
17
17
|
rexml
|
|
18
18
|
docile (1.4.0)
|
|
19
19
|
domain_name (0.5.20190701)
|
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
|
21
|
-
ffi (1.15.
|
|
21
|
+
ffi (1.15.5)
|
|
22
22
|
ffi-compiler (1.0.1)
|
|
23
23
|
ffi (>= 1.0.0)
|
|
24
24
|
rake
|
|
25
|
-
fluentd (1.14.
|
|
25
|
+
fluentd (1.14.5)
|
|
26
26
|
bundler
|
|
27
27
|
cool.io (>= 1.4.5, < 2.0.0)
|
|
28
|
-
http_parser.rb (>= 0.5.1, < 0.
|
|
28
|
+
http_parser.rb (>= 0.5.1, < 0.9.0)
|
|
29
29
|
msgpack (>= 1.3.1, < 2.0.0)
|
|
30
|
-
serverengine (>= 2.2.
|
|
30
|
+
serverengine (>= 2.2.5, < 3.0.0)
|
|
31
31
|
sigdump (~> 0.2.2)
|
|
32
32
|
strptime (>= 0.2.4, < 1.0.0)
|
|
33
33
|
tzinfo (>= 1.0, < 3.0)
|
|
@@ -47,15 +47,19 @@ GEM
|
|
|
47
47
|
http-parser (1.2.3)
|
|
48
48
|
ffi-compiler (>= 1.0, < 2.0)
|
|
49
49
|
http_parser.rb (0.5.3)
|
|
50
|
-
|
|
50
|
+
jsonpath (1.1.0)
|
|
51
|
+
multi_json
|
|
52
|
+
kubeclient (4.9.3)
|
|
51
53
|
http (>= 3.0, < 5.0)
|
|
52
|
-
|
|
54
|
+
jsonpath (~> 1.0)
|
|
55
|
+
recursive-open-struct (~> 1.1, >= 1.1.1)
|
|
53
56
|
rest-client (~> 2.0)
|
|
54
|
-
mime-types (3.
|
|
57
|
+
mime-types (3.4.1)
|
|
55
58
|
mime-types-data (~> 3.2015)
|
|
56
|
-
mime-types-data (3.
|
|
59
|
+
mime-types-data (3.2022.0105)
|
|
57
60
|
minitest (5.14.4)
|
|
58
|
-
msgpack (1.4.
|
|
61
|
+
msgpack (1.4.5)
|
|
62
|
+
multi_json (1.15.0)
|
|
59
63
|
netrc (0.11.0)
|
|
60
64
|
power_assert (2.0.1)
|
|
61
65
|
public_suffix (4.0.6)
|
|
@@ -67,7 +71,7 @@ GEM
|
|
|
67
71
|
mime-types (>= 1.16, < 4.0)
|
|
68
72
|
netrc (~> 0.8)
|
|
69
73
|
rexml (3.2.5)
|
|
70
|
-
serverengine (2.2.
|
|
74
|
+
serverengine (2.2.5)
|
|
71
75
|
sigdump (~> 0.2.2)
|
|
72
76
|
sigdump (0.2.4)
|
|
73
77
|
simplecov (0.21.2)
|
|
@@ -81,11 +85,11 @@ GEM
|
|
|
81
85
|
power_assert
|
|
82
86
|
tzinfo (2.0.4)
|
|
83
87
|
concurrent-ruby (~> 1.0)
|
|
84
|
-
tzinfo-data (1.
|
|
88
|
+
tzinfo-data (1.2022.1)
|
|
85
89
|
tzinfo (>= 1.0.0)
|
|
86
90
|
unf (0.1.4)
|
|
87
91
|
unf_ext
|
|
88
|
-
unf_ext (0.0.8)
|
|
92
|
+
unf_ext (0.0.8.1)
|
|
89
93
|
webmock (3.14.0)
|
|
90
94
|
addressable (>= 2.8.0)
|
|
91
95
|
crack (>= 0.3.2)
|
|
@@ -106,4 +110,4 @@ DEPENDENCIES
|
|
|
106
110
|
webmock (~> 3.5)
|
|
107
111
|
|
|
108
112
|
BUNDLED WITH
|
|
109
|
-
2.
|
|
113
|
+
2.3.10
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.11
|
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
23
|
spec.required_ruby_version = '>= 2.3.0'
|
|
24
24
|
spec.add_runtime_dependency 'fluentd', '>= 1.9.1'
|
|
25
|
-
spec.add_runtime_dependency 'kubeclient', '~> 4.
|
|
25
|
+
spec.add_runtime_dependency 'kubeclient', '~> 4.9.3'
|
|
26
26
|
spec.add_runtime_dependency 'http_parser.rb', '= 0.5.3'
|
|
27
27
|
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
@@ -20,6 +20,9 @@ module Fluent::Plugin
|
|
|
20
20
|
desc 'Kubernetes API version.'
|
|
21
21
|
config_param :api_version, :string, default: 'v1'
|
|
22
22
|
|
|
23
|
+
desc 'Kubernetes API endpoint.'
|
|
24
|
+
config_param :api_endpoint, :string, default: 'api'
|
|
25
|
+
|
|
23
26
|
desc 'Path to the certificate file for this client.'
|
|
24
27
|
config_param :client_cert, :string, default: nil
|
|
25
28
|
|
|
@@ -139,7 +142,7 @@ module Fluent::Plugin
|
|
|
139
142
|
env_host = ENV['KUBERNETES_SERVICE_HOST']
|
|
140
143
|
env_port = ENV['KUBERNETES_SERVICE_PORT']
|
|
141
144
|
if env_host && env_port
|
|
142
|
-
@kubernetes_url = "https://#{env_host}:#{env_port}/#{@
|
|
145
|
+
@kubernetes_url = "https://#{env_host}:#{env_port}/#{@api_endpoint.delete_prefix('/')}"
|
|
143
146
|
end
|
|
144
147
|
end
|
|
145
148
|
|
|
@@ -200,7 +203,12 @@ module Fluent::Plugin
|
|
|
200
203
|
tag = generate_tag resource_name
|
|
201
204
|
while thread_current_running?
|
|
202
205
|
log.debug "Going to pull #{resource_name}"
|
|
203
|
-
|
|
206
|
+
begin
|
|
207
|
+
response = @client.public_send "get_#{resource_name}", options
|
|
208
|
+
rescue Kubeclient::ResourceNotFoundError, NoMethodError
|
|
209
|
+
log.error "resource '#{resource_name}' not found. Stopped pulling it"
|
|
210
|
+
break
|
|
211
|
+
end
|
|
204
212
|
now = Fluent::Engine.now
|
|
205
213
|
es = Fluent::MultiEventStream.new
|
|
206
214
|
|
|
@@ -243,22 +251,27 @@ module Fluent::Plugin
|
|
|
243
251
|
|
|
244
252
|
thread_create :"watch_#{resource_name}" do
|
|
245
253
|
while thread_current_running?
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
begin
|
|
255
|
+
@client.public_send("watch_#{resource_name}", options).tap do |watcher|
|
|
256
|
+
tag = generate_tag "#{resource_name}"
|
|
257
|
+
begin
|
|
258
|
+
watcher.each do |entity|
|
|
259
|
+
begin
|
|
260
|
+
entity = JSON.parse(entity)
|
|
261
|
+
router.emit tag, Fluent::Engine.now, entity
|
|
262
|
+
options[:resource_version] = entity['object']['metadata']['resourceVersion']
|
|
263
|
+
@storage.put resource_name, entity['object']['metadata']['resourceVersion']
|
|
264
|
+
rescue => e
|
|
265
|
+
log.info "Got exception #{e} parsing entity #{entity}. Resetting watcher."
|
|
266
|
+
end
|
|
257
267
|
end
|
|
268
|
+
rescue => e
|
|
269
|
+
log.info "Got exception #{e}. Resetting watcher."
|
|
258
270
|
end
|
|
259
|
-
rescue => e
|
|
260
|
-
log.info "Got exception #{e}. Resetting watcher."
|
|
261
271
|
end
|
|
272
|
+
rescue Kubeclient::ResourceNotFoundError, NoMethodError
|
|
273
|
+
log.error "resource '#{resource_name}' not found. Stopped watching it"
|
|
274
|
+
break
|
|
262
275
|
end
|
|
263
276
|
end
|
|
264
277
|
end
|
|
@@ -57,8 +57,9 @@ describe Fluent::Plugin::KubernetesObjectsInput do
|
|
|
57
57
|
puts 'Test: should use pick the right path'
|
|
58
58
|
ENV['KUBERNETES_SERVICE_HOST'] = k8s_host
|
|
59
59
|
ENV['KUBERNETES_SERVICE_PORT'] = k8s_port
|
|
60
|
-
expect(create_input_driver(<<~CONF).instance.kubernetes_url).must_equal k8s_url('apis')
|
|
61
|
-
|
|
60
|
+
expect(create_input_driver(<<~CONF).instance.kubernetes_url).must_equal k8s_url('apis/apps')
|
|
61
|
+
api_endpoint apis/apps
|
|
62
|
+
api_version v1
|
|
62
63
|
<pull>
|
|
63
64
|
resource_name deployments
|
|
64
65
|
</pull>
|
|
@@ -144,5 +145,28 @@ describe Fluent::Plugin::KubernetesObjectsInput do
|
|
|
144
145
|
f.unlink
|
|
145
146
|
end
|
|
146
147
|
end
|
|
148
|
+
it "checks for invalid pull request" do
|
|
149
|
+
d = create_input_driver(<<~CONF)
|
|
150
|
+
kubernetes_url #{k8s_url}
|
|
151
|
+
<pull>
|
|
152
|
+
resource_name fakeResource
|
|
153
|
+
</pull>
|
|
154
|
+
CONF
|
|
155
|
+
|
|
156
|
+
d.run expect_emits: 0, timeout: 3
|
|
157
|
+
|
|
158
|
+
expect(d.logs.any? { |log| log.include? "resource 'fakeResource' not found." }).must_equal(true)
|
|
159
|
+
end
|
|
160
|
+
it "checks for invalid watch request" do
|
|
161
|
+
d = create_input_driver(<<~CONF)
|
|
162
|
+
kubernetes_url #{k8s_url}
|
|
163
|
+
<watch>
|
|
164
|
+
resource_name fakeResource
|
|
165
|
+
</watch>
|
|
166
|
+
CONF
|
|
167
|
+
|
|
168
|
+
d.run expect_emits: 0, timeout: 3
|
|
169
|
+
expect(d.logs.any? { |log| log.include? "resource 'fakeResource' not found." }).must_equal(true)
|
|
170
|
+
end
|
|
147
171
|
end
|
|
148
172
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -54,6 +54,9 @@ module PluginTestHelper
|
|
|
54
54
|
stub_k8s_nodes
|
|
55
55
|
stub_k8s_pods
|
|
56
56
|
stub_k8s_events
|
|
57
|
+
stub_k8s_apps
|
|
58
|
+
stub_k8s_apps_v1
|
|
59
|
+
stub_k8s_apps_v1_namespace
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
def stub_k8s_api
|
|
@@ -68,6 +71,24 @@ module PluginTestHelper
|
|
|
68
71
|
end.close
|
|
69
72
|
end
|
|
70
73
|
|
|
74
|
+
def stub_k8s_apps
|
|
75
|
+
File.open(File.expand_path('apps.json', __dir__)).tap do |f|
|
|
76
|
+
stub_request(:get, k8s_url('apis/apps')).to_return(body: f.read)
|
|
77
|
+
end.close
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def stub_k8s_apps_v1
|
|
81
|
+
File.open(File.expand_path('apps-v1.json', __dir__)).tap do |f|
|
|
82
|
+
stub_request(:get, k8s_url('apis/apps/v1')).to_return(body: f.read)
|
|
83
|
+
end.close
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def stub_k8s_apps_v1_namespace
|
|
87
|
+
File.open(File.expand_path('apps-v1-namespace.json', __dir__)).tap do |f|
|
|
88
|
+
stub_request(:get, k8s_url('apis/apps')).to_return(body: f.read)
|
|
89
|
+
end.close
|
|
90
|
+
end
|
|
91
|
+
|
|
71
92
|
def stub_k8s_v1
|
|
72
93
|
File.open(File.expand_path('v1.json', __dir__)).tap do |f|
|
|
73
94
|
stub_request(:get, "#{k8s_url}/v1").to_return(body: f.read)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-kubernetes-objects
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Splunk Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 4.
|
|
33
|
+
version: 4.9.3
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 4.
|
|
40
|
+
version: 4.9.3
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: http_parser.rb
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -172,12 +172,12 @@ signing_key:
|
|
|
172
172
|
specification_version: 4
|
|
173
173
|
summary: Fluentd Plugin for Kubernetes Objects.
|
|
174
174
|
test_files:
|
|
175
|
-
- test/test_helper.rb
|
|
176
175
|
- test/fluent/plugin/in_kubernetes_objects_test.rb
|
|
177
|
-
- test/
|
|
176
|
+
- test/test_helper.rb
|
|
178
177
|
- test/lib/no_webmock/http_lib_adapters/httpclient_adapter.rb
|
|
178
|
+
- test/lib/no_webmock/http_lib_adapters/excon_adapter.rb
|
|
179
179
|
- test/lib/no_webmock/http_lib_adapters/em_http_request_adapter.rb
|
|
180
180
|
- test/lib/no_webmock/http_lib_adapters/typhoeus_hydra_adapter.rb
|
|
181
181
|
- test/lib/no_webmock/http_lib_adapters/manticore_adapter.rb
|
|
182
|
-
- test/lib/no_webmock/http_lib_adapters/
|
|
182
|
+
- test/lib/no_webmock/http_lib_adapters/curb_adapter.rb
|
|
183
183
|
- test/lib/no_webmock/http_lib_adapters/patron_adapter.rb
|