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

add DEVCONTAINER support to kind provisioner #1138

Merged
merged 2 commits into from
Jan 22, 2025
Merged
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
9 changes: 9 additions & 0 deletions files/common/scripts/kind_provisioner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,16 @@ function setup_kind_cluster() {
kind create cluster --name="${NAME}" -v4 --retain --image "${IMAGE}" ${KIND_WAIT_FLAG:+"$KIND_WAIT_FLAG"} --config -); then
echo "Could not setup KinD environment. Something wrong with KinD setup. Exporting logs."
return 9
# kubectl config set clusters.kind-istio-testing.server https://istio-testing-control-plane:6443
fi

if [[ "${DEVCONTAINER}" ]]; then
# identify our docker container id using proc and regex
Copy link
Member

Choose a reason for hiding this comment

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

So is this like we are in a container, but docker is connected to the outer docker daemon (not docker nested in docker)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is correct. If you look at devcontainer.json, you'll see that the docker outside of docker feature is enabled.

containerid=$(grep 'resolv.conf' /proc/self/mountinfo | sed 's/.*\/docker\/containers\/\([0-9a-f]*\).*/\1/')
docker network connect kind "$containerid"
kind export kubeconfig --name="${NAME}" --internal
fi

# Workaround kind issue causing taints to not be removed in 1.24
kubectl taint nodes "${NAME}"-control-plane node-role.kubernetes.io/control-plane- 2>/dev/null || true

Expand Down