From 0b9c82acb06964e4cde1984008e83bc793b8e083 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Tue, 25 Aug 2020 16:02:48 -0400 Subject: [PATCH] Fix handling of watch notice errors from k8s When a watch fails the status and code are in the notice.object not the top level resource. --- .../container_manager/refresh_worker/watch_thread.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/container_manager/refresh_worker/watch_thread.rb b/app/models/manageiq/providers/kubernetes/container_manager/refresh_worker/watch_thread.rb index 7f56da887b..20e5e9d237 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager/refresh_worker/watch_thread.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager/refresh_worker/watch_thread.rb @@ -43,10 +43,12 @@ def collector_thread self.watch ||= connection(entity_type).send("watch_#{entity_type}", :resource_version => resource_version) watch.each do |notice| - # If we get a 410 gone with this resource version break out and restart - # the watch - if notice.kind == "Status" && notice.code == 410 - _log.warn("Caught 410 Gone, restarting watch") + if notice.type == "ERROR" + message = notice.object&.message + code = notice.object&.code + reason = notice.object&.reason + + _log.warn("Received an error watching #{entity_type}: [#{code} #{reason}], [#{message}]") break end