From 48c7b9aa02e47cdddc6f7dd4e6661fc56e20395c Mon Sep 17 00:00:00 2001 From: David Karlsen Date: Sun, 6 Sep 2020 18:58:06 +0200 Subject: [PATCH 1/2] add socat to image to allow for proxying. #279 Signed-off-by: David Karlsen --- Dockerfile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.in b/Dockerfile.in index 9027c3b..d227e27 100644 --- a/Dockerfile.in +++ b/Dockerfile.in @@ -19,6 +19,7 @@ RUN apt-get update \ && apt-get -y install \ ca-certificates \ coreutils \ + socat \ git \ openssh-client \ && rm -rf /var/lib/apt/lists/* From 3b52b63327b0701d3fe90582a34619140f4a3fff Mon Sep 17 00:00:00 2001 From: David Karlsen Date: Tue, 8 Sep 2020 12:21:21 +0200 Subject: [PATCH 2/2] add documentation Signed-off-by: David Karlsen --- docs/proxy.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/proxy.md diff --git a/docs/proxy.md b/docs/proxy.md new file mode 100644 index 0000000..b372dd8 --- /dev/null +++ b/docs/proxy.md @@ -0,0 +1,48 @@ +# Using git with proxy + +Git-sync supports using a proxy through git-configuration. + +## Background + +See [issue 180](https://github.com/kubernetes/git-sync/issues/180) for a background. +See [Github documentation](https://docs.github.com/en/github/authenticating-to-github/using-ssh-over-the-https-port) specifically for GitHub. +Lastly, [see similar issue for FluxCD](https://github.com/fluxcd/flux/pull/3152) for configuration. + +## Step 1: Create configuration + +Create a ConfigMap to store your configuration: + +```bash +cat << EOF >> /tmp/ssh-config +Host github.com + ProxyCommand socat STDIO PROXY::%h:%p,proxyport=,proxyauth= + User git + Hostname ssh.github.com + Port 443 + IdentityFile /etc/git-secret/ssh +EOF + +kubectl create configmap ssh-config --from-file=ssh-config=/tmp/ssh-config +``` + +then mount this under `~/.ssh/config`, typically `/tmp/.ssh/config`: + +```yaml +... +apiVersion: v1 +kind: Pod +... +spec: + containers: + - name: git-sync + ... + volumeMounts: + - name: ssh-config + mountPath: /tmp/.ssh/config + readOnly: true + subPath: ssh-config + volumes: + - name: ssh-config + configMap: + name: ssh-config +``` \ No newline at end of file