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

feat: change switch fetch to undici fetch in watch #399

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions fast.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

I assume this file was left by mistake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for sure, rushed to push to show. Needs a bit of clean up still. Wasn't sure it was going to pass the soak at first.

rm -rf dist; npm run build
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"node-fetch": "2.7.0",
"quicktype-core": "23.0.170",
"type-fest": "4.26.1",
"undici": "^6.19.8",
Copy link
Member

Choose a reason for hiding this comment

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

should use exact versions--but also would recommend we try using native-fetch first (same library) and bump the base required version to Node 22 for at least this feature in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay will try that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The real struggle that I am running into with this is that native fetch does not have an agent. I am making an https.globalAgent but it is not respecting it. Still trying to work around this.

"yargs": "17.7.2"
},
"devDependencies": {
Expand Down
5 changes: 0 additions & 5 deletions src/fluent/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe("kubeExec Function", () => {
const fakeUrl = new URL("http://jest-test:8080/api/v1/namespaces/default/pods/fake");
const fakeOpts = {
body: JSON.stringify(fakePayload),
compress: true,
headers: new Headers({
"Content-Type": "application/json",
"User-Agent": `kubernetes-fluent-client`,
Expand Down Expand Up @@ -164,7 +163,6 @@ describe("kubeExec Function", () => {
new URL("http://jest-test:8080/api/v1/namespaces/default/pods/fake/status"),
expect.objectContaining({
method: "PATCH",
compress: true,
headers: new Headers({
"Content-Type": "application/merge-patch+json",
"User-Agent": `kubernetes-fluent-client`,
Expand All @@ -191,7 +189,6 @@ describe("kubeExec Function", () => {
new URL("http://jest-test:8080/api/v1/namespaces/default/pods/fake"),
expect.objectContaining({
method: "PATCH",
compress: true,
headers: new Headers({
"Content-Type": "application/json-patch+json",
"User-Agent": `kubernetes-fluent-client`,
Expand All @@ -218,7 +215,6 @@ describe("kubeExec Function", () => {
),
expect.objectContaining({
method: "PATCH",
compress: true,
headers: new Headers({
"Content-Type": "application/apply-patch+yaml",
"User-Agent": `kubernetes-fluent-client`,
Expand All @@ -245,7 +241,6 @@ describe("kubeExec Function", () => {
),
expect.objectContaining({
method: "PATCH",
compress: true,
headers: new Headers({
"Content-Type": "application/apply-patch+yaml",
"User-Agent": `kubernetes-fluent-client`,
Expand Down
2 changes: 1 addition & 1 deletion src/fluent/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function k8sCfg(method: FetchMethods) {
});

// Enable compression
opts.compress = true;
opts.compress = false;
Copy link
Member

Choose a reason for hiding this comment

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

this seems like a really good thing to try too--but we might consider testing these changes independently

Copy link
Contributor Author

@cmwylie19 cmwylie19 Oct 3, 2024

Choose a reason for hiding this comment

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

Agreed, this is left over from the test where this was the only change (GH Issue). Soak Result did not show a difference.

However, in this specific case, we are not using compress at all. We are only using opts to get the cluster ca-cert (cert and key too if in dev) and manufacturing our own agent.


return { opts, serverUrl: cluster.server };
}
Expand Down
Loading
Loading