-
Notifications
You must be signed in to change notification settings - Fork 69
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
Conversation
cca60b8
to
57aa68a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @matheuscscp 🏅
2b3e8b5
to
14e9fa0
Compare
Signed-off-by: Matheus Pimenta <[email protected]>
14e9fa0
to
b283a55
Compare
auth, authErr = login.NewManager().Login(ctx, obj.Spec.Image, ref, opts) | ||
var managerOpts []login.Option | ||
if proxyURL != nil { | ||
managerOpts = append(managerOpts, login.WithProxyURL(proxyURL)) | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #612