kubernetes.watch package¶
Submodules¶
kubernetes.watch.watch module¶
-
class
kubernetes.watch.watch.SimpleNamespace(**kwargs)¶
-
class
kubernetes.watch.watch.Watch(return_type=None)¶ Bases:
object-
get_return_type(func)¶
-
stop()¶
-
stream(func, *args, **kwargs)¶ Watch an API resource and stream the result back via a generator.
Parameters: func – The API function pointer. Any parameter to the function can be passed after this parameter. Returns: Event object with these keys: ‘type’: The type of event such as “ADDED”, “DELETED”, etc. ‘raw_object’: a dict representing the watched object. ‘object’: A model representation of raw_object. The name of model will be determined based on the func’s doc string. If it cannot be determined, ‘object’ value will be the same as ‘raw_object’.- Example:
v1 = kubernetes.client.CoreV1Api() watch = kubernetes.watch.Watch() for e in watch.stream(v1.list_namespace, resource_version=1127):
type = e[‘type’] object = e[‘object’] # object is one of type return_type raw_object = e[‘raw_object’] # raw_object is a dict … if should_stop:
watch.stop()
-
unmarshal_event(data, return_type)¶
-
-
kubernetes.watch.watch.iter_resp_lines(resp)¶