Add support for allowWatchBookmarks to the dynamic client

This commit is contained in:
Pete 2025-01-07 11:35:28 +00:00
parent e104702915
commit 16ffec46ca

View File

@ -163,7 +163,7 @@ class DynamicClient(object):
return self.request('patch', path, body=body, force_conflicts=force_conflicts, **kwargs)
def watch(self, resource, namespace=None, name=None, label_selector=None, field_selector=None, resource_version=None, timeout=None, watcher=None):
def watch(self, resource, namespace=None, name=None, label_selector=None, field_selector=None, resource_version=None, timeout=None, watcher=None, allow_watch_bookmarks=None):
"""
Stream events for a resource from the Kubernetes API
@ -176,6 +176,7 @@ class DynamicClient(object):
a resource_version greater than this value will be returned
:param timeout: The amount of time in seconds to wait before terminating the stream
:param watcher: The Watcher object that will be used to stream the resource
:param allow_watch_bookmarks: Ask the API server to send BOOKMARK events
:return: Event object with these keys:
'type': The type of event such as "ADDED", "DELETED", etc.
@ -206,7 +207,8 @@ class DynamicClient(object):
label_selector=label_selector,
resource_version=resource_version,
serialize=False,
timeout_seconds=timeout
timeout_seconds=timeout,
allow_watch_bookmarks=allow_watch_bookmarks,
):
event['object'] = ResourceInstance(resource, event['object'])
yield event
@ -248,6 +250,8 @@ class DynamicClient(object):
query_params.append(('fieldManager', params['field_manager']))
if params.get('force_conflicts') is not None:
query_params.append(('force', params['force_conflicts']))
if params.get('allow_watch_bookmarks') is not None:
query_params.append(('allowWatchBookmarks', params['allow_watch_bookmarks']))
header_params = params.get('header_params', {})
form_params = []