Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 56a7a10

Browse files
author
Donald Tregonning
authored
Merge pull request #36 from splunk/develop
The release of Fluent Plugin Kubernetes Metrics is a fluent input plugin which collects metrics from Kubernetes from multiple api endpoints and forwards to fluentd. The plugin collects metrics from: - The kubelet summary api - The kubelet stats api - The cadvisor metrics api
2 parents c119857 + 55c5285 commit 56a7a10

26 files changed

+8057
-312
lines changed

.circleci/build_and_push.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
aws ecr get-login --region $AWS_REGION --no-include-email | bash
4+
echo "Building docker image..."
5+
cp /tmp/pkg/fluent-plugin-kubernetes-metrics-*.gem docker
6+
docker build --build-arg VERSION=$FLUENT_SPLUNK_HEC_GEM_VERSION --no-cache -t splunk/fluent-plugin-kubernetes-metrics:metrics ./docker
7+
docker tag splunk/fluent-plugin-kubernetes-metrics:metrics $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-metrics:latest
8+
echo "Push docker image to ecr..."
9+
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-metrics:latest | awk 'END{print}'
10+
echo "Docker image pushed successfully."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
echo "Building docker image..."
4+
cp /tmp/pkg/fluent-plugin-kubernetes-metrics-*.gem docker
5+
VERSION=`cat VERSION`
6+
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-kubernetes-metrics:ci ./docker
7+
docker tag splunk/fluent-plugin-kubernetes-metrics:ci splunk/${DOCKERHUB_REPO_NAME}:${VERSION}
8+
echo "Push docker image to splunk dockerhub..."
9+
docker login --username=$DOCKERHUB_ACCOUNT_ID --password=$DOCKERHUB_ACCOUNT_PASS
10+
docker push splunk/${DOCKERHUB_REPO_NAME}:${VERSION} | awk 'END{print}'
11+
echo "Docker image pushed successfully to docker-hub."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
wget https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_amd64.tar.gz
4+
tar -xzvf ghr_v0.12.0_linux_amd64.tar.gz
5+
sudo chmod +x ghr_v0.12.0_linux_amd64
6+
sudo mv ghr_v0.12.0_linux_amd64/ghr /usr/local/bin/ghr
7+
8+
VERSION=`cat VERSION`
9+
echo "Pushing SCK release to github releases...${VERSION}"
10+
11+
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "${RELEASE_TITLE}" -b "${RELEASE_BODY}" -draft ${VERSION} /tmp/pkg/

.circleci/config.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/ruby:2.6.1-node-browsers
6+
working_directory: ~/repo
7+
steps:
8+
- checkout
9+
- setup_remote_docker:
10+
reusable: true
11+
- run:
12+
name: Install dependencies
13+
command: |
14+
.circleci/install_dep.sh
15+
- run:
16+
name: Builder
17+
command: |
18+
rake build -t -v
19+
cp -R pkg /tmp
20+
- persist_to_workspace:
21+
root: /tmp
22+
paths:
23+
- pkg
24+
25+
test:
26+
docker:
27+
- image: circleci/ruby:2.6.1-node-browsers
28+
working_directory: ~/repo
29+
steps:
30+
- attach_workspace:
31+
at: /tmp
32+
- checkout
33+
- setup_remote_docker:
34+
reusable: true
35+
- run:
36+
name: Install dependencies
37+
command: |
38+
.circleci/install_dep.sh
39+
- run:
40+
name: Run unit tests
41+
command: |
42+
rake test -t -v
43+
44+
push:
45+
docker:
46+
- image: circleci/ruby:2.6.1-node-browsers
47+
working_directory: ~/repo
48+
steps:
49+
- attach_workspace:
50+
at: /tmp
51+
- checkout
52+
- setup_remote_docker:
53+
reusable: true
54+
- run:
55+
name: Push rubygem to s3
56+
command: |
57+
.circleci/push_gem.sh
58+
- run:
59+
name: Build and push docker image to ecr
60+
command: |
61+
.circleci/build_and_push.sh
62+
63+
release:
64+
docker:
65+
- image: circleci/ruby:2.6.1-node-browsers
66+
working_directory: ~/repo
67+
steps:
68+
- attach_workspace:
69+
at: /tmp
70+
- checkout
71+
- setup_remote_docker:
72+
reusable: true
73+
- run:
74+
name: Install dependencies
75+
command: |
76+
.circleci/install_dep.sh
77+
- run:
78+
name: Build and push docker image to dockerhub
79+
command: |
80+
.circleci/build_and_push_to_dockerhub.sh
81+
- run:
82+
name: Upload gem to Github
83+
command: |
84+
.circleci/build_and_push_to_github_release.sh
85+
86+
workflows:
87+
version: 2
88+
build_test_push:
89+
jobs:
90+
- build
91+
- test:
92+
requires:
93+
- build
94+
- push:
95+
requires:
96+
- test
97+
filters:
98+
branches:
99+
only: develop
100+
- release:
101+
requires:
102+
- test
103+
filters:
104+
branches:
105+
only: master

.circleci/install_dep.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
gem install bundler
4+
bundle update --bundler
5+
bundle install

.circleci/push_gem.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
sudo apt-get install -y python-pip libpython-dev > /dev/null 2>&1
4+
echo "Installing aws cli..."
5+
sudo pip install awscli > /dev/null 2>&1
6+
echo "Pushing metrics gem to s3..."
7+
aws s3 cp /tmp/pkg/*.gem s3://k8s-ci-artifacts/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.gem
22
vendor
33
pkg
4+
coverage/
5+
.idea/

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
source "https://rubygems.org"
1+
source 'https://rubygems.org'
2+
3+
group :test do
4+
gem 'simplecov', '~> 0.16.1', require: false
5+
end
26

37
gemspec

Gemfile.lock

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
PATH
22
remote: .
33
specs:
4-
fluent-plugin-kubernetes-metrics (1.0.0)
5-
fluentd (>= 0.14.10, < 2)
6-
kubeclient (~> 4.0)
7-
multi_json (~> 1.13)
8-
oj (~> 3.6)
4+
fluent-plugin-kubernetes-metrics (1.1.0.Alpha)
5+
fluentd (~> 1.3.3)
6+
kubeclient (~> 4.2.2)
7+
multi_json (~> 1.13.1)
8+
oj (~> 3.7.8)
99

1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
addressable (2.5.2)
13+
addressable (2.6.0)
1414
public_suffix (>= 2.0.2, < 4.0)
1515
cool.io (1.5.3)
16+
crack (0.4.3)
17+
safe_yaml (~> 1.0.0)
1618
dig_rb (1.0.1)
19+
docile (1.3.1)
1720
domain_name (0.5.20180417)
1821
unf (>= 0.0.5, < 1.0.0)
19-
fluentd (1.2.5)
22+
fluentd (1.3.3)
2023
cool.io (>= 1.4.5, < 2.0.0)
2124
dig_rb (~> 1.0.0)
2225
http_parser.rb (>= 0.5.1, < 0.7.0)
@@ -27,6 +30,7 @@ GEM
2730
tzinfo (~> 1.0)
2831
tzinfo-data (~> 1.0)
2932
yajl-ruby (~> 1.0)
33+
hashdiff (0.3.8)
3034
http (3.3.0)
3135
addressable (~> 2.3)
3236
http-cookie (~> 1.0)
@@ -36,49 +40,62 @@ GEM
3640
domain_name (~> 0.5)
3741
http-form_data (2.1.1)
3842
http_parser.rb (0.6.0)
39-
kubeclient (4.0.0)
43+
json (2.1.0)
44+
kubeclient (4.2.2)
4045
http (~> 3.0)
4146
recursive-open-struct (~> 1.0, >= 1.0.4)
4247
rest-client (~> 2.0)
4348
mime-types (3.2.2)
4449
mime-types-data (~> 3.2015)
4550
mime-types-data (3.2018.0812)
46-
msgpack (1.2.4)
51+
msgpack (1.2.6)
4752
multi_json (1.13.1)
4853
netrc (0.11.0)
49-
oj (3.6.7)
54+
oj (3.7.8)
5055
power_assert (1.1.3)
5156
public_suffix (3.0.3)
52-
rake (12.3.1)
57+
rake (12.3.2)
5358
recursive-open-struct (1.1.0)
5459
rest-client (2.0.2)
5560
http-cookie (>= 1.0.2, < 2.0)
5661
mime-types (>= 1.16, < 4.0)
5762
netrc (~> 0.8)
58-
serverengine (2.0.7)
63+
safe_yaml (1.0.4)
64+
serverengine (2.1.0)
5965
sigdump (~> 0.2.2)
6066
sigdump (0.2.4)
67+
simplecov (0.16.1)
68+
docile (~> 1.1)
69+
json (>= 1.8, < 3)
70+
simplecov-html (~> 0.10.0)
71+
simplecov-html (0.10.2)
6172
strptime (0.2.3)
62-
test-unit (3.2.8)
73+
test-unit (3.3.0)
6374
power_assert
6475
thread_safe (0.3.6)
6576
tzinfo (1.2.5)
6677
thread_safe (~> 0.1)
67-
tzinfo-data (1.2018.5)
78+
tzinfo-data (1.2018.9)
6879
tzinfo (>= 1.0.0)
6980
unf (0.1.4)
7081
unf_ext
7182
unf_ext (0.0.7.5)
83+
webmock (3.5.1)
84+
addressable (>= 2.3.6)
85+
crack (>= 0.3.2)
86+
hashdiff
7287
yajl-ruby (1.4.1)
7388

7489
PLATFORMS
7590
ruby
7691

7792
DEPENDENCIES
78-
bundler (~> 1.14)
93+
bundler (~> 2.0.1)
7994
fluent-plugin-kubernetes-metrics!
80-
rake (~> 12.0)
81-
test-unit (~> 3.0)
95+
rake (~> 12.3.2)
96+
simplecov (~> 0.16.1)
97+
test-unit (~> 3.3.0)
98+
webmock (~> 3.5.1)
8299

83100
BUNDLED WITH
84-
1.16.1
101+
2.0.1

LICENSE

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@
201201
limitations under the License.
202202

203203
=======================================================================
204-
Fluentd Plugin for Kubernetes Objects:
204+
Fluentd Plugin for Kubernetes Metrics:
205205

206-
The Fluentd Plugin for Kubernetes Objects project contains
206+
The Fluentd Plugin for Kubernetes Metrics project contains
207207
subcomponents with separate copyright notices and license terms.
208208
Your use of the source code for the these subcomponents is subject
209209
to the terms and conditions of the following licenses.
@@ -214,20 +214,55 @@ Apache License 2.0
214214
The following components are provided under the Apache License 2.0. See project link for details.
215215

216216
(Apache License 2.0) fluentd (https://github.com/fluent/fluentd/blob/master/LICENSE)
217+
(Apache License 2.0) thread_safe (https://github.com/ruby-concurrency/thread_safe/blob/master/LICENSE)
218+
(Apache License 2.0) msgpack (https://github.com/msgpack/msgpack-ruby/blob/master/LICENSE)
219+
(Apache License 2.0) serverengine (https://github.com/treasure-data/serverengine/blob/master/LICENSE)
220+
(Apache License 2.0) addressable (https://github.com/sporkmonger/addressable/blob/master/LICENSE.txt)
217221

218222
========================================================================
219223
MIT licenses
220224
========================================================================
221225
The following components are provided under the MIT License. See project link for details.
222226

223-
(MIT License) kubeclient (https://github.com/abonas/kubeclient/blob/master/LICENSE.txt)
224227
(MIT License) bundler (https://github.com/bundler/bundler/blob/master/LICENSE.md)
225228
(MIT License) rake (https://github.com/ruby/rake/blob/master/MIT-LICENSE)
226229
(MIT License) webmock (https://github.com/bblimke/webmock/blob/master/LICENSE)
227-
(MIT License) minitest (https://github.com/seattlerb/minitest/blob/master/README.rdoc#license)
230+
(MIT License) simplecov (https://github.com/colszowka/simplecov/blob/master/LICENSE)
231+
(MIT License) webmock (https://github.com/bblimke/webmock/blob/master/LICENSE)
232+
(MIT License) multi_json (https://github.com/intridea/multi_json/blob/master/LICENSE.md)
233+
(MIT License) kubeclient (https://github.com/abonas/kubeclient/blob/master/LICENSE.txt)
234+
(MIT License) oj (https://github.com/ohler55/oj/blob/master/LICENSE)
235+
(MIT License) public_suffix (https://github.com/weppos/publicsuffix-ruby/blob/master/LICENSE.txt)
236+
(MIT License) cool.io (https://github.com/tarcieri/cool.io/blob/master/LICENSE)
237+
(MIT License) crack (https://github.com/jnunemaker/crack/blob/master/LICENSE)
238+
(MIT License) safe_yaml (https://github.com/dtao/safe_yaml/blob/master/LICENSE.txt)
239+
(MIT License) dig_rb (https://github.com/jrochkind/dig_rb/blob/master/LICENSE.txt)
240+
(MIT License) docile (https://github.com/ms-ati/docile/blob/master/LICENSE)
241+
(MIT License) unf_ext (https://github.com/knu/ruby-unf_ext/blob/master/LICENSE.txt)
242+
(MIT License) http_parser.rb (https://github.com/tmm1/http_parser.rb/blob/master/LICENSE-MIT)
243+
(MIT License) sigdump (https://github.com/frsyuki/sigdump/blob/master/LICENSE)
244+
(MIT License) tzinfo (https://github.com/tzinfo/tzinfo/blob/master/LICENSE)
245+
(MIT License) tzinfo-data (https://github.com/tzinfo/tzinfo-data/blob/master/LICENSE)
246+
(MIT License) yajl-ruby (https://github.com/brianmario/yajl-ruby/blob/master/LICENSE)
247+
(MIT License) http-cookie (https://github.com/sparklemotion/http-cookie/blob/master/LICENSE.txt)
248+
(MIT License) http-form_data (https://github.com/httprb/form_data/blob/master/LICENSE.txt)
249+
(MIT License) http (https://github.com/httprb/http/blob/master/LICENSE.txt)
250+
(MIT License) recursive-open-struct (https://github.com/aetherknight/recursive-open-struct/blob/master/LICENSE.txt)
251+
(MIT License) mime-types-data (https://github.com/mime-types/mime-types-data/blob/master/Licence.md)
252+
(MIT License) mime-types (https://github.com/mime-types/ruby-mime-types/blob/master/Licence.md)
253+
(MIT License) netrc (https://github.com/heroku/netrc/blob/master/LICENSE.md)
254+
(MIT License) rest-client (https://github.com/rest-client/rest-client/blob/master/LICENSE)
255+
(MIT License) hashdiff (https://github.com/liufengyun/hashdiff/blob/master/LICENSE)
256+
(MIT License) simplecov-html (https://github.com/colszowka/simplecov-html/blob/master/LICENSE)
228257

229258
========================================================================
230-
For test-unit:
259+
BSD Licenses
231260
========================================================================
232-
233-
See https://github.com/test-unit/test-unit/blob/master/COPYING
261+
The following components are provided under the BSD license. See project link for details.
262+
263+
(BSD License) power_assert (https://github.com/k-tsj/power_assert/blob/master/BSDL)
264+
(BSD License) strptime (https://github.com/nurse/strptime/blob/master/LICENSE.txt)
265+
(BSD License) unf (https://github.com/knu/ruby-unf/blob/master/LICENSE)
266+
(BSD License) domain_name (https://github.com/knu/ruby-domain_name/blob/master/LICENSE.txt)
267+
(BSD License) json (https://www.ruby-lang.org/en/about/license.txt)
268+
(BSD License) test-unit (https://github.com/test-unit/test-unit)

0 commit comments

Comments
 (0)