Skip to content

Proxy Support for Custom HTTP Source CRD Download Strategy in Karmada Operator #6577

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

Merged
merged 1 commit into from
Aug 8, 2025

Conversation

jabellard
Copy link
Member

@jabellard jabellard commented Jul 25, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:
Implementation of this proposal.

Which issue(s) this PR fixes:

Part of #6573

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-operator`: Introduced a new `proxy` field which can be used to optionally set a proxy for downloading CRD tarballs from an HTTP source.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 25, 2025
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 25, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @jabellard, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new feature to the Karmada Operator, allowing users to specify an HTTP/HTTPS proxy for downloading Custom Resource Definition (CRD) tarballs from an HTTP source. This enhances network flexibility for environments requiring proxy configurations to access external resources, directly addressing the need outlined in the linked proposal and issue.

Highlights

  • API Extension: A new proxy field has been added to the HTTPSource specification within the Karmada CRD (operator.karmada.io_karmadas.yaml). This field allows users to define an HTTP/HTTPS proxy URL for CRD downloads.
  • Core Download Logic Update: The DownloadFile utility function (operator/pkg/util/util.go) has been updated to accept an optional proxy URL. It now dynamically configures the HTTP client to route download requests through the specified proxy if provided.
  • Input Validation: New validation logic has been added (operator/pkg/controller/karmada/validating.go) to ensure that any provided proxy URL is a valid format, preventing misconfigurations.
  • Type Definition and DeepCopy: The HTTPSource Go struct (operator/pkg/apis/operator/v1alpha1/type.go) has been extended with the new Proxy field, and the auto-generated deepcopy methods (operator/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go) have been updated accordingly to handle this new optional pointer field.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces proxy support for downloading CRD tarballs from a custom HTTP source. The changes include updating the CRD definition, the Go types, and the download logic to handle an optional proxy URL.

@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 25, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 60.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.35%. Comparing base (5f4bd5e) to head (c35162b).
⚠️ Report is 32 commits behind head on master.

Files with missing lines Patch % Lines
operator/pkg/controller/karmada/validating.go 33.33% 3 Missing and 1 partial ⚠️
operator/pkg/util/util.go 76.92% 2 Missing and 1 partial ⚠️
operator/pkg/tasks/init/crd.go 0.00% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6577   +/-   ##
=======================================
  Coverage   45.35%   45.35%           
=======================================
  Files         687      687           
  Lines       56384    56425   +41     
=======================================
+ Hits        25572    25593   +21     
- Misses      29217    29231   +14     
- Partials     1595     1601    +6     
Flag Coverage Δ
unittests 45.35% <60.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@zhzhuang-zju zhzhuang-zju left a comment

Choose a reason for hiding this comment

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

Thanks~
others LGTM

@jabellard jabellard requested a review from zhzhuang-zju July 26, 2025 14:02
@zhzhuang-zju
Copy link
Contributor

Thanks, @jabellard, I have no further comments. Given that I don't have the conditions to do local verification, have you verified the related functionality?

BTW, just curious, why does my browser redirect to https://www.linkedin.com/ when I enter http://www.proxy.com?

@jabellard
Copy link
Member Author

Thanks, @jabellard, I have no further comments. Given that I don't have the conditions to do local verification, have you verified the related functionality?

BTW, just curious, why does my browser redirect to https://www.linkedin.com/ when I enter http://www.proxy.com?

That's weird. I guess we can change that value. I put that there as a dummy placeholder value.

For E2E testing, I ran some tests using some internal cooperate proxies that enable cross-network segment traffic within our environment.

@zhzhuang-zju
Copy link
Contributor

That's weird. I guess we can change that value. I put that there as a dummy placeholder value.

Yes, it's indeed weird, and sometimes the URLs that open are not consistent. If possible, I suggest changing to a different URL.

Others LGTM

@jabellard
Copy link
Member Author

That's weird. I guess we can change that value. I put that there as a dummy placeholder value.

Yes, it's indeed weird, and sometimes the URLs that open are not consistent. If possible, I suggest changing to a different URL.

Others LGTM

@zhzhuang-zju, thanks for reviewing. I Just pushed an update to address. Please let me know if you have any other comments. I need this feature to setup our Karmada managed service in a new network segment, and I'm hoping to have it available as part of the next alpha release. Thanks for reviewing.

@zhzhuang-zju
Copy link
Contributor

/lgtm

I need this feature to setup our Karmada managed service in a new network segment, and I'm hoping to have it available as part of the next alpha release. Thanks for reviewing.

Thanks for the context! According to the Karmada release cycle, we expect to release the first beta version of v1.15 in the next few days, and we will include your new feature in this release.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2025
@zhzhuang-zju
Copy link
Contributor

cc @RainbowMango for another look

@RainbowMango
Copy link
Member

I need this feature to setup our Karmada managed service in a new network segment, and I'm hoping to have it available as part of the next alpha release. Thanks for reviewing.

Hi Joe, the next release (v1.15.0-beta.0) will be cut today(a little bit challenging). The next release after this one is v1.15.0-rc.0, scheduled for August 15th. Please let me know which release you expect.

@jabellard
Copy link
Member Author

I need this feature to setup our Karmada managed service in a new network segment, and I'm hoping to have it available as part of the next alpha release. Thanks for reviewing.

Hi Joe, the next release (v1.15.0-beta.0) will be cut today(a little bit challenging). The next release after this one is v1.15.0-rc.0, scheduled for August 15th. Please let me know which release you expect.

Would be great if we can get it as part of this release. This PR is ready to go and I've already validated it working.

@RainbowMango RainbowMango added this to the v1.15 milestone Jul 31, 2025
@RainbowMango
Copy link
Member

Would be great if we can get it as part of this release. This PR is ready to go and I've already validated it working.

Will try my best to make it happen.

@RainbowMango
Copy link
Member

@jabellard I'm sorry for missing the v1.15.0-beta.0 release, as I have a comment regarding the API change that must be confirmed from you. Sorry for the delay, I'm in a closed meeting this week have limited bandwidth on this.

Please let me know if the next release(Aug 15th) meets your schedule.

@jabellard
Copy link
Member Author

@jabellard I'm sorry for missing the v1.15.0-beta.0 release, as I have a comment regarding the API change that must be confirmed from you. Sorry for the delay, I'm in a closed meeting this week have limited bandwidth on this.

Please let me know if the next release(Aug 15th) meets your schedule.

Thanks for helping to get it in the release. We can aim to complete this for the next one. For now, I can try some workarounds to solve my cross-network traffic problem. Will follow up on comments within next few days.

@RainbowMango
Copy link
Member

OK. Sorry for the delay, I was in a offline meeting last week(and also this week :(). I think we can work on the proposal first, there I proposing the API change.

@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2025
@jabellard
Copy link
Member Author

Hey @RainbowMango . I pushed changes to address your comments.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/assign
Adding to my queue.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, thanks.
@zhzhuang-zju You might like to take another look?

@zhzhuang-zju
Copy link
Contributor

Thanks~ I have no further comments

Signed-off-by: Joe Nathan Abellard <[email protected]>
@jabellard
Copy link
Member Author

Generally looks good to me, thanks. @zhzhuang-zju You might like to take another look?

@RainbowMango @zhzhuang-zju thanks for reviewing and providing great constructive feedback. I just pushed changes to address comments and then squashed.

@zhzhuang-zju
Copy link
Contributor

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2025
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/approve

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2025
@karmada-bot karmada-bot merged commit 108073c into karmada-io:master Aug 8, 2025
24 checks passed
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm 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.

5 participants