Skip to content

Commit

Permalink
Merge pull request #393 from agrare/fix_410_gone_restart_handling
Browse files Browse the repository at this point in the history
Fix handling of watch notice errors from k8s
  • Loading branch information
cben authored Aug 26, 2020
2 parents 563ade0 + 0b9c82a commit 6ef17c3
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6ef17c3

Please sign in to comment.