Skip to content

Commit f67dee0

Browse files
authored
raise exception after exiting watcher.each (#214)
* raise exception after exiting watcher.each * raise exception when ERROR received while watching * reset watch_retry_count after resourceVersion retrieved from API server * remove watch_retry_count resets, it was handled in another PR which is already merged
1 parent 70e2a15 commit f67dee0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/fluent/plugin/kubernetes_metadata_watch_namespaces.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ def process_namespace_watcher_notices(watcher)
113113
# ignore and let age out for cases where
114114
# deleted but still processing logs
115115
@stats.bump(:namespace_cache_watch_deletes_ignored)
116+
when 'ERROR'
117+
message = notice['object']['message'] if notice['object'] && notice['object']['message']
118+
raise "Error while watching namespaces: #{message}"
116119
else
117120
# Don't pay attention to creations, since the created namespace may not
118121
# be used by any namespace on this node.

lib/fluent/plugin/kubernetes_metadata_watch_pods.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def process_pod_watcher_notices(watcher)
120120
# ignore and let age out for cases where pods
121121
# deleted but still processing logs
122122
@stats.bump(:pod_cache_watch_delete_ignored)
123+
when 'ERROR'
124+
message = notice['object']['message'] if notice['object'] && notice['object']['message']
125+
raise "Error while watching pods: #{message}"
123126
else
124127
Thread.current[:pod_watch_retry_count] = 0
125128
# Don't pay attention to creations, since the created pod may not

0 commit comments

Comments
 (0)