Skip to content

WIP Undici migration p2#2813

Open
davidgamero wants to merge 7 commits intokubernetes-client:mainfrom
davidgamero:undici-migration-p2
Open

WIP Undici migration p2#2813
davidgamero wants to merge 7 commits intokubernetes-client:mainfrom
davidgamero:undici-migration-p2

Conversation

@davidgamero
Copy link
Copy Markdown
Contributor

@davidgamero davidgamero commented Mar 26, 2026

node-fetch removals

  • rips out node-fetch and @types/node-fetch, uses native fetch (undici) everywhere
  • drops nock, migrates all test mocking to undici MockAgent
  • rewrite health, log, watch to use fetch() + Readable.fromWeb() for streaming
  • rename integration_test.ts → fullrequest_test.ts since it's a unit test

auth

  • removes applyToFetchOptions from kubeconfig (dead after migration)
  • cleans up dead tls config in applySecurityAuthentication (was set then immediately overwritten)

watch

  • treat watch TimeoutError as reconnectable in informer, add exponential backoff on reconnect
  • normalize timeout errors in watch.ts (fixes Node 23 mid-stream AbortError vs TimeoutError inconsistency)
  • add integration test for watch

informer

  • add informer reconnect integration test

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 26, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidgamero

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 26, 2026
@cjihrig
Copy link
Copy Markdown
Contributor

cjihrig commented Mar 26, 2026

This is really great progress on modernizing the project. Thanks for working on it.

@davidgamero
Copy link
Copy Markdown
Contributor Author

This is really great progress on modernizing the project. Thanks for working on it.

thanks! i was trying to remove nock so we can consolidate testing into undici mockagent and it snowballed

@davidgamero davidgamero force-pushed the undici-migration-p2 branch from 60b46b0 to 7a25b4f Compare March 27, 2026 21:04

await this.applyOptions(httpsOptions);

if (cluster && cluster.skipTLSVerify) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be deleting this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my reasoning is that the applyOptions call above invokes applyHTTPSOptions, which sets httpsOptions.rejectUnauthorized

this is mirrored into agentOptions below by agentOptions.rejectUnauthorized = httpsOptions.rejectUnauthorized;

servername is similarly applied in applyOptions > applyHTTPSOptions, but was missing the httpsOptions -> agentOptions conversion in this function which i've now added below along with a test calling the whole chain to assert the TLS propagation

happy to reasses my interpretation or refactor to improve readability

strictEqual(doneCalled, 1);
});

it('should call setKeepAlive on the socket to extend the default of 5 mins', async (t) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test no longer apply?

Copy link
Copy Markdown
Contributor Author

@davidgamero davidgamero Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appears undici default keepalive is 60s which could still cause a race condition on some load balancers.

reintroduced updated test in config to keep 30s keepalive

@brendandburns
Copy link
Copy Markdown
Contributor

Generally looks good, some comments on sleep() usage in one of the tests and a couple of things that I'm not sure why they were removed.

@davidgamero davidgamero marked this pull request as ready for review April 1, 2026 05:38
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants