fluent-plugin-kubernetes_metadata_filter 2.1.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +53 -0
  3. data/.gitignore +0 -2
  4. data/.rubocop.yml +57 -0
  5. data/Gemfile +4 -2
  6. data/Gemfile.lock +159 -0
  7. data/README.md +49 -60
  8. data/Rakefile +15 -11
  9. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/cpu.png +0 -0
  10. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/latency.png +0 -0
  11. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/loss.png +0 -0
  12. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/mem.png +0 -0
  13. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/readme.md +88 -0
  14. data/doc/benchmark/5m-1-2500lps-256b-baseline-01/results.html +127 -0
  15. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/cpu.png +0 -0
  16. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/latency.png +0 -0
  17. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/loss.png +0 -0
  18. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/mem.png +0 -0
  19. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/readme.md +97 -0
  20. data/doc/benchmark/5m-1-2500lps-256b-kube-01-01/results.html +136 -0
  21. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/cpu.png +0 -0
  22. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/latency.png +0 -0
  23. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/loss.png +0 -0
  24. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/mem.png +0 -0
  25. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/readme.md +97 -0
  26. data/doc/benchmark/5m-1-2500lps-256b-kube-01-marshal-02/results.html +136 -0
  27. data/fluent-plugin-kubernetes_metadata_filter.gemspec +25 -28
  28. data/lib/fluent/plugin/filter_kubernetes_metadata.rb +207 -187
  29. data/lib/fluent/plugin/kubernetes_metadata_cache_strategy.rb +30 -23
  30. data/lib/fluent/plugin/kubernetes_metadata_common.rb +66 -24
  31. data/lib/fluent/plugin/kubernetes_metadata_stats.rb +21 -5
  32. data/lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb +68 -0
  33. data/lib/fluent/plugin/kubernetes_metadata_util.rb +33 -0
  34. data/lib/fluent/plugin/kubernetes_metadata_watch_namespaces.rb +154 -27
  35. data/lib/fluent/plugin/kubernetes_metadata_watch_pods.rb +171 -29
  36. data/release_notes.md +42 -0
  37. data/test/cassettes/kubernetes_docker_metadata_annotations.yml +0 -34
  38. data/test/cassettes/{kubernetes_docker_metadata_dotted_labels.yml → kubernetes_docker_metadata_dotted_slashed_labels.yml} +0 -34
  39. data/test/cassettes/kubernetes_get_api_v1.yml +193 -0
  40. data/test/cassettes/kubernetes_get_api_v1_using_token.yml +195 -0
  41. data/test/cassettes/kubernetes_get_namespace_default.yml +72 -0
  42. data/test/cassettes/kubernetes_get_namespace_default_using_token.yml +71 -0
  43. data/test/cassettes/{kubernetes_docker_metadata.yml → kubernetes_get_pod.yml} +0 -82
  44. data/test/cassettes/kubernetes_get_pod_container_init.yml +145 -0
  45. data/test/cassettes/{metadata_with_namespace_id.yml → kubernetes_get_pod_using_token.yml} +2 -130
  46. data/test/cassettes/{kubernetes_docker_metadata_using_bearer_token.yml → kubernetes_get_pod_with_ownerrefs.yml} +17 -109
  47. data/test/cassettes/metadata_from_tag_and_journald_fields.yml +153 -0
  48. data/test/cassettes/metadata_from_tag_journald_and_kubernetes_fields.yml +285 -0
  49. data/test/cassettes/{non_kubernetes_docker_metadata.yml → valid_kubernetes_api_server_using_token.yml} +4 -44
  50. data/test/helper.rb +20 -2
  51. data/test/plugin/test_cache_stats.rb +10 -13
  52. data/test/plugin/test_cache_strategy.rb +158 -160
  53. data/test/plugin/test_filter_kubernetes_metadata.rb +451 -314
  54. data/test/plugin/test_watch_namespaces.rb +209 -55
  55. data/test/plugin/test_watch_pods.rb +302 -71
  56. data/test/plugin/watch_test.rb +52 -33
  57. metadata +91 -70
  58. data/circle.yml +0 -17
@@ -18,40 +18,6 @@
18
18
  #
19
19
  ---
20
20
  http_interactions:
21
- - request:
22
- method: get
23
- uri: https://localhost:8443/api
24
- body:
25
- encoding: US-ASCII
26
- string: ''
27
- headers:
28
- Accept:
29
- - "*/*; q=0.5, application/xml"
30
- Accept-Encoding:
31
- - gzip, deflate
32
- User-Agent:
33
- - Ruby
34
- response:
35
- status:
36
- code: 200
37
- message: OK
38
- headers:
39
- Content-Type:
40
- - application/json
41
- Date:
42
- - Fri, 08 May 2015 10:35:37 GMT
43
- Content-Length:
44
- - '67'
45
- body:
46
- encoding: UTF-8
47
- string: |-
48
- {
49
- "versions": [
50
- "v1"
51
- ]
52
- }
53
- http_version:
54
- recorded_at: Fri, 08 May 2015 10:35:37 GMT
55
21
  - request:
56
22
  method: get
57
23
  uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
@@ -65,6 +31,8 @@ http_interactions:
65
31
  - gzip, deflate
66
32
  User-Agent:
67
33
  - Ruby
34
+ Authorization:
35
+ - Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
68
36
  response:
69
37
  status:
70
38
  code: 200
@@ -177,100 +145,4 @@ http_interactions:
177
145
  }
178
146
  http_version:
179
147
  recorded_at: Fri, 08 May 2015 10:35:37 GMT
180
- - request:
181
- method: get
182
- uri: https://localhost:8443/api/v1/namespaces/default
183
- body:
184
- encoding: US-ASCII
185
- string: ''
186
- headers:
187
- Accept:
188
- - "*/*; q=0.5, application/xml"
189
- Accept-Encoding:
190
- - gzip, deflate
191
- User-Agent:
192
- - Ruby
193
- response:
194
- status:
195
- code: 200
196
- message: OK
197
- headers:
198
- Content-Type:
199
- - application/json
200
- Date:
201
- - Fri, 08 May 2015 10:35:37 GMT
202
- Transfer-Encoding:
203
- - chunked
204
- body:
205
- encoding: UTF-8
206
- string: |-
207
- {
208
- "kind": "Namespace",
209
- "apiVersion": "v1",
210
- "metadata": {
211
- "name": "default",
212
- "selfLink": "/api/v1/namespaces/default",
213
- "uid": "898268c8-4a36-11e5-9d81-42010af0194c",
214
- "resourceVersion": "6",
215
- "creationTimestamp": "2015-05-08T09:22:01Z"
216
- },
217
- "spec": {
218
- "finalizers": [
219
- "kubernetes"
220
- ]
221
- },
222
- "status": {
223
- "phase": "Active"
224
- }
225
- }
226
- http_version:
227
- recorded_at: Fri, 08 May 2015 10:35:37 GMT
228
- - request:
229
- method: get
230
- uri: https://localhost:8443/api/v1/namespaces/default
231
- body:
232
- encoding: US-ASCII
233
- string: ''
234
- headers:
235
- Accept:
236
- - "*/*; q=0.5, application/xml"
237
- Accept-Encoding:
238
- - gzip, deflate
239
- User-Agent:
240
- - Ruby
241
- response:
242
- status:
243
- code: 200
244
- message: OK
245
- headers:
246
- Content-Type:
247
- - application/json
248
- Date:
249
- - Fri, 08 May 2015 10:35:37 GMT
250
- Transfer-Encoding:
251
- - chunked
252
- body:
253
- encoding: UTF-8
254
- string: |-
255
- {
256
- "kind": "Namespace",
257
- "apiVersion": "v1",
258
- "metadata": {
259
- "name": "default",
260
- "selfLink": "/api/v1/namespaces/default",
261
- "uid": "898268c8-4a36-11e5-9d81-42010af0194c",
262
- "resourceVersion": "6",
263
- "creationTimestamp": "2015-05-08T09:22:01Z"
264
- },
265
- "spec": {
266
- "finalizers": [
267
- "kubernetes"
268
- ]
269
- },
270
- "status": {
271
- "phase": "Active"
272
- }
273
- }
274
- http_version:
275
- recorded_at: Fri, 08 May 2015 10:35:37 GMT
276
148
  recorded_with: VCR 2.9.3
@@ -18,42 +18,6 @@
18
18
  #
19
19
  ---
20
20
  http_interactions:
21
- - request:
22
- method: get
23
- uri: https://localhost:8443/api
24
- body:
25
- encoding: US-ASCII
26
- string: ''
27
- headers:
28
- Accept:
29
- - "*/*; q=0.5, application/xml"
30
- Accept-Encoding:
31
- - gzip, deflate
32
- User-Agent:
33
- - Ruby
34
- Authorization:
35
- - Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
36
- response:
37
- status:
38
- code: 200
39
- message: OK
40
- headers:
41
- Content-Type:
42
- - application/json
43
- Date:
44
- - Sat, 09 May 2015 13:51:07 GMT
45
- Content-Length:
46
- - '67'
47
- body:
48
- encoding: UTF-8
49
- string: |-
50
- {
51
- "versions": [
52
- "v1"
53
- ]
54
- }
55
- http_version:
56
- recorded_at: Sat, 09 May 2015 13:51:07 GMT
57
21
  - request:
58
22
  method: get
59
23
  uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
@@ -67,8 +31,6 @@ http_interactions:
67
31
  - gzip, deflate
68
32
  User-Agent:
69
33
  - Ruby
70
- Authorization:
71
- - Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
72
34
  response:
73
35
  status:
74
36
  code: 200
@@ -77,7 +39,7 @@ http_interactions:
77
39
  Content-Type:
78
40
  - application/json
79
41
  Date:
80
- - Sat, 09 May 2015 13:51:07 GMT
42
+ - Fri, 08 May 2015 10:35:37 GMT
81
43
  Transfer-Encoding:
82
44
  - chunked
83
45
  body:
@@ -92,11 +54,21 @@ http_interactions:
92
54
  "namespace": "default",
93
55
  "selfLink": "/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc",
94
56
  "uid": "c76927af-f563-11e4-b32d-54ee7527188d",
95
- "resourceVersion": "3556",
57
+ "resourceVersion": "122",
96
58
  "creationTimestamp": "2015-05-08T09:22:42Z",
97
59
  "labels": {
98
60
  "component": "fabric8Console"
99
- }
61
+ },
62
+ "ownerReferences": [
63
+ {
64
+ "apiVersion": "apps/v1",
65
+ "blockOwnerDeletion": true,
66
+ "controller": true,
67
+ "kind": "ReplicaSet",
68
+ "name": "fabric8-console-controller",
69
+ "uid": "dd1ac3e1-bc88-4c54-be0f-26ac2406d884"
70
+ }
71
+ ]
100
72
  },
101
73
  "spec": {
102
74
  "volumes": [
@@ -160,89 +132,25 @@ http_interactions:
160
132
  }
161
133
  ],
162
134
  "hostIP": "172.17.42.1",
163
- "podIP": "172.17.0.4",
135
+ "podIP": "172.17.0.8",
164
136
  "containerStatuses": [
165
137
  {
166
138
  "name": "fabric8-console-container",
167
139
  "state": {
168
140
  "running": {
169
- "startedAt": "2015-05-09T13:33:38Z"
141
+ "startedAt": "2015-05-08T09:22:44Z"
170
142
  }
171
143
  },
172
144
  "lastState": {},
173
145
  "ready": true,
174
- "restartCount": 2,
146
+ "restartCount": 0,
175
147
  "image": "fabric8/hawtio-kubernetes:latest",
176
148
  "imageID": "docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303",
177
- "containerID": "docker://1b1d1f61c1205fe73328c75b2945e2ce05acfba2fde16299a8103fb22e9ec58a"
178
- },
179
- {
180
- "name": "POD",
181
- "state": {
182
- "termination": {
183
- "exitCode": 0,
184
- "startedAt": "2015-05-09T09:45:08Z",
185
- "finishedAt": "2015-05-09T09:47:00Z"
186
- }
187
- },
188
- "lastState": {},
189
- "ready": false,
190
- "restartCount": 1,
191
- "image": "openshift/origin-pod:v0.4.4",
192
- "imageID": "docker://81fa37a83ec46fed9dddf30a9c3c43f54bfe4b65dea74a4c152fd515a0bf92a8",
193
- "containerID": "docker://9c8ed1a9bbb6d9804b12379654461dcd3b447438c02c52ca7f7d2504e14ae96b"
149
+ "containerID": "docker://49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459"
194
150
  }
195
151
  ]
196
152
  }
197
153
  }
198
154
  http_version:
199
- recorded_at: Sat, 09 May 2015 13:51:07 GMT
200
- - request:
201
- method: get
202
- uri: https://localhost:8443/api/v1/namespaces/default
203
- body:
204
- encoding: US-ASCII
205
- string: ''
206
- headers:
207
- Accept:
208
- - "*/*; q=0.5, application/xml"
209
- Accept-Encoding:
210
- - gzip, deflate
211
- User-Agent:
212
- - Ruby
213
- response:
214
- status:
215
- code: 200
216
- message: OK
217
- headers:
218
- Content-Type:
219
- - application/json
220
- Date:
221
- - Fri, 08 May 2015 10:35:37 GMT
222
- Transfer-Encoding:
223
- - chunked
224
- body:
225
- encoding: UTF-8
226
- string: |-
227
- {
228
- "kind": "Namespace",
229
- "apiVersion": "v1",
230
- "metadata": {
231
- "name": "default",
232
- "selfLink": "/api/v1/namespaces/default",
233
- "uid": "898268c8-4a36-11e5-9d81-42010af0194c",
234
- "resourceVersion": "6",
235
- "creationTimestamp": "2015-05-08T09:22:01Z"
236
- },
237
- "spec": {
238
- "finalizers": [
239
- "kubernetes"
240
- ]
241
- },
242
- "status": {
243
- "phase": "Active"
244
- }
245
- }
246
- http_version:
247
155
  recorded_at: Fri, 08 May 2015 10:35:37 GMT
