Skip to content

Commit

Permalink
Add support for allowWatchBookmarks to the dynamic client
Browse files Browse the repository at this point in the history
  • Loading branch information
anvilpete committed Jan 7, 2025
1 parent e104702 commit 16ffec4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kubernetes/base/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def server_side_apply(self, resource, body=None, name=None, namespace=None, forc

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
Expand All @@ -176,6 +176,7 @@ def watch(self, resource, namespace=None, name=None, label_selector=None, field_
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.
Expand Down Expand Up @@ -206,7 +207,8 @@ def watch(self, resource, namespace=None, name=None, label_selector=None, field_
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
Expand Down Expand Up @@ -248,6 +250,8 @@ def request(self, method, path, body=None, **params):
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 = []
Expand Down

0 comments on commit 16ffec4

Please sign in to comment.