fluent-plugin-kubernetes_metadata_filter 2.4.5 → 2.5.2
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 +4 -4
- data/Gemfile.lock +36 -27
- data/README.md +2 -1
- data/fluent-plugin-kubernetes_metadata_filter.gemspec +2 -2
- data/lib/fluent/plugin/filter_kubernetes_metadata.rb +6 -4
- data/lib/fluent/plugin/kubernetes_metadata_common.rb +6 -0
- data/lib/fluent/plugin/kubernetes_metadata_watch_namespaces.rb +15 -3
- data/lib/fluent/plugin/kubernetes_metadata_watch_pods.rb +16 -3
- data/test/plugin/test_watch_namespaces.rb +40 -0
- data/test/plugin/test_watch_pods.rb +40 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a683b622df5649113828c46b650d722a5042c4c92023de4ea3350c1a5057bf8c
|
|
4
|
+
data.tar.gz: 86572e207c7aa2b595510922ac7b3946d3f2f1a4031d3f795d8356700c54d140
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77a3f4c2b33a0fe48e7b85636415d9b1d8d7aa1bba07af6c801290830a14f2c190c2dec76f9d48c7f0bc99131cb785dcf681217c5e42e90f3dfc9a24ad81f6e2
|
|
7
|
+
data.tar.gz: 051563042ca5826bb5f07a00367672b63718aac7a49f4e32cd9b83ba1312493ebafeee5211c8846eb4f3b0d5ec07f22c52d6f24ae059c4c6560d707f8a60404a
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fluent-plugin-kubernetes_metadata_filter (2.
|
|
5
|
-
fluentd (>= 0.14.0, <
|
|
4
|
+
fluent-plugin-kubernetes_metadata_filter (2.5.2)
|
|
5
|
+
fluentd (>= 0.14.0, < 1.12)
|
|
6
6
|
kubeclient (< 5)
|
|
7
7
|
lru_redux
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ GEM
|
|
|
11
11
|
specs:
|
|
12
12
|
addressable (2.7.0)
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
|
14
|
-
ast (2.4.
|
|
14
|
+
ast (2.4.1)
|
|
15
15
|
bump (0.9.0)
|
|
16
16
|
charlock_holmes (0.7.7)
|
|
17
17
|
codeclimate-test-reporter (0.6.0)
|
|
@@ -26,11 +26,11 @@ GEM
|
|
|
26
26
|
domain_name (0.5.20190701)
|
|
27
27
|
unf (>= 0.0.5, < 1.0.0)
|
|
28
28
|
escape_utils (1.2.1)
|
|
29
|
-
ffi (1.
|
|
29
|
+
ffi (1.13.1)
|
|
30
30
|
ffi-compiler (1.0.1)
|
|
31
31
|
ffi (>= 1.0.0)
|
|
32
32
|
rake
|
|
33
|
-
fluentd (1.
|
|
33
|
+
fluentd (1.11.1)
|
|
34
34
|
cool.io (>= 1.4.5, < 2.0.0)
|
|
35
35
|
http_parser.rb (>= 0.5.1, < 0.7.0)
|
|
36
36
|
msgpack (>= 1.3.1, < 2.0.0)
|
|
@@ -40,13 +40,13 @@ GEM
|
|
|
40
40
|
tzinfo (>= 1.0, < 3.0)
|
|
41
41
|
tzinfo-data (~> 1.0)
|
|
42
42
|
yajl-ruby (~> 1.0)
|
|
43
|
-
github-linguist (7.
|
|
43
|
+
github-linguist (7.9.0)
|
|
44
44
|
charlock_holmes (~> 0.7.6)
|
|
45
45
|
escape_utils (~> 1.2.0)
|
|
46
46
|
mini_mime (~> 1.0)
|
|
47
47
|
rugged (>= 0.25.1)
|
|
48
48
|
hashdiff (1.0.1)
|
|
49
|
-
http (4.
|
|
49
|
+
http (4.4.1)
|
|
50
50
|
addressable (~> 2.3)
|
|
51
51
|
http-cookie (~> 1.0)
|
|
52
52
|
http-form_data (~> 2.2)
|
|
@@ -58,27 +58,32 @@ GEM
|
|
|
58
58
|
http-parser (1.2.1)
|
|
59
59
|
ffi-compiler (>= 1.0, < 2.0)
|
|
60
60
|
http_parser.rb (0.6.0)
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
jsonpath (1.0.5)
|
|
62
|
+
multi_json
|
|
63
|
+
to_regexp (~> 0.2.1)
|
|
64
|
+
kubeclient (4.8.0)
|
|
63
65
|
http (>= 3.0, < 5.0)
|
|
64
|
-
|
|
66
|
+
jsonpath (~> 1.0)
|
|
67
|
+
recursive-open-struct (~> 1.1, >= 1.1.1)
|
|
65
68
|
rest-client (~> 2.0)
|
|
66
69
|
lru_redux (1.1.0)
|
|
67
70
|
mime-types (3.3.1)
|
|
68
71
|
mime-types-data (~> 3.2015)
|
|
69
|
-
mime-types-data (3.
|
|
72
|
+
mime-types-data (3.2020.0512)
|
|
70
73
|
mini_mime (1.0.2)
|
|
71
74
|
minitest (4.7.5)
|
|
72
75
|
msgpack (1.3.3)
|
|
76
|
+
multi_json (1.15.0)
|
|
73
77
|
netrc (0.11.0)
|
|
74
|
-
parallel (1.19.
|
|
75
|
-
parser (2.7.
|
|
76
|
-
ast (~> 2.4.
|
|
77
|
-
power_assert (1.
|
|
78
|
-
public_suffix (4.0.
|
|
78
|
+
parallel (1.19.2)
|
|
79
|
+
parser (2.7.1.4)
|
|
80
|
+
ast (~> 2.4.1)
|
|
81
|
+
power_assert (1.2.0)
|
|
82
|
+
public_suffix (4.0.5)
|
|
79
83
|
rainbow (3.0.0)
|
|
80
84
|
rake (13.0.1)
|
|
81
|
-
recursive-open-struct (1.1.
|
|
85
|
+
recursive-open-struct (1.1.2)
|
|
86
|
+
regexp_parser (1.7.1)
|
|
82
87
|
rest-client (2.1.0)
|
|
83
88
|
http-accept (>= 1.7.0, < 2.0)
|
|
84
89
|
http-cookie (>= 1.0.2, < 2.0)
|
|
@@ -86,16 +91,19 @@ GEM
|
|
|
86
91
|
netrc (~> 0.8)
|
|
87
92
|
rexml (3.2.4)
|
|
88
93
|
rr (1.2.1)
|
|
89
|
-
rubocop (0.
|
|
90
|
-
jaro_winkler (~> 1.5.1)
|
|
94
|
+
rubocop (0.86.0)
|
|
91
95
|
parallel (~> 1.10)
|
|
92
96
|
parser (>= 2.7.0.1)
|
|
93
97
|
rainbow (>= 2.2.2, < 4.0)
|
|
98
|
+
regexp_parser (>= 1.7)
|
|
94
99
|
rexml
|
|
100
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
|
95
101
|
ruby-progressbar (~> 1.7)
|
|
96
|
-
unicode-display_width (>= 1.4.0, <
|
|
102
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
103
|
+
rubocop-ast (0.1.0)
|
|
104
|
+
parser (>= 2.7.0.1)
|
|
97
105
|
ruby-progressbar (1.10.1)
|
|
98
|
-
rugged (0.
|
|
106
|
+
rugged (1.0.1)
|
|
99
107
|
safe_yaml (1.0.5)
|
|
100
108
|
serverengine (2.2.1)
|
|
101
109
|
sigdump (~> 0.2.2)
|
|
@@ -104,21 +112,22 @@ GEM
|
|
|
104
112
|
docile (~> 1.1)
|
|
105
113
|
simplecov-html (~> 0.11)
|
|
106
114
|
simplecov-html (0.12.2)
|
|
107
|
-
strptime (0.2.
|
|
115
|
+
strptime (0.2.4)
|
|
108
116
|
test-unit (3.0.9)
|
|
109
117
|
power_assert
|
|
110
118
|
test-unit-rr (1.0.5)
|
|
111
119
|
rr (>= 1.1.1)
|
|
112
120
|
test-unit (>= 2.5.2)
|
|
113
|
-
|
|
121
|
+
to_regexp (0.2.1)
|
|
122
|
+
tzinfo (2.0.2)
|
|
114
123
|
concurrent-ruby (~> 1.0)
|
|
115
|
-
tzinfo-data (1.
|
|
124
|
+
tzinfo-data (1.2020.1)
|
|
116
125
|
tzinfo (>= 1.0.0)
|
|
117
126
|
unf (0.1.4)
|
|
118
127
|
unf_ext
|
|
119
|
-
unf_ext (0.0.7.
|
|
120
|
-
unicode-display_width (1.
|
|
121
|
-
vcr (
|
|
128
|
+
unf_ext (0.0.7.7)
|
|
129
|
+
unicode-display_width (1.7.0)
|
|
130
|
+
vcr (6.0.0)
|
|
122
131
|
webmock (3.8.3)
|
|
123
132
|
addressable (>= 2.3.6)
|
|
124
133
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
|
@@ -15,6 +15,7 @@ that rely on the authenticity of the namespace for proper log isolation.
|
|
|
15
15
|
|
|
16
16
|
| fluent-plugin-kubernetes_metadata_filter | fluentd | ruby |
|
|
17
17
|
|-------------------|---------|------|
|
|
18
|
+
| >= 2.5.0 | >= v1.10.0 | >= 2.5 |
|
|
18
19
|
| >= 2.0.0 | >= v0.14.20 | >= 2.1 |
|
|
19
20
|
| < 2.0.0 | >= v0.12.0 | >= 1.9 |
|
|
20
21
|
|
|
@@ -47,7 +48,7 @@ This must used named capture groups for `container_name`, `pod_name` & `namespac
|
|
|
47
48
|
* *DEPRECATED* `use_journal` - If false, messages are expected to be formatted and tagged as if read by the fluentd in\_tail plugin with wildcard filename. If true, messages are expected to be formatted as if read from the systemd journal. The `MESSAGE` field has the full message. The `CONTAINER_NAME` field has the encoded k8s metadata (see below). The `CONTAINER_ID_FULL` field has the full container uuid. This requires docker to use the `--log-driver=journald` log driver. If unset (the default), the plugin will use the `CONTAINER_NAME` and `CONTAINER_ID_FULL` fields
|
|
48
49
|
if available, otherwise, will use the tag in the `tag_to_kubernetes_name_regexp` format.
|
|
49
50
|
* `container_name_to_kubernetes_regexp` - The regular expression used to extract the k8s metadata encoded in the journal `CONTAINER_NAME` field (default: `'^(?<name_prefix>[^_]+)_(?<container_name>[^\._]+)(\.(?<container_hash>[^_]+))?_(?<pod_name>[^_]+)_(?<namespace>[^_]+)_[^_]+_[^_]+$'`
|
|
50
|
-
* This corresponds to the definition [in the source](https://github.com/kubernetes/kubernetes/blob/
|
|
51
|
+
* This corresponds to the definition [in the source](https://github.com/kubernetes/kubernetes/blob/release-1.6/pkg/kubelet/dockertools/docker.go#L317)
|
|
51
52
|
* `annotation_match` - Array of regular expressions matching annotation field names. Matched annotations are added to a log record.
|
|
52
53
|
* `allow_orphans` - Modify the namespace and namespace id to the values of `orphaned_namespace_name` and `orphaned_namespace_id`
|
|
53
54
|
when true (default: `true`)
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = "fluent-plugin-kubernetes_metadata_filter"
|
|
7
|
-
gem.version = "2.
|
|
7
|
+
gem.version = "2.5.2"
|
|
8
8
|
gem.authors = ["Jimmi Dyson"]
|
|
9
9
|
gem.email = ["jimmidyson@gmail.com"]
|
|
10
10
|
gem.description = %q{Filter plugin to add Kubernetes metadata}
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
|
|
20
20
|
gem.required_ruby_version = '>= 2.1.0'
|
|
21
21
|
|
|
22
|
-
gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '<
|
|
22
|
+
gem.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 1.12']
|
|
23
23
|
gem.add_runtime_dependency "lru_redux"
|
|
24
24
|
gem.add_runtime_dependency "kubeclient", '< 5'
|
|
25
25
|
|
|
@@ -62,7 +62,7 @@ module Fluent::Plugin
|
|
|
62
62
|
# Field 2 is the container_hash, field 5 is the pod_id, and field 6 is the pod_randhex
|
|
63
63
|
# I would have included them as named groups, but you can't have named groups that are
|
|
64
64
|
# non-capturing :P
|
|
65
|
-
# parse format is defined here: https://github.com/kubernetes/kubernetes/blob/
|
|
65
|
+
# parse format is defined here: https://github.com/kubernetes/kubernetes/blob/release-1.6/pkg/kubelet/dockertools/docker.go#L317
|
|
66
66
|
config_param :container_name_to_kubernetes_regexp,
|
|
67
67
|
:string,
|
|
68
68
|
:default => '^(?<name_prefix>[^_]+)_(?<container_name>[^\._]+)(\.(?<container_hash>[^_]+))?_(?<pod_name>[^_]+)_(?<namespace>[^_]+)_[^_]+_[^_]+$'
|
|
@@ -82,11 +82,11 @@ module Fluent::Plugin
|
|
|
82
82
|
config_param :skip_master_url, :bool, default: false
|
|
83
83
|
config_param :skip_namespace_metadata, :bool, default: false
|
|
84
84
|
# The time interval in seconds for retry backoffs when watch connections fail.
|
|
85
|
-
config_param :watch_retry_interval, :
|
|
85
|
+
config_param :watch_retry_interval, :integer, default: 1
|
|
86
86
|
# The base number of exponential backoff for retries.
|
|
87
|
-
config_param :watch_retry_exponential_backoff_base, :
|
|
87
|
+
config_param :watch_retry_exponential_backoff_base, :integer, default: 2
|
|
88
88
|
# The maximum number of times to retry pod and namespace watches.
|
|
89
|
-
config_param :watch_retry_max_times, :
|
|
89
|
+
config_param :watch_retry_max_times, :integer, default: 10
|
|
90
90
|
|
|
91
91
|
def fetch_pod_metadata(namespace_name, pod_name)
|
|
92
92
|
log.trace("fetching pod metadata: #{namespace_name}/#{pod_name}") if log.trace?
|
|
@@ -208,6 +208,8 @@ module Fluent::Plugin
|
|
|
208
208
|
end
|
|
209
209
|
@kubernetes_url = "https://#{env_host}:#{env_port}/api"
|
|
210
210
|
log.debug "Kubernetes URL is now '#{@kubernetes_url}'"
|
|
211
|
+
else
|
|
212
|
+
log.debug "No Kubernetes URL could be found in config or environ"
|
|
211
213
|
end
|
|
212
214
|
end
|
|
213
215
|
|
|
@@ -29,6 +29,7 @@ module KubernetesMetadata
|
|
|
29
29
|
# the configuration.
|
|
30
30
|
namespace_watcher = start_namespace_watch
|
|
31
31
|
Thread.current[:namespace_watch_retry_backoff_interval] = @watch_retry_interval
|
|
32
|
+
Thread.current[:namespace_watch_retry_count] = 0
|
|
32
33
|
|
|
33
34
|
# Any failures / exceptions in the followup watcher notice
|
|
34
35
|
# processing will be swallowed and retried. These failures /
|
|
@@ -38,6 +39,12 @@ module KubernetesMetadata
|
|
|
38
39
|
begin
|
|
39
40
|
namespace_watcher ||= get_namespaces_and_start_watcher
|
|
40
41
|
process_namespace_watcher_notices(namespace_watcher)
|
|
42
|
+
rescue GoneError => e
|
|
43
|
+
# Expected error. Quietly go back through the loop in order to
|
|
44
|
+
# start watching from the latest resource versions
|
|
45
|
+
@stats.bump(:namespace_watch_gone_errors)
|
|
46
|
+
log.info("410 Gone encountered. Restarting namespace watch to reset resource versions.", e)
|
|
47
|
+
namespace_watcher = nil
|
|
41
48
|
rescue Exception => e
|
|
42
49
|
@stats.bump(:namespace_watch_failures)
|
|
43
50
|
if Thread.current[:namespace_watch_retry_count] < @watch_retry_max_times
|
|
@@ -122,9 +129,14 @@ module KubernetesMetadata
|
|
|
122
129
|
# deleted but still processing logs
|
|
123
130
|
@stats.bump(:namespace_cache_watch_deletes_ignored)
|
|
124
131
|
when 'ERROR'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
if notice.object && notice.object['code'] == 410
|
|
133
|
+
@stats.bump(:namespace_watch_gone_notices)
|
|
134
|
+
raise GoneError
|
|
135
|
+
else
|
|
136
|
+
@stats.bump(:namespace_watch_error_type_notices)
|
|
137
|
+
message = notice['object']['message'] if notice['object'] && notice['object']['message']
|
|
138
|
+
raise "Error while watching namespaces: #{message}"
|
|
139
|
+
end
|
|
128
140
|
else
|
|
129
141
|
reset_namespace_watch_retry_stats
|
|
130
142
|
# Don't pay attention to creations, since the created namespace may not
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
require_relative 'kubernetes_metadata_common'
|
|
20
20
|
|
|
21
21
|
module KubernetesMetadata
|
|
22
|
+
|
|
22
23
|
module WatchPods
|
|
23
24
|
|
|
24
25
|
include ::KubernetesMetadata::Common
|
|
@@ -29,6 +30,7 @@ module KubernetesMetadata
|
|
|
29
30
|
# the configuration.
|
|
30
31
|
pod_watcher = start_pod_watch
|
|
31
32
|
Thread.current[:pod_watch_retry_backoff_interval] = @watch_retry_interval
|
|
33
|
+
Thread.current[:pod_watch_retry_count] = 0
|
|
32
34
|
|
|
33
35
|
# Any failures / exceptions in the followup watcher notice
|
|
34
36
|
# processing will be swallowed and retried. These failures /
|
|
@@ -38,6 +40,12 @@ module KubernetesMetadata
|
|
|
38
40
|
begin
|
|
39
41
|
pod_watcher ||= get_pods_and_start_watcher
|
|
40
42
|
process_pod_watcher_notices(pod_watcher)
|
|
43
|
+
rescue GoneError => e
|
|
44
|
+
# Expected error. Quietly go back through the loop in order to
|
|
45
|
+
# start watching from the latest resource versions
|
|
46
|
+
@stats.bump(:pod_watch_gone_errors)
|
|
47
|
+
log.info("410 Gone encountered. Restarting pod watch to reset resource versions.", e)
|
|
48
|
+
pod_watcher = nil
|
|
41
49
|
rescue Exception => e
|
|
42
50
|
@stats.bump(:pod_watch_failures)
|
|
43
51
|
if Thread.current[:pod_watch_retry_count] < @watch_retry_max_times
|
|
@@ -128,9 +136,14 @@ module KubernetesMetadata
|
|
|
128
136
|
# deleted but still processing logs
|
|
129
137
|
@stats.bump(:pod_cache_watch_delete_ignored)
|
|
130
138
|
when 'ERROR'
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
if notice.object && notice.object['code'] == 410
|
|
140
|
+
@stats.bump(:pod_watch_gone_notices)
|
|
141
|
+
raise GoneError
|
|
142
|
+
else
|
|
143
|
+
@stats.bump(:pod_watch_error_type_notices)
|
|
144
|
+
message = notice['object']['message'] if notice['object'] && notice['object']['message']
|
|
145
|
+
raise "Error while watching pods: #{message}"
|
|
146
|
+
end
|
|
134
147
|
else
|
|
135
148
|
reset_pod_watch_retry_stats
|
|
136
149
|
# Don't pay attention to creations, since the created pod may not
|
|
@@ -76,6 +76,20 @@ class WatchNamespacesTestTest < WatchTest
|
|
|
76
76
|
'message' => 'some error message'
|
|
77
77
|
}
|
|
78
78
|
)
|
|
79
|
+
@gone = OpenStruct.new(
|
|
80
|
+
type: 'ERROR',
|
|
81
|
+
object: {
|
|
82
|
+
'code' => 410,
|
|
83
|
+
'kind' => 'Status',
|
|
84
|
+
'message' => 'too old resource version: 123 (391079)',
|
|
85
|
+
'metadata' => {
|
|
86
|
+
'name' => 'gone',
|
|
87
|
+
'namespace' => 'gone',
|
|
88
|
+
'uid' => 'gone_uid'
|
|
89
|
+
},
|
|
90
|
+
'reason' => 'Gone'
|
|
91
|
+
}
|
|
92
|
+
)
|
|
79
93
|
end
|
|
80
94
|
|
|
81
95
|
test 'namespace list caches namespaces' do
|
|
@@ -179,4 +193,30 @@ class WatchNamespacesTestTest < WatchTest
|
|
|
179
193
|
end
|
|
180
194
|
end
|
|
181
195
|
end
|
|
196
|
+
|
|
197
|
+
test 'namespace watch raises a GoneError when a 410 Gone error is received' do
|
|
198
|
+
@cache['gone_uid'] = {}
|
|
199
|
+
@client.stub :watch_namespaces, [@gone] do
|
|
200
|
+
assert_raise KubernetesMetadata::Common::GoneError do
|
|
201
|
+
process_namespace_watcher_notices(start_namespace_watch)
|
|
202
|
+
end
|
|
203
|
+
assert_equal(1, @stats[:namespace_watch_gone_notices])
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
test 'namespace watch retries when 410 Gone errors are encountered' do
|
|
208
|
+
@client.stub :get_namespaces, @initial do
|
|
209
|
+
@client.stub :watch_namespaces, [@created, @gone, @modified] do
|
|
210
|
+
# Force the infinite watch loop to exit after 3 seconds. Verifies that
|
|
211
|
+
# no unrecoverable error was thrown during this period of time.
|
|
212
|
+
assert_raise Timeout::Error.new('execution expired') do
|
|
213
|
+
Timeout.timeout(3) do
|
|
214
|
+
set_up_namespace_thread
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
assert_operator(@stats[:namespace_watch_gone_errors], :>=, 3)
|
|
218
|
+
assert_operator(@stats[:namespace_watch_gone_notices], :>=, 3)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
182
222
|
end
|
|
@@ -142,6 +142,20 @@ class DefaultPodWatchStrategyTest < WatchTest
|
|
|
142
142
|
'message' => 'some error message'
|
|
143
143
|
}
|
|
144
144
|
)
|
|
145
|
+
@gone = OpenStruct.new(
|
|
146
|
+
type: 'ERROR',
|
|
147
|
+
object: {
|
|
148
|
+
'code' => 410,
|
|
149
|
+
'kind' => 'Status',
|
|
150
|
+
'message' => 'too old resource version: 123 (391079)',
|
|
151
|
+
'metadata' => {
|
|
152
|
+
'name' => 'gone',
|
|
153
|
+
'namespace' => 'gone',
|
|
154
|
+
'uid' => 'gone_uid'
|
|
155
|
+
},
|
|
156
|
+
'reason' => 'Gone'
|
|
157
|
+
}
|
|
158
|
+
)
|
|
145
159
|
end
|
|
146
160
|
|
|
147
161
|
test 'pod list caches pods' do
|
|
@@ -261,4 +275,30 @@ class DefaultPodWatchStrategyTest < WatchTest
|
|
|
261
275
|
end
|
|
262
276
|
end
|
|
263
277
|
end
|
|
278
|
+
|
|
279
|
+
test 'pod watch raises a GoneError when a 410 Gone error is received' do
|
|
280
|
+
@cache['gone_uid'] = {}
|
|
281
|
+
@client.stub :watch_pods, [@gone] do
|
|
282
|
+
assert_raise KubernetesMetadata::Common::GoneError do
|
|
283
|
+
process_pod_watcher_notices(start_pod_watch)
|
|
284
|
+
end
|
|
285
|
+
assert_equal(1, @stats[:pod_watch_gone_notices])
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
test 'pod watch retries when 410 Gone errors are encountered' do
|
|
290
|
+
@client.stub :get_pods, @initial do
|
|
291
|
+
@client.stub :watch_pods, [@created, @gone, @modified] do
|
|
292
|
+
# Force the infinite watch loop to exit after 3 seconds. Verifies that
|
|
293
|
+
# no unrecoverable error was thrown during this period of time.
|
|
294
|
+
assert_raise Timeout::Error.new('execution expired') do
|
|
295
|
+
Timeout.timeout(3) do
|
|
296
|
+
set_up_pod_thread
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
assert_operator(@stats[:pod_watch_gone_errors], :>=, 3)
|
|
300
|
+
assert_operator(@stats[:pod_watch_gone_notices], :>=, 3)
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
end
|
|
264
304
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-kubernetes_metadata_filter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jimmi Dyson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: 0.14.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '1.12'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: 0.14.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '1.12'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: lru_redux
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|