Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0cbba60

Browse files
authoredMar 29, 2022
1.1.11 (#88)
1 parent 44e3e88 commit 0cbba60

File tree

12 files changed

+1079
-27
lines changed

12 files changed

+1079
-27
lines changed
 

‎Gemfile.lock

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
PATH
22
remote: .
33
specs:
4-
fluent-plugin-kubernetes-objects (1.1.10)
4+
fluent-plugin-kubernetes-objects (1.1.11)
55
fluentd (>= 1.9.1)
66
http_parser.rb (= 0.5.3)
7-
kubeclient (~> 4.6.0)
7+
kubeclient (~> 4.9.3)
88

99
GEM
1010
remote: https://rubygems.org/
1111
specs:
1212
addressable (2.8.0)
1313
public_suffix (>= 2.0.2, < 5.0)
14-
concurrent-ruby (1.1.9)
14+
concurrent-ruby (1.1.10)
1515
cool.io (1.7.1)
1616
crack (0.4.5)
1717
rexml
@@ -22,12 +22,12 @@ GEM
2222
ffi-compiler (1.0.1)
2323
ffi (>= 1.0.0)
2424
rake
25-
fluentd (1.14.4)
25+
fluentd (1.14.5)
2626
bundler
2727
cool.io (>= 1.4.5, < 2.0.0)
2828
http_parser.rb (>= 0.5.1, < 0.9.0)
2929
msgpack (>= 1.3.1, < 2.0.0)
30-
serverengine (>= 2.2.2, < 3.0.0)
30+
serverengine (>= 2.2.5, < 3.0.0)
3131
sigdump (~> 0.2.2)
3232
strptime (>= 0.2.4, < 1.0.0)
3333
tzinfo (>= 1.0, < 3.0)
@@ -47,15 +47,19 @@ GEM
4747
http-parser (1.2.3)
4848
ffi-compiler (>= 1.0, < 2.0)
4949
http_parser.rb (0.5.3)
50-
kubeclient (4.6.0)
50+
jsonpath (1.1.0)
51+
multi_json
52+
kubeclient (4.9.3)
5153
http (>= 3.0, < 5.0)
52-
recursive-open-struct (~> 1.0, >= 1.0.4)
54+
jsonpath (~> 1.0)
55+
recursive-open-struct (~> 1.1, >= 1.1.1)
5356
rest-client (~> 2.0)
5457
mime-types (3.4.1)
5558
mime-types-data (~> 3.2015)
5659
mime-types-data (3.2022.0105)
5760
minitest (5.14.4)
58-
msgpack (1.4.4)
61+
msgpack (1.4.5)
62+
multi_json (1.15.0)
5963
netrc (0.11.0)
6064
power_assert (2.0.1)
6165
public_suffix (4.0.6)
@@ -81,11 +85,11 @@ GEM
8185
power_assert
8286
tzinfo (2.0.4)
8387
concurrent-ruby (~> 1.0)
84-
tzinfo-data (1.2021.5)
88+
tzinfo-data (1.2022.1)
8589
tzinfo (>= 1.0.0)
8690
unf (0.1.4)
8791
unf_ext
88-
unf_ext (0.0.8)
92+
unf_ext (0.0.8.1)
8993
webmock (3.14.0)
9094
addressable (>= 2.8.0)
9195
crack (>= 0.3.2)
@@ -106,4 +110,4 @@ DEPENDENCIES
106110
webmock (~> 3.5)
107111

108112
BUNDLED WITH
109-
2.2.30
113+
2.2.32

‎VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.10
1+
1.1.11

‎docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN yum update -y \
4343
&& bundle install \
4444
&& bundle update i18n \
4545
&& gem uninstall -i /usr/share/gems i18n --version 1.8.11 \
46-
&& rpm -e --nodeps python3-pip-wheel python3-urllib3-* python3-requests-* python3-libxml2-* python3-dmidecode-* subscription-manager-* libwebp-* libwebp-devel-* glib2-* libjpeg-turbo-devel-* libjpeg-turbo-* mariadb-connector-c-config-* mariadb-connector-c-* mariadb-connector-c-devel-* rsync-* sqlite-libs-* sqlite-devel-* sqlite-* libxml2-* libxml2-devel-* libX11-* libX11-common-* libX11-devel-* libX11-xcb-* nettle-* libsolv-* file-libs-* dbus-daemon-* tar-* qt5-srpm-macros-* perl-parent-* git-* bsdtar-* openssh-clients-* json-c-* binutils-* libtiff-devel-* libtiff-* || true
46+
&& rpm -e --nodeps python3-pip-wheel python3-urllib3-* python3-requests-* python3-libxml2-* python3-dmidecode-* subscription-manager-* libwebp-* libwebp-devel-* libjpeg-turbo-devel-* libjpeg-turbo-* mariadb-connector-c-config-* mariadb-connector-c-* mariadb-connector-c-devel-* rsync-* libX11-* libX11-common-* libX11-devel-* libX11-xcb-* dbus-daemon-* tar-* qt5-srpm-macros-* perl-parent-* git-* bsdtar-* openssh-clients-* binutils-* libtiff-devel-* libtiff-* || true
4747

4848
RUN groupadd -r $FLUENT_USER && \
4949
useradd -r -g $FLUENT_USER $FLUENT_USER && \

‎docker/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem "fluent-plugin-jq", "= 0.5.1"
1111
gem "oj", "= 3.10.18"
1212
gem 'multi_json', '>= 1.14.1'
1313
gem 'bigdecimal', '>= 2.0.0'
14-
gem 'kubeclient', '>= 4.6.0'
14+
gem 'kubeclient', '>= 4.9.3'
1515
gem 'http_parser.rb', '>= 0.5.3'
1616

1717
gem "fluent-plugin-splunk-hec", ">= 1.2.5"

‎docker/Gemfile.lock

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
PATH
22
remote: gem
33
specs:
4-
fluent-plugin-kubernetes-objects (1.1.10)
4+
fluent-plugin-kubernetes-objects (1.1.11)
55
fluentd (>= 1.9.1)
66
http_parser.rb (= 0.5.3)
7-
kubeclient (~> 4.6.0)
7+
kubeclient (~> 4.9.3)
88

99
GEM
1010
remote: https://rubygems.org/
@@ -27,7 +27,7 @@ GEM
2727
cool.io (1.7.1)
2828
domain_name (0.5.20190701)
2929
unf (>= 0.0.5, < 1.0.0)
30-
ffi (1.15.4)
30+
ffi (1.15.5)
3131
ffi-compiler (1.0.1)
3232
ffi (>= 1.0.0)
3333
rake
@@ -43,7 +43,7 @@ GEM
4343
prometheus-client (>= 2.1.0)
4444
fluent-plugin-record-modifier (2.1.0)
4545
fluentd (>= 1.0, < 2)
46-
fluent-plugin-splunk-hec (1.2.11)
46+
fluent-plugin-splunk-hec (1.2.12)
4747
fluentd (>= 1.4)
4848
multi_json (~> 1.13)
4949
net-http-persistent (~> 3.1)
@@ -80,16 +80,19 @@ GEM
8080
activesupport (>= 4.2)
8181
aes_key_wrap
8282
bindata
83-
kubeclient (4.6.0)
83+
jsonpath (1.1.0)
84+
multi_json
85+
kubeclient (4.9.3)
8486
http (>= 3.0, < 5.0)
85-
recursive-open-struct (~> 1.0, >= 1.0.4)
87+
jsonpath (~> 1.0)
88+
recursive-open-struct (~> 1.1, >= 1.1.1)
8689
rest-client (~> 2.0)
8790
lru_redux (1.1.0)
8891
mail (2.7.1)
8992
mini_mime (>= 0.1.1)
9093
mime-types (3.4.1)
9194
mime-types-data (~> 3.2015)
92-
mime-types-data (3.2021.1115)
95+
mime-types-data (3.2022.0105)
9396
mini_mime (1.1.2)
9497
minitest (5.15.0)
9598
msgpack (1.4.2)
@@ -138,7 +141,7 @@ GEM
138141
tzinfo (>= 1.0.0)
139142
unf (0.1.4)
140143
unf_ext
141-
unf_ext (0.0.8)
144+
unf_ext (0.0.8.1)
142145
validate_email (0.1.6)
143146
activemodel (>= 3.0)
144147
mail (>= 2.2.5)
@@ -164,7 +167,7 @@ DEPENDENCIES
164167
fluent-plugin-splunk-hec (>= 1.2.5)
165168
fluentd (>= 1.14.2)
166169
http_parser.rb (>= 0.5.3)
167-
kubeclient (>= 4.6.0)
170+
kubeclient (>= 4.9.3)
168171
multi_json (>= 1.14.1)
169172
oj (= 3.10.18)
170173

‎fluent-plugin-kubernetes-objects.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
2222
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2323
spec.required_ruby_version = '>= 2.3.0'
2424
spec.add_runtime_dependency 'fluentd', '>= 1.9.1'
25-
spec.add_runtime_dependency 'kubeclient', '~> 4.6.0'
25+
spec.add_runtime_dependency 'kubeclient', '~> 4.9.3'
2626
spec.add_runtime_dependency 'http_parser.rb', '= 0.5.3'
2727

2828
spec.add_development_dependency 'bundler', '~> 2.0'

‎lib/fluent/plugin/in_kubernetes_objects.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class KubernetesObjectsInput < Fluent::Plugin::Input
2020
desc 'Kubernetes API version.'
2121
config_param :api_version, :string, default: 'v1'
2222

23+
desc 'Kubernetes API endpoint.'
24+
config_param :api_endpoint, :string, default: 'api'
25+
2326
desc 'Path to the certificate file for this client.'
2427
config_param :client_cert, :string, default: nil
2528

@@ -139,7 +142,7 @@ def initialize_client
139142
env_host = ENV['KUBERNETES_SERVICE_HOST']
140143
env_port = ENV['KUBERNETES_SERVICE_PORT']
141144
if env_host && env_port
142-
@kubernetes_url = "https://#{env_host}:#{env_port}/#{@api_version == 'v1' ? 'api' : 'apis'}"
145+
@kubernetes_url = "https://#{env_host}:#{env_port}/#{@api_endpoint.delete_prefix('/')}"
143146
end
144147
end
145148

‎test/apps-v1-namespace.json

Lines changed: 806 additions & 0 deletions
Large diffs are not rendered by default.

‎test/apps-v1.json

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
{
2+
"kind": "APIResourceList",
3+
"apiVersion": "v1",
4+
"groupVersion": "apps/v1",
5+
"resources": [
6+
{
7+
"name": "controllerrevisions",
8+
"singularName": "",
9+
"namespaced": true,
10+
"kind": "ControllerRevision",
11+
"verbs": [
12+
"create",
13+
"delete",
14+
"deletecollection",
15+
"get",
16+
"list",
17+
"patch",
18+
"update",
19+
"watch"
20+
],
21+
"storageVersionHash": "85nkx63pcBU="
22+
},
23+
{
24+
"name": "daemonsets",
25+
"singularName": "",
26+
"namespaced": true,
27+
"kind": "DaemonSet",
28+
"verbs": [
29+
"create",
30+
"delete",
31+
"deletecollection",
32+
"get",
33+
"list",
34+
"patch",
35+
"update",
36+
"watch"
37+
],
38+
"shortNames": [
39+
"ds"
40+
],
41+
"categories": [
42+
"all"
43+
],
44+
"storageVersionHash": "dd7pWHUlMKQ="
45+
},
46+
{
47+
"name": "daemonsets/status",
48+
"singularName": "",
49+
"namespaced": true,
50+
"kind": "DaemonSet",
51+
"verbs": [
52+
"get",
53+
"patch",
54+
"update"
55+
]
56+
},
57+
{
58+
"name": "deployments",
59+
"singularName": "",
60+
"namespaced": true,
61+
"kind": "Deployment",
62+
"verbs": [
63+
"create",
64+
"delete",
65+
"deletecollection",
66+
"get",
67+
"list",
68+
"patch",
69+
"update",
70+
"watch"
71+
],
72+
"shortNames": [
73+
"deploy"
74+
],
75+
"categories": [
76+
"all"
77+
],
78+
"storageVersionHash": "8aSe+NMegvE="
79+
},
80+
{
81+
"name": "deployments/scale",
82+
"singularName": "",
83+
"namespaced": true,
84+
"group": "autoscaling",
85+
"version": "v1",
86+
"kind": "Scale",
87+
"verbs": [
88+
"get",
89+
"patch",
90+
"update"
91+
]
92+
},
93+
{
94+
"name": "deployments/status",
95+
"singularName": "",
96+
"namespaced": true,
97+
"kind": "Deployment",
98+
"verbs": [
99+
"get",
100+
"patch",
101+
"update"
102+
]
103+
},
104+
{
105+
"name": "replicasets",
106+
"singularName": "",
107+
"namespaced": true,
108+
"kind": "ReplicaSet",
109+
"verbs": [
110+
"create",
111+
"delete",
112+
"deletecollection",
113+
"get",
114+
"list",
115+
"patch",
116+
"update",
117+
"watch"
118+
],
119+
"shortNames": [
120+
"rs"
121+
],
122+
"categories": [
123+
"all"
124+
],
125+
"storageVersionHash": "P1RzHs8/mWQ="
126+
},
127+
{
128+
"name": "replicasets/scale",
129+
"singularName": "",
130+
"namespaced": true,
131+
"group": "autoscaling",
132+
"version": "v1",
133+
"kind": "Scale",
134+
"verbs": [
135+
"get",
136+
"patch",
137+
"update"
138+
]
139+
},
140+
{
141+
"name": "replicasets/status",
142+
"singularName": "",
143+
"namespaced": true,
144+
"kind": "ReplicaSet",
145+
"verbs": [
146+
"get",
147+
"patch",
148+
"update"
149+
]
150+
},
151+
{
152+
"name": "statefulsets",
153+
"singularName": "",
154+
"namespaced": true,
155+
"kind": "StatefulSet",
156+
"verbs": [
157+
"create",
158+
"delete",
159+
"deletecollection",
160+
"get",
161+
"list",
162+
"patch",
163+
"update",
164+
"watch"
165+
],
166+
"shortNames": [
167+
"sts"
168+
],
169+
"categories": [
170+
"all"
171+
],
172+
"storageVersionHash": "H+vl74LkKdo="
173+
},
174+
{
175+
"name": "statefulsets/scale",
176+
"singularName": "",
177+
"namespaced": true,
178+
"group": "autoscaling",
179+
"version": "v1",
180+
"kind": "Scale",
181+
"verbs": [
182+
"get",
183+
"patch",
184+
"update"
185+
]
186+
},
187+
{
188+
"name": "statefulsets/status",
189+
"singularName": "",
190+
"namespaced": true,
191+
"kind": "StatefulSet",
192+
"verbs": [
193+
"get",
194+
"patch",
195+
"update"
196+
]
197+
}
198+
]
199+
}

‎test/apps.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"kind": "APIGroup",
3+
"apiVersion": "v1",
4+
"name": "apps",
5+
"versions": [
6+
{
7+
"groupVersion": "apps/v1",
8+
"version": "v1"
9+
}
10+
],
11+
"preferredVersion": {
12+
"groupVersion": "apps/v1",
13+
"version": "v1"
14+
}
15+
}

