-
Notifications
You must be signed in to change notification settings - Fork 188
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
source controller needs proxy to access github.com when running inside corporate network #131
Comments
You could create a kustomize patch after running |
Another way to make this easier: fluxcd/flux2#234 In which case --http-proxy could be an option to |
Can fluxcd/flux#2179 be re-implemented for fluxv2? For flux v1 I installed it with values like:
and need something similar in flux v2 |
We're also blocked from migrating to And yes, |
Ability to configure HTTP/S and/or SSH client details is related to #93 |
It might be possible to support this by modifying the source-controller |
I like this idea, nice and separated in a way.
but then src ctrl says:
[1] args:
- tcp-listen:8080,fork,reuseaddr
- proxy:proxy.acme.org:github.com:443,proxyport=3128
command:
- socat [2]
[3] - hostnames:
- github.com
ip: 10.201.37.75 I think maybe the next hurdle is https://docs.github.com/en/github/authenticating-to-github/using-ssh-over-the-https-port |
Update, I had missed an essential thing, the host is named ssh.github.com, when you run on port 443, we have a winner 🎉
sidecar cmd:
git repo url url: ssh://git@github.com/acme/test-fluxv2.git and the host entry for github.com |
Thank you for proving this works at the pod infra level. I like this solution. Seems like it would be odd/complex to add this to GitRepository.spec as well as all the other Sources... It's very coupled to the network details of the Cluster's environment -- very much an admin concern Multiple tenants could transparently be using this proxy, and it would still make sense. (and be safe?) User-facing Source configs between airgapped and cloud clusters can be the same or similar without being polluted with proxy details. |
Using an actual side-car removes a hop to the Service Pod and reduces config, because you don't need the svc IP, it's just localhost. The downside is that we don't run all of the flux controllers in the same process or Pod, so any controllers that need to talk directly to GitHub need their own socat side-car, whereas the Service Pod is reusable, even beyond Flux (ex: your Tekton jobs write artifacts or commit back to the repo -- they can use the proxy too) |
Yes, I don't think it belongs in the spec, since it is controller-scope'd (we redefine the host) - so two different gitrepo cr's will get the same treatment, given the same target host.
Indeed, ideally it belongs in something like Istio (or even more ideally it's dealt with at infra networking level outside of the cluster handling it transparently - sadly we're not there/I can't influence that decision as of now).
It should be safe, it's an opt-in new endpoint (opt-in by defining /etc/hosts entries), and all we are doing is providing an alternative path to an existing public endpoint on the internet. Additionally one can apply
Exactly, the last step is just howto be able to define |
That's fixable by applying NetworkPolicies ?
How/for what reasons do the other controllers talk to github? (API?) |
The image automation controller writes back to Git, see https://toolkit.fluxcd.io/guides/image-update/#configure-image-updates |
so... how do we proceed from here? |
Using Azure Devops repos also fails when behind a corporate proxy using the libgit2 implementation. Is the expectation that the libgit2 implementation would utilise an HTTPS_PROXY env value or should the source-controller set the proxy details itself somehow? |
Any update on this ? |
I ended up forking and adding the required code to specify a proxy to use when using libgit2 via a new proxy field added to the GitRepository resource schema. Works for us behind a corporate proxy. If I could use GitHub from work I would raise a PR but unfortunately I can't. |
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the http.ProxyFromEnvironment function. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the http.ProxyFromEnvironment function. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Co-authored-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
Adding the Proxies as ENV Variable to the Source Controller Deploy solved the problem for me. (Cluster sits behind cooperate proxy; got a timeout - context deadline exceeded error when reconciling the repo with the cluster) |
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
Hi ThemeIT, You added proxy entries dynamically to the source-controller deployment after running OR you added to the deployment.yaml file, then did Flux deployment ?. |
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
This configures ProxyOptions for all libgit2 Checkout functions when cloning and configures the options based on current environment settings using the git2go.ProxyTypeAuto option. Refs: fluxcd#131 Signed-off-by: Robert Clarke <rob@robertandrewclarke.com> Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net> Signed-off-by: pa250194 <pa250194@ncr.com>
@pjbgf PR#524 appears to only work for git access over HTTPS and not for proxying SSH with ProxyCommand/socat. Am I misreading, or would that be a separate issue? |
@pjbgf to use socat-sidecar in a source-controller pod, where source-controller does not run as a root and filesystem is readonly, the setup does not suffice. A co-located pod running socat container requires source-controller to know its ip (to alias github.com) which is problematic for maintaining that relationship reliable. |
Reopening this due to the lack of documentation for proxying SSH connections. @sofib-form3 @alphabet5 have you tried exporting the socks5 information via @sofib-form3 on the socat perspective, I will give it a try and let you know. But in theory, you could override those settings (readonly fs and running as non root) in the source-controller YAML with your |
hi, any news on this issue? We also need ssh proxyCommand or jump functionaliy. It seems this usecase is pretty common in big organizations. |
@sofib-form3 the socat target IP can be set via hostAliases, without requiring the controller pod to lose the readonly fs with:
I think this could be combined with var substitution or similar functionality from helm, in case your proxy service is remote and you need to gather that information querying some Kubernetes objects. @DudyZ Further to my comment above, I will be closing this as we have the behaviour documented, and outstanding features (e.g. fluxcd/flux2#3007) being tracked on their own independent issues. |
In order to get the source controller to access a github.com repository from within my client's corporate network I needed to add the following environmental variables to the source-controller deployment.
Maybe gotk install could be enhanced to generate this?
The text was updated successfully, but these errors were encountered: