Skip to content

Commit c7c55c5

Browse files
wojtek-tk8s-ci-robot
authored andcommitted
Watch bookmarks documentation (#14379)
1 parent a1f811d commit c7c55c5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

content/en/docs/reference/using-api/api-concepts.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ For example:
8787
...
8888

8989
A given Kubernetes server will only preserve a historical list of changes for a limited time. Clusters using etcd3 preserve changes in the last 5 minutes by default. When the requested watch operations fail because the historical version of that resource is not available, clients must handle the case by recognizing the status code `410 Gone`, clearing their local cache, performing a list operation, and starting the watch from the `resourceVersion` returned by that new list operation. Most client libraries offer some form of standard tool for this logic. (In Go this is called a `Reflector` and is located in the `k8s.io/client-go/cache` package.)
90+
To mitigate the impact of short history window, we introduced a concept of `bookmark` watch event. It is a special kind of event to pass an information that all changes up to a given `resourceVersion` client is requesting has already been send. Object returned in that event is of the type requested by the request, but only `resourceVersion` field is set, e.g.:
91+
92+
GET /api/v1/namespaces/test/pods?watch=1&resourceVersion=10245&allowWatchBookmarks=true
93+
---
94+
200 OK
95+
Transfer-Encoding: chunked
96+
Content-Type: application/json
97+
{
98+
"type": "ADDED",
99+
"object": {"kind": "Pod", "apiVersion": "v1", "metadata": {"resourceVersion": "10596", ...}, ...}
100+
}
101+
...
102+
{
103+
"type": "BOOKMARK",
104+
"object": {"kind": "Pod", "apiVersion": "v1", "metadata": {"resourceVersion": "12746"} }
105+
}
106+
107+
`Bookmark` events can be requested by `allowWatchBookmarks=true` option in watch requests, but clients shouldn't assume bookmarks are returned at any specific interval, nor may they assume the server will send any `bookmark` event. As of 1.15 release, it is an Alpha feature.
90108

91109
## Retrieving large results sets in chunks
92110

0 commit comments

Comments
 (0)