forked from kube-rs/kube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce support for persistent metadata watches (kube-rs#1145)
* Introduce support for persistent metadata watches The `watch` (and `watch_metadata` respectively) functions on the Api type are fallible, and watches are not recovered. Errors may happen for any reason, such as network induced errors, restarts (etcd can only cache so many resourve versions), and so on. To get around these failures, we have a `watcher()` utility in the runtime crate that manages the underlying stream in a persistent way, recovering on failure. This change introduces support for persistent metadata watches, through a `metadata_watcher` function in the same crate. Watches may be established on any type of resources, the main difference is that the returned types no longer correspond to the type of the Api. Instead, a concrete metadata type is returned. To support this with no breaking changes and to allow for more maintable code, a few utility functions and traits are introduced in the `runtime` crate. Signed-off-by: Matei David <matei@buoyant.io> * Run clippy Signed-off-by: Matei David <matei@buoyant.io> * Make closure arg generic Signed-off-by: Matei David <matei@buoyant.io> * Fix doc test Signed-off-by: Matei David <matei@buoyant.io> * Bump MSRV to 1.63.0 Signed-off-by: Matei David <matei@buoyant.io> * Rename AsyncFn to StepFn Signed-off-by: Matei David <matei@buoyant.io> * Add a compile-time typecheck and a meta example to dynamic watcher Signed-off-by: Matei David <matei@buoyant.io> * Rename watch_metadata to metadata_watcher and allow module rep Signed-off-by: Matei David <matei@buoyant.io> * Add trait to specialize Api calls instead of relying on closures Signed-off-by: Matei David <matei@buoyant.io> * Change meta watcher fn name in example Signed-off-by: Matei David <matei@buoyant.io> * Parse evar as 1 Signed-off-by: Matei David <matei@buoyant.io> * Refactor dynamic_watcher example Signed-off-by: Matei David <matei@buoyant.io> --------- Signed-off-by: Matei David <matei@buoyant.io>
- Loading branch information
1 parent
537c34b
commit b6d8ebd
Showing
5 changed files
with
207 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters