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

Add proxy support #2111

Merged

Conversation

krmodelski
Copy link
Contributor

@krmodelski krmodelski commented Dec 16, 2024

Similar to 2091, but for the release-1.x branch. I did not add tests this time because I had some troubles with copying agent options in the applyToHTTPSOptions method. I might work on tests in the meantime. I am using different library for HTTP/HTTPS due to this issue in previous library.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 16, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 16, 2024
package-lock.json Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
src/config.ts Outdated Show resolved Hide resolved
@brendandburns
Copy link
Contributor

Some comments.

Given that there seems to be a typo/reverse bug in the code, I think we should really figure out how to get unit tests on this.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 16, 2024

I agree that we should not land this without tests - particularly if most future development is intended to target this branch.

src/config.ts Outdated Show resolved Hide resolved
@cjihrig
Copy link
Contributor

cjihrig commented Dec 17, 2024

Thanks for addressing the nits. At this point, are you able to add tests?

@krmodelski
Copy link
Contributor Author

Thanks for addressing the nits. At this point, are you able to add tests?

I think I can do it.

src/config.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
testdata/kubeconfig-proxy-url.yaml Show resolved Hide resolved
@CGNonofr
Copy link

exec doesn't seem to work 🤔 should'nt the config#applyToHTTPSOptions method be changed as well?

@krmodelski
Copy link
Contributor Author

exec doesn't seem to work 🤔 should'nt the config#applyToHTTPSOptions method be changed as well?

@CGNonofr thanks for heads-up, I will take a look at it.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2024
@krmodelski
Copy link
Contributor Author

@CGNonofr I added agent to applyToHTTPSOptions and tested exec. Could you please confirm it works?

@CGNonofr
Copy link

@CGNonofr I added agent to applyToHTTPSOptions and tested exec. Could you please confirm it works?

Looks good!

@krmodelski krmodelski requested a review from cjihrig December 20, 2024 09:26
@brendandburns
Copy link
Contributor

This looks good to me, thanks for adding tests.

@cjihrig I'll leave it to you to give the final lgtm+approve.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 20, 2024

Thanks for the contribution.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 20, 2024
@cjihrig
Copy link
Contributor

cjihrig commented Dec 20, 2024

I don't think I can merge this yet. I think #2124 needs to land first.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 20, 2024

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjihrig, krmodelski

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

The pull request process is described here

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0f5694e into kubernetes-client:release-1.x Dec 20, 2024
8 checks passed
@krmodelski krmodelski deleted the proxy-url-release-1.x branch December 21, 2024 09:47
@cjihrig
Copy link
Contributor

cjihrig commented Dec 24, 2024

@krmodelski it looks like there are some issues with the test here - https://github.com/kubernetes-client/javascript/actions/runs/12439738691/job/34734042786:

> tsc --project tsconfig-with-tests.json && cp 'src/test/echo space.js' dist/test

src/config_test.ts:399:26 - error TS2339: Property 'proxy' does not exist on type 'HttpsProxyAgent'.

399             expect(agent.proxy.href).to.equal(expectedProxyHref);
                             ~~~~~

src/config_test.ts:415:26 - error TS2339: Property 'options' does not exist on type 'HttpProxyAgent'.

415             expect(agent.options.ca?.toString()).to.equal(expectedCA.toString());
                             ~~~~~~~

src/config_test.ts:416:26 - error TS2339: Property 'proxy' does not exist on type 'HttpProxyAgent'.

416             expect(agent.proxy.href).to.equal(expectedProxyHref);

I think this wasn't caught initially because the PR branch didn't include the new checks for the tests and transpiled code.

Are you able to take a look?

@krmodelski
Copy link
Contributor Author

@krmodelski it looks like there are some issues with the test here - https://github.com/kubernetes-client/javascript/actions/runs/12439738691/job/34734042786:

> tsc --project tsconfig-with-tests.json && cp 'src/test/echo space.js' dist/test

src/config_test.ts:399:26 - error TS2339: Property 'proxy' does not exist on type 'HttpsProxyAgent'.

399             expect(agent.proxy.href).to.equal(expectedProxyHref);
                             ~~~~~

src/config_test.ts:415:26 - error TS2339: Property 'options' does not exist on type 'HttpProxyAgent'.

415             expect(agent.options.ca?.toString()).to.equal(expectedCA.toString());
                             ~~~~~~~

src/config_test.ts:416:26 - error TS2339: Property 'proxy' does not exist on type 'HttpProxyAgent'.

416             expect(agent.proxy.href).to.equal(expectedProxyHref);

I think this wasn't caught initially because the PR branch didn't include the new checks for the tests and transpiled code.

Are you able to take a look?

Sure, I will take a look.

@krmodelski krmodelski mentioned this pull request Dec 25, 2024
@krmodelski
Copy link
Contributor Author

@krmodelski it looks like there are some issues with the test here - https://github.com/kubernetes-client/javascript/actions/runs/12439738691/job/34734042786:

> tsc --project tsconfig-with-tests.json && cp 'src/test/echo space.js' dist/test

src/config_test.ts:399:26 - error TS2339: Property 'proxy' does not exist on type 'HttpsProxyAgent'.

399             expect(agent.proxy.href).to.equal(expectedProxyHref);
                             ~~~~~

src/config_test.ts:415:26 - error TS2339: Property 'options' does not exist on type 'HttpProxyAgent'.

415             expect(agent.options.ca?.toString()).to.equal(expectedCA.toString());
                             ~~~~~~~

src/config_test.ts:416:26 - error TS2339: Property 'proxy' does not exist on type 'HttpProxyAgent'.

416             expect(agent.proxy.href).to.equal(expectedProxyHref);

I think this wasn't caught initially because the PR branch didn't include the new checks for the tests and transpiled code.
Are you able to take a look?

Sure, I will take a look.

This should fix.

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants