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 for ImageRepository API #627

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

matheuscscp
Copy link
Contributor

Fixes #612

@stefanprodan stefanprodan added enhancement New feature or request area/api API related issues and pull requests labels Aug 28, 2024
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @matheuscscp 🏅

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Comment on lines -360 to +382
auth, authErr = login.NewManager().Login(ctx, obj.Spec.Image, ref, opts)
var managerOpts []login.Option
if proxyURL != nil {
managerOpts = append(managerOpts, login.WithProxyURL(proxyURL))
}
Copy link
Member

Choose a reason for hiding this comment

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

Why not login.NewManager(login.WithProxyURL(proxyURL)).Login(...), the nil check is done by the manager. This is how I did it in source-controller here: fluxcd/source-controller#1607

Copy link
Contributor Author

@matheuscscp matheuscscp Sep 10, 2024

Choose a reason for hiding this comment

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

I think login.NewManager(login.WithProxyURL(proxyURL)).Login(...) kinda suggests to the reader that there is always a proxy URL set in this case even though it may not be true (and this expression is also very long, and would read nicer if broken down, but that's unrelated to your specific suggestion, we could just break it in managerOpts := ...; manager := ...; manager.Login(...) and still do it as you say). This is how I did it for most of these optional parameters for Bucket: https://github.com/fluxcd/source-controller/blob/main/internal/controller/bucket_controller.go#L449-L537

Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!

@stefanprodan stefanprodan merged commit 5f8ca00 into fluxcd:main Sep 11, 2024
6 checks passed
@matheuscscp matheuscscp deleted the imagerepo-proxy branch September 11, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api API related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proxy support in ImageRepository
3 participants