fluent-plugin-kubernetes_metadata_filter_v0.14 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +201 -0
- data/README.md +141 -0
- data/Rakefile +37 -0
- data/circle.yml +7 -0
- data/fluent-plugin-kubernetes_metadata_filter.gemspec +38 -0
- data/lib/fluent/plugin/filter_kubernetes_metadata.rb +417 -0
- data/test/cassettes/invalid_api_server_config.yml +53 -0
- data/test/cassettes/kubernetes_docker_metadata.yml +180 -0
- data/test/cassettes/kubernetes_docker_metadata_annotations.yml +188 -0
- data/test/cassettes/kubernetes_docker_metadata_dotted_labels.yml +180 -0
- data/test/cassettes/kubernetes_docker_metadata_using_bearer_token.yml +200 -0
- data/test/cassettes/metadata_with_namespace_id.yml +228 -0
- data/test/cassettes/non_kubernetes_docker_metadata.yml +97 -0
- data/test/cassettes/valid_kubernetes_api_server.yml +55 -0
- data/test/helper.rb +63 -0
- data/test/plugin/test.token +1 -0
- data/test/plugin/test_filter_kubernetes_metadata.rb +537 -0
- metadata +270 -0
@@ -0,0 +1,200 @@
|
|
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
|
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
|
+
- request:
|
58
|
+
method: get
|
59
|
+
uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
|
60
|
+
body:
|
61
|
+
encoding: US-ASCII
|
62
|
+
string: ''
|
63
|
+
headers:
|
64
|
+
Accept:
|
65
|
+
- "*/*; q=0.5, application/xml"
|
66
|
+
Accept-Encoding:
|
67
|
+
- gzip, deflate
|
68
|
+
User-Agent:
|
69
|
+
- Ruby
|
70
|
+
Authorization:
|
71
|
+
- Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
|
72
|
+
response:
|
73
|
+
status:
|
74
|
+
code: 200
|
75
|
+
message: OK
|
76
|
+
headers:
|
77
|
+
Content-Type:
|
78
|
+
- application/json
|
79
|
+
Date:
|
80
|
+
- Sat, 09 May 2015 13:51:07 GMT
|
81
|
+
Transfer-Encoding:
|
82
|
+
- chunked
|
83
|
+
body:
|
84
|
+
encoding: UTF-8
|
85
|
+
string: |-
|
86
|
+
{
|
87
|
+
"kind": "Pod",
|
88
|
+
"apiVersion": "v1",
|
89
|
+
"metadata": {
|
90
|
+
"name": "fabric8-console-controller-98rqc",
|
91
|
+
"generateName": "fabric8-console-controller-",
|
92
|
+
"namespace": "default",
|
93
|
+
"selfLink": "/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc",
|
94
|
+
"uid": "c76927af-f563-11e4-b32d-54ee7527188d",
|
95
|
+
"resourceVersion": "3556",
|
96
|
+
"creationTimestamp": "2015-05-08T09:22:42Z",
|
97
|
+
"labels": {
|
98
|
+
"component": "fabric8Console"
|
99
|
+
}
|
100
|
+
},
|
101
|
+
"spec": {
|
102
|
+
"volumes": [
|
103
|
+
{
|
104
|
+
"name": "openshift-cert-secrets",
|
105
|
+
"hostPath": null,
|
106
|
+
"emptyDir": null,
|
107
|
+
"gcePersistentDisk": null,
|
108
|
+
"gitRepo": null,
|
109
|
+
"secret": {
|
110
|
+
"secretName": "openshift-cert-secrets"
|
111
|
+
},
|
112
|
+
"nfs": null,
|
113
|
+
"iscsi": null,
|
114
|
+
"glusterfs": null
|
115
|
+
}
|
116
|
+
],
|
117
|
+
"containers": [
|
118
|
+
{
|
119
|
+
"name": "fabric8-console-container",
|
120
|
+
"image": "fabric8/hawtio-kubernetes:latest",
|
121
|
+
"ports": [
|
122
|
+
{
|
123
|
+
"containerPort": 9090,
|
124
|
+
"protocol": "TCP"
|
125
|
+
}
|
126
|
+
],
|
127
|
+
"env": [
|
128
|
+
{
|
129
|
+
"name": "OAUTH_CLIENT_ID",
|
130
|
+
"value": "fabric8-console"
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"name": "OAUTH_AUTHORIZE_URI",
|
134
|
+
"value": "https://localhost:8443/oauth/authorize"
|
135
|
+
}
|
136
|
+
],
|
137
|
+
"resources": {},
|
138
|
+
"volumeMounts": [
|
139
|
+
{
|
140
|
+
"name": "openshift-cert-secrets",
|
141
|
+
"readOnly": true,
|
142
|
+
"mountPath": "/etc/secret-volume"
|
143
|
+
}
|
144
|
+
],
|
145
|
+
"terminationMessagePath": "/dev/termination-log",
|
146
|
+
"imagePullPolicy": "IfNotPresent",
|
147
|
+
"capabilities": {}
|
148
|
+
}
|
149
|
+
],
|
150
|
+
"restartPolicy": "Always",
|
151
|
+
"dnsPolicy": "ClusterFirst",
|
152
|
+
"nodeName": "jimmi-redhat.localnet"
|
153
|
+
},
|
154
|
+
"status": {
|
155
|
+
"phase": "Running",
|
156
|
+
"Condition": [
|
157
|
+
{
|
158
|
+
"type": "Ready",
|
159
|
+
"status": "True"
|
160
|
+
}
|
161
|
+
],
|
162
|
+
"hostIP": "172.17.42.1",
|
163
|
+
"podIP": "172.17.0.4",
|
164
|
+
"containerStatuses": [
|
165
|
+
{
|
166
|
+
"name": "fabric8-console-container",
|
167
|
+
"state": {
|
168
|
+
"running": {
|
169
|
+
"startedAt": "2015-05-09T13:33:38Z"
|
170
|
+
}
|
171
|
+
},
|
172
|
+
"lastState": {},
|
173
|
+
"ready": true,
|
174
|
+
"restartCount": 2,
|
175
|
+
"image": "fabric8/hawtio-kubernetes:latest",
|
176
|
+
"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"
|
194
|
+
}
|
195
|
+
]
|
196
|
+
}
|
197
|
+
}
|
198
|
+
http_version:
|
199
|
+
recorded_at: Sat, 09 May 2015 13:51:07 GMT
|
200
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,228 @@
|
|
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
|
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
|
+
- request:
|
56
|
+
method: get
|
57
|
+
uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
|
58
|
+
body:
|
59
|
+
encoding: US-ASCII
|
60
|
+
string: ''
|
61
|
+
headers:
|
62
|
+
Accept:
|
63
|
+
- "*/*; q=0.5, application/xml"
|
64
|
+
Accept-Encoding:
|
65
|
+
- gzip, deflate
|
66
|
+
User-Agent:
|
67
|
+
- Ruby
|
68
|
+
response:
|
69
|
+
status:
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
Content-Type:
|
74
|
+
- application/json
|
75
|
+
Date:
|
76
|
+
- Fri, 08 May 2015 10:35:37 GMT
|
77
|
+
Transfer-Encoding:
|
78
|
+
- chunked
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: |-
|
82
|
+
{
|
83
|
+
"kind": "Pod",
|
84
|
+
"apiVersion": "v1",
|
85
|
+
"metadata": {
|
86
|
+
"name": "fabric8-console-controller-98rqc",
|
87
|
+
"generateName": "fabric8-console-controller-",
|
88
|
+
"namespace": "default",
|
89
|
+
"selfLink": "/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc",
|
90
|
+
"uid": "c76927af-f563-11e4-b32d-54ee7527188d",
|
91
|
+
"resourceVersion": "122",
|
92
|
+
"creationTimestamp": "2015-05-08T09:22:42Z",
|
93
|
+
"labels": {
|
94
|
+
"component": "fabric8Console"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
"spec": {
|
98
|
+
"volumes": [
|
99
|
+
{
|
100
|
+
"name": "openshift-cert-secrets",
|
101
|
+
"hostPath": null,
|
102
|
+
"emptyDir": null,
|
103
|
+
"gcePersistentDisk": null,
|
104
|
+
"gitRepo": null,
|
105
|
+
"secret": {
|
106
|
+
"secretName": "openshift-cert-secrets"
|
107
|
+
},
|
108
|
+
"nfs": null,
|
109
|
+
"iscsi": null,
|
110
|
+
"glusterfs": null
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"containers": [
|
114
|
+
{
|
115
|
+
"name": "fabric8-console-container",
|
116
|
+
"image": "fabric8/hawtio-kubernetes:latest",
|
117
|
+
"ports": [
|
118
|
+
{
|
119
|
+
"containerPort": 9090,
|
120
|
+
"protocol": "TCP"
|
121
|
+
}
|
122
|
+
],
|
123
|
+
"env": [
|
124
|
+
{
|
125
|
+
"name": "OAUTH_CLIENT_ID",
|
126
|
+
"value": "fabric8-console"
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"name": "OAUTH_AUTHORIZE_URI",
|
130
|
+
"value": "https://localhost:8443/oauth/authorize"
|
131
|
+
}
|
132
|
+
],
|
133
|
+
"resources": {},
|
134
|
+
"volumeMounts": [
|
135
|
+
{
|
136
|
+
"name": "openshift-cert-secrets",
|
137
|
+
"readOnly": true,
|
138
|
+
"mountPath": "/etc/secret-volume"
|
139
|
+
}
|
140
|
+
],
|
141
|
+
"terminationMessagePath": "/dev/termination-log",
|
142
|
+
"imagePullPolicy": "IfNotPresent",
|
143
|
+
"capabilities": {}
|
144
|
+
}
|
145
|
+
],
|
146
|
+
"restartPolicy": "Always",
|
147
|
+
"dnsPolicy": "ClusterFirst",
|
148
|
+
"nodeName": "jimmi-redhat.localnet"
|
149
|
+
},
|
150
|
+
"status": {
|
151
|
+
"phase": "Running",
|
152
|
+
"Condition": [
|
153
|
+
{
|
154
|
+
"type": "Ready",
|
155
|
+
"status": "True"
|
156
|
+
}
|
157
|
+
],
|
158
|
+
"hostIP": "172.17.42.1",
|
159
|
+
"podIP": "172.17.0.8",
|
160
|
+
"containerStatuses": [
|
161
|
+
{
|
162
|
+
"name": "fabric8-console-container",
|
163
|
+
"state": {
|
164
|
+
"running": {
|
165
|
+
"startedAt": "2015-05-08T09:22:44Z"
|
166
|
+
}
|
167
|
+
},
|
168
|
+
"lastState": {},
|
169
|
+
"ready": true,
|
170
|
+
"restartCount": 0,
|
171
|
+
"image": "fabric8/hawtio-kubernetes:latest",
|
172
|
+
"imageID": "docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303",
|
173
|
+
"containerID": "docker://49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459"
|
174
|
+
}
|
175
|
+
]
|
176
|
+
}
|
177
|
+
}
|
178
|
+
http_version:
|
179
|
+
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
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,97 @@
|
|
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
|
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
|
+
- request:
|
56
|
+
method: get
|
57
|
+
uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-forge-controller-ymkew
|
58
|
+
body:
|
59
|
+
encoding: US-ASCII
|
60
|
+
string: ''
|
61
|
+
headers:
|
62
|
+
Accept:
|
63
|
+
- "*/*; q=0.5, application/xml"
|
64
|
+
Accept-Encoding:
|
65
|
+
- gzip, deflate
|
66
|
+
User-Agent:
|
67
|
+
- Ruby
|
68
|
+
response:
|
69
|
+
status:
|
70
|
+
code: 404
|
71
|
+
message: Not Found
|
72
|
+
headers:
|
73
|
+
Content-Type:
|
74
|
+
- application/json
|
75
|
+
Date:
|
76
|
+
- Fri, 08 May 2015 10:35:37 GMT
|
77
|
+
Content-Length:
|
78
|
+
- '278'
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: |-
|
82
|
+
{
|
83
|
+
"kind": "Status",
|
84
|
+
"apiVersion": "v1",
|
85
|
+
"metadata": {},
|
86
|
+
"status": "Failure",
|
87
|
+
"message": "pods \"fabric8-forge-controller-ymkew\" not found",
|
88
|
+
"reason": "NotFound",
|
89
|
+
"details": {
|
90
|
+
"id": "fabric8-forge-controller-ymkew",
|
91
|
+
"kind": "pods"
|
92
|
+
},
|
93
|
+
"code": 404
|
94
|
+
}
|
95
|
+
http_version:
|
96
|
+
recorded_at: Fri, 08 May 2015 10:35:37 GMT
|
97
|
+
recorded_with: VCR 2.9.3
|