248
156
  recorded_with: VCR 2.9.3
@@ -0,0 +1,153 @@
1
+ #
2
+ # Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
3
+ # Kubernetes metadata
4
+ #
5
+ # Copyright 2015 Red Hat, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ---
20
+ http_interactions:
21
+ - request:
22
+ method: get
23
+ uri: https://localhost:8443/api/v1/namespaces/journald-namespace-name/pods/journald-pod-name
24
+ body:
25
+ encoding: US-ASCII
26
+ string: ''
27
+ headers:
28
+ Accept:
29
+ - "*/*; q=0.5, application/xml"
30
+ Accept-Encoding:
31
+ - gzip, deflate
32
+ User-Agent:
33
+ - Ruby
34
+ response:
35
+ status:
36
+ code: 200
37
+ message: OK
38
+ headers:
39
+ Content-Type:
40
+ - application/json
41
+ Date:
42
+ - Fri, 08 May 2015 10:35:37 GMT
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: |-
48
+ {
49
+ "kind": "Pod",
50
+ "apiVersion": "v1",
51
+ "metadata": {
52
+ "name": "journald-pod-name",
53
+ "generateName": "journald-pod-name-",
54
+ "namespace": "journald-namespace-name",
55
+ "selfLink": "/api/v1/namespaces/journald-namespace-name/pods/journald-pod-name",
56
+ "uid": "5e1c1e27-b637-4e81-80b6-6d8a8c404d3b",
57
+ "resourceVersion": "122",
58
+ "creationTimestamp": "2015-05-08T09:22:42Z",
59
+ "labels": {
60
+ "component": "journald-test"
61
+ }
62
+ },
63
+ "spec": {
64
+ "containers": [
65
+ {
66
+ "name": "journald-container-name",
67
+ "image": "journald-container-image:latest",
68
+ "terminationMessagePath": "/dev/termination-log",
69
+ "imagePullPolicy": "IfNotPresent",
70
+ "capabilities": {}
71
+ }
72
+ ],
73
+ "nodeName": "jimmi-redhat.localnet"
74
+ },
75
+ "status": {
76
+ "phase": "Running",
77
+ "Condition": [
78
+ {
79
+ "type": "Ready",
80
+ "status": "True"
81
+ }
82
+ ],
83
+ "hostIP": "172.17.42.1",
84
+ "podIP": "172.17.0.8",
85
+ "containerStatuses": [
86
+ {
87
+ "name": "journald-container-name",
88
+ "state": {
89
+ "running": {
90
+ "startedAt": "2015-05-08T09:22:44Z"
91
+ }
92
+ },
93
+ "lastState": {},
94
+ "ready": true,
95
+ "restartCount": 0,
96
+ "image": "journald-container-image:latest",
97
+ "imageID": "docker://dda4c95705fb7050b701b10a7fe928ca5bc971a1dcb521ae3c339194cbf36b47",
98
+ "containerID": "docker://838350c64bacba968d39a30a50789b2795291fceca6ccbff55298671d46b0e3b"
99
+ }
100
+ ]
101
+ }
102
+ }
103
+ http_version:
104
+ recorded_at: Fri, 08 May 2015 10:35:37 GMT
105
+ - request:
106
+ method: get
107
+ uri: https://localhost:8443/api/v1/namespaces/journald-namespace-name
108
+ body:
109
+ encoding: US-ASCII
110
+ string: ''
111
+ headers:
112
+ Accept:
113
+ - "*/*; q=0.5, application/xml"
114
+ Accept-Encoding:
115
+ - gzip, deflate
116
+ User-Agent:
117
+ - Ruby
118
+ response:
119
+ status:
120
+ code: 200
121
+ message: OK
122
+ headers:
123
+ Content-Type:
124
+ - application/json
125
+ Date:
126
+ - Fri, 08 May 2015 10:35:37 GMT
127
+ Transfer-Encoding:
128
+ - chunked
129
+ body:
130
+ encoding: UTF-8
131
+ string: |-
132
+ {
133
+ "kind": "Namespace",
134
+ "apiVersion": "v1",
135
+ "metadata": {
136
+ "name": "journald-namespace-name",
137
+ "selfLink": "/api/v1/namespaces/journald-namespace-name",
138
+ "uid": "8282888f-733f-4f23-a3d3-1fdfa3bdacf2",
139
+ "resourceVersion": "6",
140
+ "creationTimestamp": "2015-05-08T09:22:01Z"
141
+ },
142
+ "spec": {
143
+ "finalizers": [
144
+ "kubernetes"
145
+ ]
146
+ },
147
+ "status": {
148
+ "phase": "Active"
149
+ }
150
+ }
151
+ http_version:
152
+ recorded_at: Fri, 08 May 2015 10:35:37 GMT
153
+ recorded_with: VCR 2.9.3