Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for allowWatchBookmarks to the dynamic client #2317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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