Skip to content

Reflectors Vs Watchers #695

Answered by nightkr
DevasiaThomas asked this question in Q&A
Nov 5, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Is this for when the underlying connection gets disrupted, or some error happens, and you fetch everything again?

Yes. Though not every disconnect generates a Restart; we try to recover the existing stream first and only Restart if that fails.

To my question, for my purposes, I feel like a watcher is better suited? Correct me if I am wrong(also when should one use a reflector?).

kube-runtime is a bit like a layer cake:

  1. kube::Api::watch streams events from the Kubernetes API
  2. kube_runtime::watcher adds error recovery on top of Api::watch (as you've already noticed), use this if you only care about raw events (for example: logging all events as they happen)
  3. kube_runtime::reflector adds …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DevasiaThomas
Comment options

@nightkr
Comment options

Answer selected by DevasiaThomas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
runtime controller runtime related docs unclear documentation
2 participants