Skip to content

Commit b5ecf56

Browse files
authored
Merge pull request #132 from splunk/develop
1.2.0
2 parents 76f7c12 + 9a5ad2c commit b5ecf56

File tree

9 files changed

+100
-57
lines changed

9 files changed

+100
-57
lines changed

.fossa.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: 3
2+
server: https://app.fossa.com
3+
project:
4+
id: "fluent-plugin-kubernetes-metrics"
5+
team: "TA-Automation"

.github/workflows/ci_build_test.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,36 @@ jobs:
194194
--splunk-password $CI_SPLUNK_PASSWORD \
195195
--nodes-count $MINIKUBE_NODE_COUNTS\
196196
-p no:warnings -s -n auto
197+
fossa-scan:
198+
continue-on-error: true
199+
runs-on: ubuntu-latest
200+
steps:
201+
- uses: actions/checkout@v3
202+
- name: run fossa anlyze and create report
203+
run: |
204+
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
205+
fossa analyze --include-unused-deps --debug
206+
fossa report attribution --format text > /tmp/THIRDPARTY
207+
env:
208+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
209+
- name: upload THIRDPARTY file
210+
uses: actions/upload-artifact@v2
211+
with:
212+
name: THIRDPARTY
213+
path: /tmp/THIRDPARTY
214+
- name: run fossa test
215+
run: |
216+
fossa test --debug
217+
env:
218+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
219+
semgrep:
220+
runs-on: ubuntu-latest
221+
name: security-sast-semgrep
222+
if: github.actor != 'dependabot[bot]'
223+
steps:
224+
- uses: actions/checkout@v3
225+
- name: Semgrep
226+
id: semgrep
227+
uses: returntocorp/semgrep-action@v1
228+
with:
229+
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}

Gemfile.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
PATH
22
remote: .
33
specs:
4-
fluent-plugin-kubernetes-metrics (1.1.12)
4+
fluent-plugin-kubernetes-metrics (1.2.0)
55
fluentd (>= 1.9.1)
66
kubeclient (~> 4.9.3)
7-
multi_json (~> 1.14.1)
8-
oj (~> 3.10.2)
7+
multi_json (~> 1.14)
8+
oj (~> 3.10)
99

1010
GEM
1111
remote: https://rubygems.org/
@@ -23,12 +23,12 @@ GEM
2323
ffi-compiler (1.0.1)
2424
ffi (>= 1.0.0)
2525
rake
26-
fluentd (1.14.6)
26+
fluentd (1.15.1)
2727
bundler
2828
cool.io (>= 1.4.5, < 2.0.0)
2929
http_parser.rb (>= 0.5.1, < 0.9.0)
3030
msgpack (>= 1.3.1, < 2.0.0)
31-
serverengine (>= 2.2.5, < 3.0.0)
31+
serverengine (>= 2.3.0, < 3.0.0)
3232
sigdump (~> 0.2.2)
3333
strptime (>= 0.2.4, < 1.0.0)
3434
tzinfo (>= 1.0, < 3.0)
@@ -42,14 +42,14 @@ GEM
4242
http-form_data (~> 2.2)
4343
http-parser (~> 1.2.0)
4444
http-accept (1.7.0)
45-
http-cookie (1.0.4)
45+
http-cookie (1.0.5)
4646
domain_name (~> 0.5)
4747
http-form_data (2.3.0)
4848
http-parser (1.2.3)
4949
ffi-compiler (>= 1.0, < 2.0)
5050
http_parser.rb (0.8.0)
5151
json (2.6.1)
52-
jsonpath (1.1.0)
52+
jsonpath (1.1.2)
5353
multi_json
5454
kubeclient (4.9.3)
5555
http (>= 3.0, < 5.0)
@@ -59,10 +59,10 @@ GEM
5959
mime-types (3.4.1)
6060
mime-types-data (~> 3.2015)
6161
mime-types-data (3.2022.0105)
62-
msgpack (1.5.1)
63-
multi_json (1.14.1)
62+
msgpack (1.5.4)
63+
multi_json (1.15.0)
6464
netrc (0.11.0)
65-
oj (3.10.18)
65+
oj (3.13.20)
6666
power_assert (2.0.1)
6767
public_suffix (4.0.6)
6868
rake (13.0.6)
@@ -73,7 +73,7 @@ GEM
7373
mime-types (>= 1.16, < 4.0)
7474
netrc (~> 0.8)
7575
rexml (3.2.5)
76-
serverengine (2.2.5)
76+
serverengine (2.3.0)
7777
sigdump (~> 0.2.2)
7878
sigdump (0.2.4)
7979
simplecov (0.16.1)
@@ -84,19 +84,19 @@ GEM
8484
strptime (0.2.5)
8585
test-unit (3.3.9)
8686
power_assert
87-
tzinfo (2.0.4)
87+
tzinfo (2.0.5)
8888
concurrent-ruby (~> 1.0)
89-
tzinfo-data (1.2022.1)
89+
tzinfo-data (1.2022.2)
9090
tzinfo (>= 1.0.0)
9191
unf (0.1.4)
9292
unf_ext
93-
unf_ext (0.0.8.1)
93+
unf_ext (0.0.8.2)
9494
webmock (3.5.1)
9595
addressable (>= 2.3.6)
9696
crack (>= 0.3.2)
9797
hashdiff
9898
webrick (1.7.0)
99-
yajl-ruby (1.4.2)
99+
yajl-ruby (1.4.3)
100100

101101
PLATFORMS
102102
ruby

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.12
1+
1.2.0

docker/Gemfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ source 'https://rubygems.org'
33
# This is separate gemfile for building docker image that has all plugins
44
# for kubernetes log collection agent
55
# List all required gems here and install via bundler to resolve dependencies
6-
gem "fluentd", ">=1.14.2"
6+
gem "fluentd", ">=1.15.0"
77
gem "fluent-plugin-prometheus", ">=2.0"
88
gem "fluent-plugin-record-modifier", "=2.1.0"
9-
gem "fluent-plugin-kubernetes_metadata_filter", ">=2.5.3"
109
gem "fluent-plugin-jq", "=0.5.1"
11-
gem "oj", "=3.10.18"
12-
gem 'multi_json', '=1.14.1'
10+
gem "oj", "~> 3.10"
11+
gem 'multi_json', '~> 1.14'
1312
gem 'bigdecimal', '=3.0.0'
1413
gem 'kubeclient', '=4.9.3'
1514
gem 'http_parser.rb', '=0.8.0'
15+
gem 'rack', '>= 2.2.3.1'
1616

17-
gem "fluent-plugin-splunk-hec", ">= 1.2.5"
17+
gem "fluent-plugin-splunk-hec", "= 1.3.0"
1818
gem 'fluent-plugin-kubernetes-metrics', path: 'gem/'

docker/Gemfile.lock

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
PATH
22
remote: gem
33
specs:
4-
fluent-plugin-kubernetes-metrics (1.1.12)
4+
fluent-plugin-kubernetes-metrics (1.2.0)
55
fluentd (>= 1.9.1)
66
kubeclient (~> 4.9.3)
7-
multi_json (~> 1.14.1)
8-
oj (~> 3.10.2)
7+
multi_json (~> 1.14)
8+
oj (~> 3.10)
99

1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
activemodel (7.0.2.4)
14-
activesupport (= 7.0.2.4)
15-
activesupport (7.0.2.4)
13+
activemodel (7.0.3.1)
14+
activesupport (= 7.0.3.1)
15+
activesupport (7.0.3.1)
1616
concurrent-ruby (~> 1.0, >= 1.0.2)
1717
i18n (>= 1.6, < 2)
1818
minitest (>= 5.1)
@@ -35,27 +35,23 @@ GEM
3535
fluent-plugin-jq (0.5.1)
3636
fluentd (>= 0.14.10, < 2)
3737
multi_json (~> 1.13)
38-
fluent-plugin-kubernetes_metadata_filter (2.9.3)
39-
fluentd (>= 0.14.0, < 1.15)
40-
kubeclient (>= 4.0.0, < 5.0.0)
41-
lru_redux
4238
fluent-plugin-prometheus (2.0.2)
4339
fluentd (>= 1.9.1, < 2)
4440
prometheus-client (>= 2.1.0)
4541
fluent-plugin-record-modifier (2.1.0)
4642
fluentd (>= 1.0, < 2)
47-
fluent-plugin-splunk-hec (1.2.13)
48-
fluentd (>= 1.4)
43+
fluent-plugin-splunk-hec (1.3.0)
44+
fluentd (>= 1.5)
4945
multi_json (~> 1.13)
5046
net-http-persistent (~> 4.0)
5147
openid_connect (~> 1.1.8)
5248
prometheus-client (>= 2.1.0)
53-
fluentd (1.14.6)
49+
fluentd (1.15.1)
5450
bundler
5551
cool.io (>= 1.4.5, < 2.0.0)
5652
http_parser.rb (>= 0.5.1, < 0.9.0)
5753
msgpack (>= 1.3.1, < 2.0.0)
58-
serverengine (>= 2.2.5, < 3.0.0)
54+
serverengine (>= 2.3.0, < 3.0.0)
5955
sigdump (~> 0.2.2)
6056
strptime (>= 0.2.4, < 1.0.0)
6157
tzinfo (>= 1.0, < 3.0)
@@ -75,29 +71,29 @@ GEM
7571
ffi-compiler (>= 1.0, < 2.0)
7672
http_parser.rb (0.8.0)
7773
httpclient (2.8.3)
78-
i18n (1.10.0)
74+
i18n (1.12.0)
7975
concurrent-ruby (~> 1.0)
80-
json-jwt (1.13.0)
76+
json-jwt (1.15.2)
8177
activesupport (>= 4.2)
8278
aes_key_wrap
8379
bindata
80+
httpclient
8481
jsonpath (1.1.0)
8582
multi_json
8683
kubeclient (4.9.3)
8784
http (>= 3.0, < 5.0)
8885
jsonpath (~> 1.0)
8986
recursive-open-struct (~> 1.1, >= 1.1.1)
9087
rest-client (~> 2.0)
91-
lru_redux (1.1.0)
9288
mail (2.7.1)
9389
mini_mime (>= 0.1.1)
9490
mime-types (3.4.1)
9591
mime-types-data (~> 3.2015)
9692
mime-types-data (3.2022.0105)
9793
mini_mime (1.1.2)
98-
minitest (5.15.0)
99-
msgpack (1.5.1)
100-
multi_json (1.14.1)
94+
minitest (5.16.2)
95+
msgpack (1.5.4)
96+
multi_json (1.15.0)
10197
net-http-persistent (4.0.1)
10298
connection_pool (~> 2.2)
10399
netrc (0.11.0)
@@ -114,8 +110,8 @@ GEM
114110
webfinger (>= 1.0.1)
115111
prometheus-client (4.0.0)
116112
public_suffix (4.0.7)
117-
rack (2.2.3)
118-
rack-oauth2 (1.19.0)
113+
rack (2.2.4)
114+
rack-oauth2 (1.21.2)
119115
activesupport
120116
attr_required
121117
httpclient
@@ -128,32 +124,32 @@ GEM
128124
http-cookie (>= 1.0.2, < 2.0)
129125
mime-types (>= 1.16, < 4.0)
130126
netrc (~> 0.8)
131-
serverengine (2.2.5)
127+
serverengine (2.3.0)
132128
sigdump (~> 0.2.2)
133129
sigdump (0.2.4)
134130
strptime (0.2.5)
135131
swd (1.3.0)
136132
activesupport (>= 3)
137133
attr_required (>= 0.0.5)
138134
httpclient (>= 2.4)
139-
tzinfo (2.0.4)
135+
tzinfo (2.0.5)
140136
concurrent-ruby (~> 1.0)
141-
tzinfo-data (1.2022.1)
137+
tzinfo-data (1.2022.2)
142138
tzinfo (>= 1.0.0)
143139
unf (0.1.4)
144140
unf_ext
145141
unf_ext (0.0.8.1)
146142
validate_email (0.1.6)
147143
activemodel (>= 3.0)
148144
mail (>= 2.2.5)
149-
validate_url (1.0.13)
145+
validate_url (1.0.15)
150146
activemodel (>= 3.0.0)
151147
public_suffix
152148
webfinger (1.2.0)
153149
activesupport
154150
httpclient (>= 2.4)
155151
webrick (1.7.0)
156-
yajl-ruby (1.4.2)
152+
yajl-ruby (1.4.3)
157153

158154
PLATFORMS
159155
ruby
@@ -162,15 +158,15 @@ DEPENDENCIES
162158
bigdecimal (= 3.0.0)
163159
fluent-plugin-jq (= 0.5.1)
164160
fluent-plugin-kubernetes-metrics!
165-
fluent-plugin-kubernetes_metadata_filter (>= 2.5.3)
166161
fluent-plugin-prometheus (>= 2.0)
167162
fluent-plugin-record-modifier (= 2.1.0)
168-
fluent-plugin-splunk-hec (>= 1.2.5)
169-
fluentd (>= 1.14.2)
163+
fluent-plugin-splunk-hec (= 1.3.0)
164+
fluentd (>= 1.15.0)
170165
http_parser.rb (= 0.8.0)
171166
kubeclient (= 4.9.3)
172-
multi_json (= 1.14.1)
173-
oj (= 3.10.18)
167+
multi_json (~> 1.14)
168+
oj (~> 3.10)
169+
rack (>= 2.2.3.1)
174170

175171
BUNDLED WITH
176172
2.1.4

fluent-plugin-kubernetes-metrics.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
2626
spec.add_development_dependency 'webmock', '~> 3.5.1'
2727
spec.add_runtime_dependency 'fluentd', '>= 1.9.1'
2828
spec.add_runtime_dependency 'kubeclient', '~> 4.9.3'
29-
spec.add_runtime_dependency 'multi_json', '~> 1.14.1'
30-
spec.add_runtime_dependency 'oj', '~> 3.10.2'
29+
spec.add_runtime_dependency 'multi_json', '~> 1.14'
30+
spec.add_runtime_dependency 'oj', '~> 3.10'
3131
end

lib/fluent/plugin/in_kubernetes_metrics.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def init_without_kubeconfig(_options = {})
166166
}
167167

168168
auth_options = {}
169-
auth_options[:bearer_token] = File.read(@bearer_token_file) if @bearer_token_file
169+
auth_options[:bearer_token_file] = @bearer_token_file if @bearer_token_file
170170

171171
@client = Kubeclient::Client.new(
172172
@kubernetes_url, 'v1',
@@ -244,6 +244,11 @@ def set_ssl_options
244244
ssl_options
245245
end
246246

247+
# This method is used to refresh the authorization token for kubeclient
248+
def update_kubeclient_header
249+
@client.headers[:Authorization] = 'Bearer ' + File.read(@bearer_token_file) if @bearer_token_file
250+
end
251+
247252
# This method is used to set the options for sending a request to the kubelet api
248253
def request_options
249254
options = { method: 'get', url: @kubelet_url }
@@ -677,6 +682,7 @@ def scrape_metrics
677682
response = RestClient::Request.execute request_options
678683
handle_response(response)
679684
else
685+
update_kubeclient_header
680686
@node_names.each do |node|
681687
response = summary_proxy_api(node).get(@client.headers)
682688
handle_response(response)
@@ -688,6 +694,7 @@ def is_stats_endpoint_available?
688694
if @use_rest_client
689695
response_stats = RestClient::Request.execute request_options_stats
690696
else
697+
update_kubeclient_header
691698
@node_names.each do |node|
692699
@node_name = node
693700
response_stats = stats_proxy_api(node).get(@client.headers)
@@ -703,6 +710,7 @@ def scrape_stats_metrics
703710
response_stats = RestClient::Request.execute request_options_stats
704711
handle_stats_response(response_stats)
705712
else
713+
update_kubeclient_header
706714
@node_names.each do |node|
707715
@node_name = node
708716
response_stats = stats_proxy_api(node).get(@client.headers)
@@ -716,6 +724,7 @@ def scrape_cadvisor_metrics
716724
response_cadvisor = RestClient::Request.execute cadvisor_request_options
717725
handle_cadvisor_response(response_cadvisor)
718726
else
727+
update_kubeclient_header
719728
@node_names.each do |node|
720729
response_cadvisor = cadvisor_proxy_api(node).get(@client.headers)
721730
handle_cadvisor_response(response_cadvisor)

metrics-information.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Metrics Information
22

3-
## The foillowing table describes common terminology used in this topic.
3+
## The following table describes common terminology used in this topic.
44

55
| Terminology | Definition |
66
| --- | --- |

0 commit comments

Comments
 (0)