‎test/fluent/plugin/in_kubernetes_objects_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@
5757
puts 'Test: should use pick the right path'
5858
ENV['KUBERNETES_SERVICE_HOST'] = k8s_host
5959
ENV['KUBERNETES_SERVICE_PORT'] = k8s_port
60-
expect(create_input_driver(<<~CONF).instance.kubernetes_url).must_equal k8s_url('apis')
61-
api_version apps/v1
60+
expect(create_input_driver(<<~CONF).instance.kubernetes_url).must_equal k8s_url('apis/apps')
61+
api_endpoint apis/apps
62+
api_version v1
6263
<pull>
6364
resource_name deployments
6465
</pull>

‎test/test_helper.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def stub_k8s_requests
5454
stub_k8s_nodes
5555
stub_k8s_pods
5656
stub_k8s_events
57+
stub_k8s_apps
58+
stub_k8s_apps_v1
59+
stub_k8s_apps_v1_namespace
5760
end
5861

5962
def stub_k8s_api
@@ -68,6 +71,24 @@ def stub_k8s_apis
6871
end.close
6972
end
7073

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+
7192
def stub_k8s_v1
7293
File.open(File.expand_path('v1.json', __dir__)).tap do |f|
7394
stub_request(:get, "#{k8s_url}/v1").to_return(body: f.read)

0 commit comments

Comments
 (0)
Please sign in to comment.