fluent-plugin-k8s-metrics-agg 1.1.3 → 1.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21041b7e0cd24078614d47d6e4cc8fc75138d8d58c526caea01bc18f42501133
4
- data.tar.gz: 4ce441084243286718d3c46901ac17f1fc8bcf5f2bd1f7355ca5ae3a873f4076
3
+ metadata.gz: 11e9b540230a927f8cb2dd469d4b16d16941c8e7cde2d4019394509c8562874e
4
+ data.tar.gz: 38e231e8cde3aa56f386c3cc835065fec257ecffe502866ae0db8e00a818f970
5
5
  SHA512:
6
- metadata.gz: b4644e9e65e010c942e241aab276cd9d458096505339312c090bdcfcc276c327c9421fd15a2c2b918480f2b16e694eb3bdd6a3b26c37ff8e727621fe778f512b
7
- data.tar.gz: 3bc538ccb8b5b39ceb67e1dce44ca32d002a04b5be8200618170c7df0c0b5c7165bdb6b970accee64d7f11b0b90dd20d60bfe3afbd529738754a9e4770c32b5c
6
+ metadata.gz: 298e621affd96c9185a95e019af9bf947d4f1a81bdb850606fc9c9729ba0f7ec3072ad4df4f176e4280ae70bba1a012d59d183ecd858cc80f1c085c4b99ec44b
7
+ data.tar.gz: 3ea6fe8cd14f6820a8c3126cc8fc226b28d06786e467fdba6cbdc8d8b1445724a11406a4d28850f87685959ac59170be0e45fab8cee35570476167fb96f3f01e
@@ -0,0 +1,192 @@
1
+ name: CI Build Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches-ignore:
6
+ - /^release\/.*/
7
+ - main
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-20.04
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Setup Ruby and install gems
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ bundler-cache: true
20
+ ruby-version: 2.6.1
21
+
22
+ - name: Install dependencies
23
+ run: |
24
+ sudo ci_scripts/install_dep.sh
25
+
26
+ - name: Builder
27
+ run: |
28
+ rake build -t -v
29
+ cp -R pkg /tmp
30
+
31
+ - name: Cache pkg
32
+ uses: actions/cache@v1
33
+ with:
34
+ path: /tmp
35
+ key: ${{ runner.os }}-build
36
+
37
+ unit-test:
38
+ runs-on: ubuntu-20.04
39
+ needs:
40
+ - build
41
+ steps:
42
+ - name: Checkout
43
+ uses: actions/checkout@v2
44
+
45
+ - name: Install dependencies
46
+ run: |
47
+ sudo ci_scripts/install_dep.sh
48
+
49
+ - uses: actions/cache@v2
50
+ with:
51
+ path: /tmp
52
+ key: ${{ runner.os }}-build
53
+
54
+ - name: Run unit tests
55
+ run: |
56
+ bundle exec rake test -t -v
57
+
58
+ func-test:
59
+ needs:
60
+ - unit-test
61
+ runs-on: ubuntu-20.04
62
+ env:
63
+ CI_SPLUNK_PORT: 8089
64
+ CI_SPLUNK_USERNAME: admin
65
+ CI_SPLUNK_HEC_TOKEN: a6b5e77f-d5f6-415a-bd43-930cecb12959
66
+ CI_SPLUNK_PASSWORD: helloworld
67
+ CI_INDEX_EVENTS: ci_events
68
+ CI_INDEX_OBJECTS: ci_objects
69
+ CI_INDEX_METRICS: ci_metrics
70
+ KUBERNETES_VERSION: v1.15.2
71
+ MINIKUBE_VERSION: v1.21.0
72
+ GITHUB_ACTIONS: true
73
+
74
+ steps:
75
+ - name: Checkout
76
+ uses: actions/checkout@v2
77
+
78
+ - name: Prepare container build
79
+ id: prep
80
+ run: |
81
+ VERSION=`cat VERSION`
82
+ TAGS=splunk/k8s-metrics-aggr:recent
83
+ echo ::set-output name=tags::${TAGS}
84
+ echo ::set-output name=version::${VERSION}
85
+
86
+ - name: Set up QEMU
87
+ uses: docker/setup-qemu-action@master
88
+ with:
89
+ platforms: all
90
+
91
+ - name: Set up Docker Buildx
92
+ id: buildx
93
+ uses: docker/setup-buildx-action@master
94
+
95
+ - name: Build multi-arch kubernetes-metrics image
96
+ uses: docker/build-push-action@v2
97
+ with:
98
+ builder: ${{ steps.buildx.outputs.name }}
99
+ context: .
100
+ file: ./docker/Dockerfile
101
+ platforms: linux/amd64
102
+ push: false
103
+ load: true
104
+ tags: ${{ steps.prep.outputs.tags }}
105
+ build-args: VERSION=${{ steps.prep.outputs.version }}
106
+
107
+ - name: Build k8s-metrics-aggr image
108
+ run: |
109
+ docker image ls
110
+
111
+ - name: Setup Minikube
112
+ run: |
113
+ # Install Kubectl
114
+ curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl
115
+ chmod +x kubectl
116
+ sudo mv kubectl /usr/local/bin/
117
+ mkdir -p ${HOME}/.kube
118
+ touch ${HOME}/.kube/config
119
+ # Install Minikube
120
+ curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
121
+ chmod +x minikube
122
+ sudo mv minikube /usr/local/bin/
123
+ # Start Minikube and Wait
124
+ minikube start --driver=docker --container-runtime=docker --cpus 2 --memory 4096 --kubernetes-version=${KUBERNETES_VERSION} --no-vtx-check
125
+ export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
126
+ until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
127
+ sleep 1;
128
+ done
129
+
130
+ - name: Install Splunk
131
+ run: |
132
+ # Wait until minikube is ready
133
+ kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
134
+ export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
135
+ until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
136
+ echo "wait for minikube ready ..."
137
+ sleep 1;
138
+ done
139
+ kubectl get nodes
140
+ # Install Splunk on minikube
141
+ kubectl apply -f ci_scripts/k8s-splunk.yml
142
+ # Wait until splunk is ready
143
+ until kubectl logs splunk --tail=2 | grep -q 'Ansible playbook complete'; do
144
+ sleep 1;
145
+ done
146
+ export CI_SPLUNK_HOST=$(kubectl get pod splunk --template={{.status.podIP}})
147
+ # Setup Indexes
148
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=$CI_INDEX_EVENTS -d datatype=event
149
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=$CI_INDEX_OBJECTS -d datatype=event
150
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=$CI_INDEX_METRICS -d datatype=metric
151
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=default-events -d datatype=event
152
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=ns-anno -d datatype=event
153
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/data/indexes -d name=pod-anno -d datatype=event
154
+ # Enable HEC services
155
+ curl -X POST -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD -k https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/servicesNS/nobody/splunk_httpinput/data/inputs/http/http/enable
156
+ # Create new HEC token
157
+ curl -X POST -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD -k -d "name=splunk_hec_token&token=a6b5e77f-d5f6-415a-bd43-930cecb12959&disabled=0&index=default-events&indexes=default-events,$CI_INDEX_METRICS,$CI_INDEX_OBJECTS,$CI_INDEX_EVENTS,ns-anno,pod-anno" https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/servicesNS/nobody/splunk_httpinput/data/inputs/http
158
+ # Restart Splunk
159
+ curl -k -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/services/server/control/restart -X POST
160
+
161
+ - name: Deploy k8s connector
162
+ run: |
163
+ export CI_SPLUNK_HOST=$(kubectl get pod splunk --template={{.status.podIP}})
164
+ ci_scripts/deploy_connector.sh
165
+
166
+ - name: Deploy log generator
167
+ run: |
168
+ cd /opt/splunk-connect-for-kubernetes
169
+ kubectl apply -f test/test_setup.yaml
170
+ sleep 65
171
+
172
+ - uses: actions/setup-python@v2
173
+ with:
174
+ python-version: 3.7
175
+
176
+ - name: Run functional tests
177
+ run: |
178
+ echo "check the pods"
179
+ kubectl get pods -A
180
+ cd /opt/splunk-connect-for-kubernetes
181
+ kubectl get nodes
182
+ export PYTHONWARNINGS="ignore:Unverified HTTPS request"
183
+ export CI_SPLUNK_HOST=$(kubectl get pod splunk --template={{.status.podIP}})
184
+ cd test
185
+ pip install --upgrade pip
186
+ pip install -r requirements.txt
187
+ echo "Running functional tests....."
188
+ python -m pytest \
189
+ --splunkd-url https://$CI_SPLUNK_HOST:8089 \
190
+ --splunk-user admin \
191
+ --splunk-password $CI_SPLUNK_PASSWORD \
192
+ -p no:warnings -s
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-k8s-metrics-agg (1.1.3)
5
- fluentd (~> 1.9.1)
4
+ fluent-plugin-k8s-metrics-agg (1.1.7)
5
+ fluentd (>= 1.9.1)
6
6
  kubeclient (~> 4.6.0)
7
7
  multi_json (~> 1.14.1)
8
8
  oj (~> 3.10.2)
@@ -10,65 +10,67 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.6.0)
14
- public_suffix (>= 2.0.2, < 4.0)
15
- concurrent-ruby (1.1.6)
16
- cool.io (1.6.0)
17
- crack (0.4.3)
18
- safe_yaml (~> 1.0.0)
19
- docile (1.3.1)
13
+ addressable (2.8.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ concurrent-ruby (1.1.9)
16
+ cool.io (1.7.1)
17
+ crack (0.4.5)
18
+ rexml
19
+ docile (1.4.0)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
- ffi (1.12.2)
22
+ ffi (1.15.4)
23
23
  ffi-compiler (1.0.1)
24
24
  ffi (>= 1.0.0)
25
25
  rake
26
- fluentd (1.9.2)
26
+ fluentd (1.14.2)
27
+ bundler
27
28
  cool.io (>= 1.4.5, < 2.0.0)
28
- http_parser.rb (>= 0.5.1, < 0.7.0)
29
+ http_parser.rb (>= 0.5.1, < 0.8.0)
29
30
  msgpack (>= 1.3.1, < 2.0.0)
30
- serverengine (>= 2.0.4, < 3.0.0)
31
+ serverengine (>= 2.2.2, < 3.0.0)
31
32
  sigdump (~> 0.2.2)
32
- strptime (>= 0.2.2, < 1.0.0)
33
+ strptime (>= 0.2.4, < 1.0.0)
33
34
  tzinfo (>= 1.0, < 3.0)
34
35
  tzinfo-data (~> 1.0)
36
+ webrick (>= 1.4.2, < 1.8.0)
35
37
  yajl-ruby (~> 1.0)
36
- hashdiff (0.3.8)
37
- http (4.3.0)
38
+ hashdiff (1.0.1)
39
+ http (4.4.1)
38
40
  addressable (~> 2.3)
39
41
  http-cookie (~> 1.0)
40
42
  http-form_data (~> 2.2)
41
43
  http-parser (~> 1.2.0)
42
44
  http-accept (1.7.0)
43
- http-cookie (1.0.3)
45
+ http-cookie (1.0.4)
44
46
  domain_name (~> 0.5)
45
- http-form_data (2.2.0)
46
- http-parser (1.2.1)
47
+ http-form_data (2.3.0)
48
+ http-parser (1.2.3)
47
49
  ffi-compiler (>= 1.0, < 2.0)
48
- http_parser.rb (0.6.0)
49
- json (2.3.1)
50
+ http_parser.rb (0.7.0)
51
+ json (2.6.1)
50
52
  kubeclient (4.6.0)
51
53
  http (>= 3.0, < 5.0)
52
54
  recursive-open-struct (~> 1.0, >= 1.0.4)
53
55
  rest-client (~> 2.0)
54
56
  mime-types (3.3.1)
55
57
  mime-types-data (~> 3.2015)
56
- mime-types-data (3.2019.1009)
57
- msgpack (1.3.3)
58
+ mime-types-data (3.2021.0901)
59
+ msgpack (1.4.2)
58
60
  multi_json (1.14.1)
59
61
  netrc (0.11.0)
60
- oj (3.10.2)
61
- power_assert (1.1.3)
62
- public_suffix (3.0.3)
63
- rake (13.0.1)
64
- recursive-open-struct (1.1.0)
62
+ oj (3.10.18)
63
+ power_assert (2.0.1)
64
+ public_suffix (4.0.6)
65
+ rake (13.0.6)
66
+ recursive-open-struct (1.1.3)
65
67
  rest-client (2.1.0)
66
68
  http-accept (>= 1.7.0, < 2.0)
67
69
  http-cookie (>= 1.0.2, < 2.0)
68
70
  mime-types (>= 1.16, < 4.0)
69
71
  netrc (~> 0.8)
70
- safe_yaml (1.0.4)
71
- serverengine (2.2.1)
72
+ rexml (3.2.5)
73
+ serverengine (2.2.4)
72
74
  sigdump (~> 0.2.2)
73
75
  sigdump (0.2.4)
74
76
  simplecov (0.16.1)
@@ -76,20 +78,21 @@ GEM
76
78
  json (>= 1.8, < 3)
77
79
  simplecov-html (~> 0.10.0)
78
80
  simplecov-html (0.10.2)
79
- strptime (0.2.3)
80
- test-unit (3.3.0)
81
+ strptime (0.2.5)
82
+ test-unit (3.3.9)
81
83
  power_assert
82
- tzinfo (2.0.1)
84
+ tzinfo (2.0.4)
83
85
  concurrent-ruby (~> 1.0)
84
- tzinfo-data (1.2019.3)
86
+ tzinfo-data (1.2021.5)
85
87
  tzinfo (>= 1.0.0)
86
88
  unf (0.1.4)
87
89
  unf_ext
88
- unf_ext (0.0.7.6)
90
+ unf_ext (0.0.8)
89
91
  webmock (3.5.1)
90
92
  addressable (>= 2.3.6)
91
93
  crack (>= 0.3.2)
92
94
  hashdiff
95
+ webrick (1.7.0)
93
96
  yajl-ruby (1.4.1)
94
97
 
95
98
  PLATFORMS
@@ -104,4 +107,4 @@ DEPENDENCIES
104
107
  webmock (~> 3.5.1)
105
108
 
106
109
  BUNDLED WITH
107
- 2.1.4
110
+ 2.2.30
data/Makefile CHANGED
@@ -4,7 +4,7 @@ clean_pkg:
4
4
  @rm -rf pkg/* docker/*.gem
5
5
 
6
6
  clean_gems:
7
- @rm -rf docker/gem/ docker/gems/
7
+ @rm -rf docker/gem/* docker/gems/*
8
8
 
9
9
  clean: clean_pkg clean_gems
10
10
  @rm -rf docker/licenses
@@ -12,11 +12,9 @@ clean: clean_pkg clean_gems
12
12
  build: clean_pkg
13
13
  @bundle exec rake build
14
14
 
15
- docker: build install-deps
16
- @cp pkg/fluent-plugin-*.gem docker
17
- @mkdir -p docker/licenses
18
- @cp -rp LICENSE docker/licenses/
19
- @docker build --no-cache --pull --build-arg VERSION=$(VERSION) -t splunk/k8s-metrics-aggr:$(VERSION) ./docker
15
+ .PHONY: docker
16
+ docker:
17
+ @docker build --no-cache --pull --build-arg VERSION=$(VERSION) -t splunk/k8s-metrics-aggr:$(VERSION) . -f docker/Dockerfile
20
18
 
21
19
  unit-test:
22
20
  @bundle exec rake test
@@ -28,5 +26,7 @@ install-deps:
28
26
 
29
27
  unpack: build
30
28
  @cp pkg/fluent-plugin-*.gem docker
29
+ @mkdir -p docker/gem
30
+ @rm -rf docker/gem
31
31
  @gem unpack docker/fluent-plugin-*.gem --target docker/gem
32
32
  @cd docker && bundle install
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![CircleCI](https://circleci.com/gh/git-lfs/git-lfs.svg?style=shield&circle-token=856152c2b02bfd236f54d21e1f581f3e4ebf47ad)](https://circleci.com/gh/splunk/fluent-plugin-k8s-metrics-agg)
2
1
  # Fluentd Plugin for Kubernetes Metrics - Aggregator
3
2
 
4
3
  [Fluentd](https://fluentd.org/) input plugin collects kubernetes cluster metrics from the kubeapiserver API. The API is exposed by [KubeApiServer](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) on a kubernetes cluster.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.7
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ #Make sure to check and clean previously failed deployment
5
+ echo "Checking if previous deployment exist..."
6
+ if [ "`helm ls --short`" == "" ]; then
7
+ echo "Nothing to clean, ready for deployment"
8
+ else
9
+ helm delete $(helm ls --short)
10
+ fi
11
+
12
+ # Clone splunk-connect-for-kubernetes repo
13
+ cd /opt
14
+ git clone https://github.com/splunk/splunk-connect-for-kubernetes.git
15
+ cd splunk-connect-for-kubernetes
16
+
17
+ minikube image load splunk/k8s-metrics-aggr:recent
18
+
19
+ echo "Deploying k8s-connect with latest changes"
20
+ helm install ci-sck --set global.splunk.hec.token=$CI_SPLUNK_HEC_TOKEN \
21
+ --set global.splunk.hec.host=$CI_SPLUNK_HOST \
22
+ --set kubelet.serviceMonitor.https=true \
23
+ --set splunk-kubernetes-metrics.imageAgg.tag=recent \
24
+ --set splunk-kubernetes-metrics.imageAgg.pullPolicy=IfNotPresent \
25
+ -f ci_scripts/sck_values.yml helm-chart/splunk-connect-for-kubernetes
26
+ #wait for deployment to finish
27
+ until kubectl get pod | grep Running | [[ $(wc -l) == 4 ]]; do
28
+ sleep 1;
29
+ done
File without changes
@@ -0,0 +1,31 @@
1
+ apiVersion: v1
2
+ kind: Pod
3
+ metadata:
4
+ name: splunk
5
+ spec:
6
+ hostNetwork: true
7
+ securityContext:
8
+ runAsUser: 0
9
+ runAsGroup: 0
10
+ containers:
11
+ - name: splunk
12
+ image: splunk/splunk:latest
13
+ ports:
14
+ - containerPort: 8000
15
+ hostPort: 8000
16
+ protocol: TCP
17
+ - containerPort: 8088
18
+ hostPort: 8088
19
+ protocol: TCP
20
+ - containerPort: 8089
21
+ hostPort: 8089
22
+ protocol: TCP
23
+ env:
24
+ - name: SPLUNK_START_ARGS
25
+ value: --accept-license
26
+ - name: SPLUNK_USER
27
+ value: root
28
+ - name: SPLUNK_PASSWORD
29
+ value: helloworld
30
+ - name: SPLUNK_LAUNCH_CONF
31
+ value: OPTIMISTIC_ABOUT_FILE_LOCKING=1
data/docker/Dockerfile CHANGED
@@ -1,4 +1,14 @@
1
- FROM registry.access.redhat.com/ubi8/ruby-25
1
+ FROM ruby:2.7.4-buster as builder
2
+
3
+ ADD ./ /app/
4
+ WORKDIR /app
5
+ RUN gem install bundler
6
+ RUN bundle update --bundler
7
+ RUN bundle install
8
+
9
+ RUN bundle exec rake build -t -v
10
+
11
+ FROM registry.access.redhat.com/ubi8/ruby-27
2
12
 
3
13
  ARG VERSION
4
14
 
@@ -14,14 +24,20 @@ ENV VERSION=${VERSION}
14
24
  ENV FLUENT_USER fluent
15
25
 
16
26
  USER root
17
- COPY licenses /licenses
18
27
 
19
- COPY *.gem /tmp/
28
+ COPY --from=builder /app/pkg/fluent-plugin-*.gem /tmp/
29
+
30
+ RUN mkdir /licenses
31
+ COPY --from=builder /app/LICENSE /licenses/LICENSE
32
+
33
+ COPY --from=builder /app/docker/Gemfile* ./
20
34
 
21
- COPY Gemfile* ./
22
- RUN gem install bundler \
35
+ RUN yum update -y \
36
+ && yum remove -y nodejs npm \
37
+ && gem install bundler \
23
38
  && gem unpack /tmp/*.gem --target gem \
24
- && bundle install
39
+ && bundle install \
40
+ && 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-*
25
41
 
26
42
  RUN groupadd -r $FLUENT_USER && \
27
43
  useradd -r -g $FLUENT_USER $FLUENT_USER && \
data/docker/Gemfile CHANGED
@@ -3,15 +3,16 @@ source 'https://rubygems.org'
3
3
  # This is separate gemfile for building docker image that has all plugins
4
4
  # for kubernetes log collection agent
5
5
  # List all required gems here and install via bundler to resolve dependencies
6
- gem "fluentd", "=1.9.1"
7
- gem "fluent-plugin-prometheus", "=1.7.0"
6
+ gem "fluentd", ">=1.14.2"
7
+ gem "fluent-plugin-prometheus", ">=2.0"
8
8
  gem "fluent-plugin-record-modifier", "=2.1.0"
9
+ gem "fluent-plugin-kubernetes_metadata_filter", ">=2.9.2"
9
10
  gem "kubeclient", "=4.6.0"
10
11
  gem "oj", "=3.10.2"
11
12
  gem 'multi_json', '=1.14.1'
12
13
  gem 'http_parser.rb', '=0.5.3'
13
- gem 'bigdecimal', '=1.4.3'
14
+ gem 'bigdecimal', '=3.0.0'
14
15
 
15
- gem "fluent-plugin-splunk-hec", ">= 1.2.3"
16
+ gem "fluent-plugin-splunk-hec", ">= 1.2.7"
16
17
 
17
18
  gem 'fluent-plugin-k8s-metrics-agg', path: 'gem/'
data/docker/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: gem
3
3
  specs:
4
- fluent-plugin-k8s-metrics-agg (1.1.3)
5
- fluentd (~> 1.9.1)
4
+ fluent-plugin-k8s-metrics-agg (1.1.7)
5
+ fluentd (>= 1.9.1)
6
6
  kubeclient (~> 4.6.0)
7
7
  multi_json (~> 1.14.1)
8
8
  oj (~> 3.10.2)
@@ -10,65 +10,72 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (5.2.4.3)
14
- activesupport (= 5.2.4.3)
15
- activesupport (5.2.4.3)
13
+ activemodel (6.1.4.1)
14
+ activesupport (= 6.1.4.1)
15
+ activesupport (6.1.4.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- addressable (2.7.0)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ addressable (2.8.0)
21
22
  public_suffix (>= 2.0.2, < 5.0)
22
- aes_key_wrap (1.0.1)
23
+ aes_key_wrap (1.1.0)
23
24
  attr_required (1.0.1)
24
- bigdecimal (1.4.3)
25
- bindata (2.4.4)
26
- concurrent-ruby (1.1.6)
27
- connection_pool (2.2.2)
28
- cool.io (1.6.0)
25
+ bigdecimal (3.0.0)
26
+ bindata (2.4.10)
27
+ concurrent-ruby (1.1.9)
28
+ connection_pool (2.2.5)
29
+ cool.io (1.7.1)
29
30
  domain_name (0.5.20190701)
30
31
  unf (>= 0.0.5, < 1.0.0)
31
- ffi (1.12.2)
32
+ ffi (1.15.4)
32
33
  ffi-compiler (1.0.1)
33
34
  ffi (>= 1.0.0)
34
35
  rake
35
- fluent-plugin-prometheus (1.7.0)
36
- fluentd (>= 0.14.20, < 2)
37
- prometheus-client (< 0.10)
36
+ fluent-plugin-kubernetes_metadata_filter (2.9.2)
37
+ fluentd (>= 0.14.0, < 1.15)
38
+ kubeclient (>= 4.0.0, < 5.0.0)
39
+ lru_redux
40
+ fluent-plugin-prometheus (2.0.2)
41
+ fluentd (>= 1.9.1, < 2)
42
+ prometheus-client (>= 2.1.0)
38
43
  fluent-plugin-record-modifier (2.1.0)
39
44
  fluentd (>= 1.0, < 2)
40
- fluent-plugin-splunk-hec (1.2.3)
45
+ fluent-plugin-splunk-hec (1.2.7)
41
46
  fluentd (>= 1.4)
42
47
  multi_json (~> 1.13)
43
48
  net-http-persistent (~> 3.1)
44
49
  openid_connect (~> 1.1.8)
45
- prometheus-client (< 0.10.0)
46
- fluentd (1.9.1)
50
+ prometheus-client (>= 2.1.0)
51
+ fluentd (1.14.2)
52
+ bundler
47
53
  cool.io (>= 1.4.5, < 2.0.0)
48
- http_parser.rb (>= 0.5.1, < 0.7.0)
54
+ http_parser.rb (>= 0.5.1, < 0.8.0)
49
55
  msgpack (>= 1.3.1, < 2.0.0)
50
- serverengine (>= 2.0.4, < 3.0.0)
56
+ serverengine (>= 2.2.2, < 3.0.0)
51
57
  sigdump (~> 0.2.2)
52
- strptime (>= 0.2.2, < 1.0.0)
58
+ strptime (>= 0.2.4, < 1.0.0)
53
59
  tzinfo (>= 1.0, < 3.0)
54
60
  tzinfo-data (~> 1.0)
61
+ webrick (>= 1.4.2, < 1.8.0)
55
62
  yajl-ruby (~> 1.0)
56
- http (4.3.0)
63
+ http (4.4.1)
57
64
  addressable (~> 2.3)
58
65
  http-cookie (~> 1.0)
59
66
  http-form_data (~> 2.2)
60
67
  http-parser (~> 1.2.0)
61
68
  http-accept (1.7.0)
62
- http-cookie (1.0.3)
69
+ http-cookie (1.0.4)
63
70
  domain_name (~> 0.5)
64
- http-form_data (2.2.0)
65
- http-parser (1.2.1)
71
+ http-form_data (2.3.0)
72
+ http-parser (1.2.3)
66
73
  ffi-compiler (>= 1.0, < 2.0)
67
74
  http_parser.rb (0.5.3)
68
75
  httpclient (2.8.3)
69
- i18n (1.8.2)
76
+ i18n (1.8.11)
70
77
  concurrent-ruby (~> 1.0)
71
- json-jwt (1.11.0)
78
+ json-jwt (1.13.0)
72
79
  activesupport (>= 4.2)
73
80
  aes_key_wrap
74
81
  bindata
@@ -76,14 +83,15 @@ GEM
76
83
  http (>= 3.0, < 5.0)
77
84
  recursive-open-struct (~> 1.0, >= 1.0.4)
78
85
  rest-client (~> 2.0)
86
+ lru_redux (1.1.0)
79
87
  mail (2.7.1)
80
88
  mini_mime (>= 0.1.1)
81
89
  mime-types (3.3.1)
82
90
  mime-types-data (~> 3.2015)
83
- mime-types-data (3.2019.1009)
84
- mini_mime (1.0.2)
85
- minitest (5.14.0)
86
- msgpack (1.3.3)
91
+ mime-types-data (3.2021.0901)
92
+ mini_mime (1.1.2)
93
+ minitest (5.14.4)
94
+ msgpack (1.4.2)
87
95
  multi_json (1.14.1)
88
96
  net-http-persistent (3.1.0)
89
97
  connection_pool (~> 2.2)
@@ -99,61 +107,61 @@ GEM
99
107
  validate_email
100
108
  validate_url
101
109
  webfinger (>= 1.0.1)
102
- prometheus-client (0.9.0)
103
- quantile (~> 0.2.1)
104
- public_suffix (4.0.3)
105
- quantile (0.2.1)
110
+ prometheus-client (2.1.0)
111
+ public_suffix (4.0.6)
106
112
  rack (2.2.3)
107
- rack-oauth2 (1.16.0)
113
+ rack-oauth2 (1.19.0)
108
114
  activesupport
109
115
  attr_required
110
116
  httpclient
111
117
  json-jwt (>= 1.11.0)
112
118
  rack (>= 2.1.0)
113
- rake (13.0.1)
114
- recursive-open-struct (1.1.0)
119
+ rake (13.0.6)
120
+ recursive-open-struct (1.1.3)
115
121
  rest-client (2.1.0)
116
122
  http-accept (>= 1.7.0, < 2.0)
117
123
  http-cookie (>= 1.0.2, < 2.0)
118
124
  mime-types (>= 1.16, < 4.0)
119
125
  netrc (~> 0.8)
120
- serverengine (2.2.1)
126
+ serverengine (2.2.4)
121
127
  sigdump (~> 0.2.2)
122
128
  sigdump (0.2.4)
123
- strptime (0.2.3)
124
- swd (1.1.2)
129
+ strptime (0.2.5)
130
+ swd (1.3.0)
125
131
  activesupport (>= 3)
126
132
  attr_required (>= 0.0.5)
127
133
  httpclient (>= 2.4)
128
- thread_safe (0.3.6)
129
- tzinfo (1.2.6)
130
- thread_safe (~> 0.1)
131
- tzinfo-data (1.2019.3)
134
+ tzinfo (2.0.4)
135
+ concurrent-ruby (~> 1.0)
136
+ tzinfo-data (1.2021.5)
132
137
  tzinfo (>= 1.0.0)
133
138
  unf (0.1.4)
134
139
  unf_ext
135
- unf_ext (0.0.7.6)
140
+ unf_ext (0.0.8)
136
141
  validate_email (0.1.6)
137
142
  activemodel (>= 3.0)
138
143
  mail (>= 2.2.5)
139
- validate_url (1.0.8)
144
+ validate_url (1.0.13)
140
145
  activemodel (>= 3.0.0)
141
146
  public_suffix
142
- webfinger (1.1.0)
147
+ webfinger (1.2.0)
143
148
  activesupport
144
149
  httpclient (>= 2.4)
150
+ webrick (1.7.0)
145
151
  yajl-ruby (1.4.1)
152
+ zeitwerk (2.5.1)
146
153
 
147
154
  PLATFORMS
148
155
  ruby
149
156
 
150
157
  DEPENDENCIES
151
- bigdecimal (= 1.4.3)
158
+ bigdecimal (= 3.0.0)
152
159
  fluent-plugin-k8s-metrics-agg!
153
- fluent-plugin-prometheus (= 1.7.0)
160
+ fluent-plugin-kubernetes_metadata_filter (>= 2.9.2)
161
+ fluent-plugin-prometheus (>= 2.0)
154
162
  fluent-plugin-record-modifier (= 2.1.0)
155
- fluent-plugin-splunk-hec (>= 1.2.3)
156
- fluentd (= 1.9.1)
163
+ fluent-plugin-splunk-hec (>= 1.2.7)
164
+ fluentd (>= 1.14.2)
157
165
  http_parser.rb (= 0.5.3)
158
166
  kubeclient (= 4.6.0)
159
167
  multi_json (= 1.14.1)
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'test-unit', "~> 3.3.0"
26
26
  spec.add_development_dependency "simplecov", '~> 0.16.1'
27
27
  spec.add_development_dependency 'webmock', '~> 3.5.1'
28
- spec.add_runtime_dependency 'fluentd', '~> 1.9.1'
28
+ spec.add_runtime_dependency 'fluentd', '>= 1.9.1'
29
29
  spec.add_runtime_dependency 'kubeclient', '~> 4.6.0'
30
30
  spec.add_runtime_dependency 'multi_json', '~> 1.14.1'
31
31
  spec.add_runtime_dependency 'oj', '~> 3.10.2'
@@ -575,23 +575,25 @@ module Fluent
575
575
 
576
576
  node_response = JSON.parse(node_rest_client.get(@client.headers))
577
577
  Array(node_response['pods']).each do |pod_json|
578
- pod_cpu_usage = pod_json['cpu']['usageNanoCores']/ 1_000_000
579
- pod_memory_usage = pod_json['memory']['usageBytes']
580
- pod_namespace = pod_json['podRef']['namespace']
581
- pod_usage = ResourceUsageMetricsUnit.new
582
- pod_usage.add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
583
- if @@namespace_resource_usage_metrics_map[pod_namespace].nil?
584
- namespace_usage_metrics = ResourceUsageMetricsUnit.new
585
- @@namespace_resource_usage_metrics_map[pod_namespace] = pod_usage
586
- else
587
- @@namespace_resource_usage_metrics_map[pod_namespace].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
588
- end
589
- if @@node_resource_usage_metrics_map[node_name].nil?
590
- node_name_usage_metrics = ResourceUsageMetricsUnit.new
591
- @@node_resource_usage_metrics_map[node_name] = node_name_usage_metrics
578
+ unless pod_json['cpu'].nil? || pod_json['memory'].nil?
579
+ pod_cpu_usage = pod_json['cpu'].fetch('usageNanoCores', 0)/ 1_000_000
580
+ pod_memory_usage = pod_json['memory'].fetch('usageBytes', 0)
581
+ pod_namespace = pod_json['podRef']['namespace']
582
+ pod_usage = ResourceUsageMetricsUnit.new
583
+ pod_usage.add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
584
+ if @@namespace_resource_usage_metrics_map[pod_namespace].nil?
585
+ namespace_usage_metrics = ResourceUsageMetricsUnit.new
586
+ @@namespace_resource_usage_metrics_map[pod_namespace] = pod_usage
587
+ else
588
+ @@namespace_resource_usage_metrics_map[pod_namespace].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
589
+ end
590
+ if @@node_resource_usage_metrics_map[node_name].nil?
591
+ node_name_usage_metrics = ResourceUsageMetricsUnit.new
592
+ @@node_resource_usage_metrics_map[node_name] = node_name_usage_metrics
593
+ end
594
+ @@node_resource_usage_metrics_map[node_name].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
595
+ pod_usage = nil
592
596
  end
593
- @@node_resource_usage_metrics_map[node_name].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
594
- pod_usage = nil
595
597
  end
596
598
  end
597
599
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-k8s-metrics-agg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Splunk Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-29 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: bundler
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: fluentd
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.9.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.9.1
97
97
  - !ruby/object:Gem::Dependency
@@ -144,13 +144,11 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
- - ".circleci/config.yml"
148
- - ".circleci/install_dep.sh"
149
- - ".circleci/trigger_func_test.sh"
150
147
  - ".github/ISSUE_TEMPLATE/bug_report.md"
151
148
  - ".github/ISSUE_TEMPLATE/enhancement_request.md"
152
149
  - ".github/ISSUE_TEMPLATE/failing_test.md"
153
150
  - ".github/PULL_REQUEST_TEMPLATE.md"
151
+ - ".github/workflows/ci_build_test.yaml"
154
152
  - ".gitignore"
155
153
  - CLA.md
156
154
  - CONTRIBUTING.md
@@ -162,9 +160,11 @@ files:
162
160
  - README.md
163
161
  - Rakefile
164
162
  - VERSION
163
+ - ci_scripts/deploy_connector.sh
164
+ - ci_scripts/install_dep.sh
165
+ - ci_scripts/k8s-splunk.yml
165
166
  - docker/CONTRIBUTING.md
166
167
  - docker/Dockerfile
167
- - docker/FLUENTD_HEC_GEM_VERSION
168
168
  - docker/Gemfile
169
169
  - docker/Gemfile.lock
170
170
  - docker/LICENSE
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubygems_version: 3.1.1
204
+ rubygems_version: 3.0.1
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: A fluentd input plugin that collects kubernetes cluster metrics.
data/.circleci/config.yml DELETED
@@ -1,88 +0,0 @@
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
- unit_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
- bundle exec rake test -t -v
43
-
44
- func_test_master:
45
- docker:
46
- - image: circleci/ruby:2.6.1-node-browsers
47
- working_directory: ~/repo
48
- steps:
49
- - checkout
50
- - setup_remote_docker:
51
- reusable: true
52
- - run:
53
- name: trigger
54
- command: |
55
- .circleci/trigger_func_test.sh master
56
-
57
- func_test_develop:
58
- docker:
59
- - image: circleci/ruby:2.6.1-node-browsers
60
- working_directory: ~/repo
61
- steps:
62
- - checkout
63
- - setup_remote_docker:
64
- reusable: true
65
- - run:
66
- name: trigger
67
- command: |
68
- .circleci/trigger_func_test.sh develop
69
-
70
- workflows:
71
- version: 2
72
- build_test_push:
73
- jobs:
74
- - build:
75
- filters:
76
- branches:
77
- ignore:
78
- - /^release\/.*/
79
- - master
80
- - unit_test:
81
- requires:
82
- - build
83
- - func_test_master:
84
- requires:
85
- - unit_test
86
- - func_test_develop:
87
- requires:
88
- - unit_test
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # trigger SCK 'master' branch to introduce this new image from this commit
4
- # to working version of every other component.
5
- ORGANIZATION=splunk
6
- PROJECT=splunk-connect-for-kubernetes
7
- BRANCH=$1
8
-
9
- # Trigger functional test
10
- curl -X POST --header "Content-Type: application/json" \
11
- -d '{"build_parameters": {"CIRCLE_JOB":"build_test", "TRIG_BRANCH":"'"$CIRCLE_BRANCH"'", "TRIG_PROJECT":"'"$CIRCLE_PROJECT_REPONAME"'", "TRIG_REPO":"'"$CIRCLE_REPOSITORY_URL"'"}}' "https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/tree/$BRANCH?circle-token=$CIRCLE_TOKEN" > build.json
12
- cat build.json
13
- BUILD_NUM=$(jq -r .build_num build.json)
14
- sleep 10
15
-
16
- # Wait until finish or maximum 20 minutes
17
- TIMEOUT=20
18
- DONE="FALSE"
19
- until [ "$TIMEOUT" -lt 0 ] || [ "$DONE" == "TRUE" ]; do
20
- curl https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/$BUILD_NUM?circle-token=$CIRCLE_TOKEN > build_progress.json
21
- STATUS=$(jq -r .status build_progress.json)
22
- echo "STATUS = $STATUS"
23
- if [ "$STATUS" != "running" ] && [ "$STATUS" != "queued" ]; then
24
- DONE="TRUE"
25
- else
26
- let TIMEOUT--
27
- sleep 60
28
- fi
29
- done
30
-
31
- BUILD_URL=$(jq -r .build_url build_progress.json)
32
- if [ "$DONE" == "FALSE" ]; then
33
- # Cancel hanging job and fail
34
- curl -X POST https://circleci.com/api/v1/project/$ORGANIZATION/$PROJECT/$BUILD_NUM/cancel?circle-token=$CIRCLE_TOKEN
35
- else
36
- if [ "$STATUS" != "success" ] && [ "$STATUS" != "fixed" ]; then
37
- echo "Functional test have failed please see:"
38
- echo $BUILD_URL
39
- exit 1
40
- fi
41
- exit 0
42
- fi
@@ -1 +0,0 @@
1
- 1.2.1