From 0a02a63c54a34034b04e5d5ea3e2ad3ccef4a8b8 Mon Sep 17 00:00:00 2001 From: Nathanael Liechti Date: Fri, 7 Oct 2022 21:19:31 +0200 Subject: [PATCH] docs: update debugging remote argocd environment (#10811) - launch.json now uses `main.go` and env var to determine which service is launched - telepresence v2 uses new structure to initialice and intercept connections - Add .envrc.remote to .gitignore Signed-off-by: Nathanael Liechti Signed-off-by: Nathanael Liechti --- .gitignore | 1 + .../debugging-remote-environment.md | 34 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3dbfd6f8b0ed9..869bb876f8110 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ test-results node_modules/ .kube/ ./test/cmp/*.sock +.envrc.remote # ignore built binaries cmd/argocd/argocd diff --git a/docs/developer-guide/debugging-remote-environment.md b/docs/developer-guide/debugging-remote-environment.md index 8f1f9bac0b23e..69050fee73da3 100644 --- a/docs/developer-guide/debugging-remote-environment.md +++ b/docs/developer-guide/debugging-remote-environment.md @@ -20,6 +20,34 @@ curl -sSfL https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/i ## Connect Connect to one of the services, for example, to debug the main ArgoCD server run: ```shell +telepresence helm install # Installs telepresence into your cluster +telepresence connect # Starts the connection to your cluster +telepresence intercept argocd-server --port 8083:8083 --port 8080:8080 --env-file .envrc.remote --namespace argocd # Starts the interception +``` +* `--port` forwards traffic of remote ports 8080 and 8083 to the same ports locally +* `--env-file` writes all the environment variables of the remote pod into a local file, the variables are also set on the subprocess of the `--run` command +* `--namespace` specifies that the `argocd-server` is located in the `argocd` namespace + +List current status of Telepresence using: +```shell +telepresence status +``` + +Stop the intercept using: +```shell +telepresence leave argocd-server-argocd +``` + +And uninstall telepresence from your cluster: +```shell +telepresence helm uninstall +``` + +See [this quickstart](https://www.telepresence.io/docs/latest/howtos/intercepts/) for more information on how to intercept services using Telepresence. + +### Connect (telepresence v1) +Use the following command instead: +```shell telepresence --swap-deployment argocd-server --namespace argocd --env-file .envrc.remote --expose 8080:8080 --expose 8083:8083 --run bash ``` * `--swap-deployment` changes the argocd-server deployment @@ -27,7 +55,6 @@ telepresence --swap-deployment argocd-server --namespace argocd --env-file .envr * `--env-file` writes all the environment variables of the remote pod into a local file, the variables are also set on the subprocess of the `--run` command * `--run` defines which command to run once a connection is established, use `bash`, `zsh` or others - ## Debug Once a connection is established, use your favorite tools to start the server locally. @@ -44,13 +71,14 @@ Update the configuration file to point to kubeconfig file: `KUBECONFIG=` (requir "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/argocd-server", + "program": "${workspaceFolder}/cmd/main.go", "envFile": [ "${workspaceFolder}/.envrc.remote", ], "env": { + "ARGOCD_BINARY_NAME": "argocd-server", "CGO_ENABLED": "0", "KUBECONFIG": "/path/to/kube/config" } } -``` \ No newline at end of file +```