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

docs: Add git proxy support docs #547

Merged
merged 1 commit into from
Jan 20, 2022
Merged

Conversation

darkowlzz
Copy link
Contributor

#524 added support for git proxy in libgit2. We discovered various things that doesn't work as expected. This change documents the limitations we discovered in libgit2 git proxy support.

@darkowlzz darkowlzz added the area/docs Documentation related issues and pull requests label Jan 19, 2022
| 'libgit2' | false | false | true |
| --- | --- | --- | --- |
| 'go-git' | true | true | false |
| 'libgit2' | false | false | true |
Copy link
Contributor Author

@darkowlzz darkowlzz Jan 19, 2022

Choose a reason for hiding this comment

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

Unrelated change. I used https://github.com/godlygeek/tabular to automatically format the table.
I can undo it and keep it simple if it'd be easier to maintain.

@darkowlzz
Copy link
Contributor Author

darkowlzz commented Jan 19, 2022

@racdev and @au2001, would love to have your feedback on documenting git proxy support. Anything that'd be useful and need to be clarified?

@au2001
Copy link
Contributor

au2001 commented Jan 19, 2022

racdev and au2001, would love to have your feedback on documenting git proxy support. Anything that'd be useful and need to be clarified?

@darkowlzz To help readers applying a proxy to their Flux installation, it might be a good idea to provide an example.
Here is an extract of the JSON patch I'm using (the same can be done through a strategic merge):

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
patches:
- patch: |
    - op: add
      path: /spec/template/spec/containers/0/env/-
      value:
        name: HTTPS_PROXY
        value: http://x.x.x.x:yyyy
    - op: add
      path: /spec/template/spec/containers/0/env/-
      value:
        name: NO_PROXY
        value: localhost,.local,.local.
  target:
    kind: Deployment
    labelSelector: app.kubernetes.io/part-of=flux
    namespace: flux-system

Note that those environment variables are applied to all Flux controllers and not just source-controller.
This is because other controllers, such as image-automation-controller if it has been installed, also use these for accessing any remote resource (i.e. Git and Helm repositories, container registries...).
Kinda off-topic: I opened the PR fluxcd/image-automation-controller#285 to apply the same fix as we did on source-controller because you cannot yet push image updates to a Git server through a proxy.

As for current known issues related to source-controller, I think it's definitely worth mentioning the CAFile/custom Transport issue: you cannot use a proxy at the same time as HTTPS self-signed certificates because of an implementation limitation in go-git (but it should work fine when using libgit2 explicitly).

I'm not sure if it's worth mentioning the caching issue we ran into while using go-git.
What it means is that you cannot change the proxy environment variables in a source-controller pod while it's running.
But as far as I know it is not possible to change environment variables on a running pod anyways, or at least it's unsupported.

@darkowlzz
Copy link
Contributor Author

@au2001 Thanks. Self-signed cert issue with go-git is an important thing to note.

Since this is an API doc, it'd be better to not have examples of adding env vars here. But thanks for sharing the example here. Would be useful for others if they look for it.

The caching issue happens only during the lifetime of a go program. We saw that it wasn't an issue when running the tests separately. So, I don't think we need to mention anything about it, also considering that this will run in pods, as you mentioned.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
@au2001
Copy link
Contributor

au2001 commented Jan 20, 2022

Since this is an API doc, it'd be better to not have examples of adding env vars here.

The caching issue happens only during the lifetime of a go program. We saw that it wasn't an issue when running the tests separately. So, I don't think we need to mention anything about it, also considering that this will run in pods, as you mentioned.

@darkowlzz Alright, fine with me.
Then everything looks good to me now! Can't think of anything else worth mentioning in the API docs.

@stefanprodan stefanprodan merged commit d1d54e0 into fluxcd:main Jan 20, 2022
@darkowlzz darkowlzz deleted the docs-git-proxy branch January 20, 2022 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Documentation related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants