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

Ability to send custom fetch options via Watch #1656

Open
chiragjn opened this issue Apr 17, 2024 · 1 comment
Open

Ability to send custom fetch options via Watch #1656

chiragjn opened this issue Apr 17, 2024 · 1 comment

Comments

@chiragjn
Copy link

chiragjn commented Apr 17, 2024

In the current client that depends on request we can pass an extra requestImpl in Watch which allows us to customize how various requests attributes like keepalive, timeouts, etc

On the new 1.x rc releases we see this option was removed entirely. We were wondering how can we pass on options for applyToFetchOptions via Watch API

Example Code
We are trying to port the the following code on the new node-fetch version

import { KubeConfig, ListPromise, Watch, RequestResult } from '@kubernetes/client-node';
export const webRequest = (opts: OptionsWithUri): RequestResult => { 
    ...
    axios.request({
        ...
        httpsAgent: new Agent({
            ...
            keepAlive: true,
            keepAliveMsecs: 5000,
            timeout: 5000,
          }),
         ...
    })

}
...
const watch = new Watch(kubeConfig, { webRequest });
const informer = new Informer<T>(path, watch, listPromiseFn, enableCache);

Environment (please complete the following information):

  • OS: Linux
  • NodeJS Version: 20.x
  • Cloud runtime N/A
@brendandburns
Copy link
Contributor

I think we could probably add something similar for fetch. We'd be happy to take a PR to add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants