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

feat: Enable local docker ip in for communication with outside k3d #11350

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"hostRequirements": {
"cpus": 4
},
"runArgs": ["--add-host=host.docker.internal:host-gateway"],
"onCreateCommand": ".devcontainer/pre-build.sh",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/go/src/github.com/argoproj/argo-workflows,type=bind",
"workspaceFolder": "/home/vscode/go/src/github.com/argoproj/argo-workflows",
Expand Down
5 changes: 4 additions & 1 deletion .devcontainer/pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ k3d cluster get k3s-default || k3d cluster create --wait
k3d kubeconfig merge --kubeconfig-merge-default

# install kubectl
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/$(go env GOARCH)/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl cluster-info
Expand All @@ -31,3 +31,6 @@ sudo chown -R vscode:vscode /home/vscode/go

# download dependencies and do first-pass compile
CI=1 kit pre-up

# Patch CoreDNS to have host.docker.internal inside the cluster available
kubectl get cm coredns -n kube-system -o yaml | sed "s/ NodeHosts: |/ NodeHosts: |\n `grep host.docker.internal /etc/hosts`/" | kubectl apply -f -
2 changes: 1 addition & 1 deletion docs/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation does not work.

## Development Container

A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. It should be able to do everything you need to do to develop argo workflows using the development container without installing tools on your local machine. It takes quite a long time to build the container. It will run k3d inside the container so you'll have a cluster to use to test against.
A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. It should be able to do everything you need to do to develop argo workflows using the development container without installing tools on your local machine. It takes quite a long time to build the container. It will run k3d inside the container so you'll have a cluster to use to test against. To communicate with services running either in other development containers or directly on the local developer machine (e.g., a database) the following URL can be used in the workflow spec: `host.docker.internal:<PORT>`. This facilitates the implementation of workflows, which need to connect to a database or an API server.

You can use the development container in a few different ways:

Expand Down