Skip to content

Commit 1947a00

Browse files
mateigrigorenammn
andauthored
Improvements for local development setup process (#1589)
* Add changes that improve the local setup process * Remove default values for agent_distro and tools_distro from inventory.yaml * Add suggested changes * Make explanation in the documentation more clear * force release * undo change * undo change --------- Co-authored-by: nam <[email protected]>
1 parent 10da9cf commit 1947a00

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

scripts/dev/setup_kind_cluster.sh

+19-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ reg_name='kind-registry'
5656
reg_port='5000'
5757
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
5858
if [ "${running}" != 'true' ]; then
59-
docker run -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" registry:2
59+
docker run -d --restart=always -p "127.0.0.1:${reg_port}:5000" --network kind --name "${reg_name}" registry:2
6060
fi
6161

6262
if [ "${recreate}" != 0 ]; then
@@ -72,10 +72,26 @@ networking:
7272
serviceSubnet: "${service_network}"
7373
containerdConfigPatches:
7474
- |-
75-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
76-
endpoint = ["http://${reg_name}:${reg_port}"]
75+
[plugins."io.containerd.grpc.v1.cri".registry]
76+
config_path = "/etc/containerd/certs.d"
7777
EOF
7878

79+
# Add the registry config to the nodes
80+
#
81+
# This is necessary because localhost resolves to loopback addresses that are
82+
# network-namespace local.
83+
# In other words: localhost in the container is not localhost on the host.
84+
#
85+
# We want a consistent name that works from both ends, so we tell containerd to
86+
# alias localhost:${reg_port} to the registry container when pulling images
87+
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
88+
for node in $(kind get nodes --name "${cluster_name}"); do
89+
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
90+
cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
91+
[host."http://${reg_name}:5000"]
92+
EOF
93+
done
94+
7995
# connect the registry to the cluster network if not already connected
8096
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${reg_name}")" = 'null' ]; then
8197
docker network connect "kind" "${reg_name}"

0 commit comments

Comments
 (0)