Skip to content

Commit

Permalink
fix(client): bugfix params handling for watch queries
Browse files Browse the repository at this point in the history
  • Loading branch information
kahirokunn committed Jul 4, 2024
1 parent f69c318 commit 7fc1d37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/kubekit-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kubekit/client",
"version": "0.2.30",
"version": "0.2.31",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "kahirokunn",
Expand Down
22 changes: 12 additions & 10 deletions packages/kubekit-client/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,20 @@ export async function apiClient<Response>(
let baseUrl = `${httpsOptions.protocol}//${host}`;
const searchParameters = toSearchParameters(params);
if (searchParameters.size > 0) {
// https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/3157-watch-list/README.md
// TODO: defaultのfeature flagがtrueになったら、watchの場合は自動で以下の2つのparamsを追加してあげたい
// sendInitialEvents: true,
// resourceVersionMatch: "NotOlderThan"

if (isWatch) {
params = {
...params,
allowWatchBookmarks: true,
};
// https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/3157-watch-list/README.md
// TODO: defaultのfeature flagがtrueになったら、watchの場合は自動で以下の2つのparamsを追加してあげたい
// sendInitialEvents: true,
// resourceVersionMatch: "NotOlderThan"
baseUrl +=
(baseUrl.includes('?') ? '&' : '?') +
toSearchParameters({
...params,
allowWatchBookmarks: true,
});
} else {
baseUrl += (baseUrl.includes('?') ? '&' : '?') + searchParameters;
}
baseUrl += (baseUrl.includes('?') ? '&' : '?') + searchParameters;
}
const url = new URL(baseUrl);
if (httpsOptions.port) {
Expand Down

0 comments on commit 7fc1d37

Please sign in to comment.