Skip to content

Commit 947612a

Browse files
committed
chore: update deprecated registry config
This commit updates the deprecated registry config to use the new registry config as per the latest release of kind as it uses containerd 2.0 Signed-off-by: vprashar2929 <vibhu.sharma2929@gmail.com>
1 parent 49ac58b commit 947612a

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

providers/kind/kind.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,20 @@ _prepare_config() {
6363
local default_registry_port="5001"
6464

6565
info "Building manifests..."
66+
67+
# Create certs.d directory structure for containerd 2.0+ local registry
68+
# Structure: certs.d/localhost:PORT/hosts.toml
69+
local certs_d_dir="$KIND_DIR/certs.d/localhost:${REGISTRY_PORT}"
70+
mkdir -p "$certs_d_dir"
71+
sed <"$KIND_MANIFESTS_DIR/hosts.toml" \
72+
-e "s/$default_registry_name/${KIND_REGISTRY_NAME}/g" \
73+
>"$certs_d_dir/hosts.toml"
74+
75+
# Generate kind config with registry settings and certs.d mount path
6676
sed <"$KIND_MANIFESTS_DIR/kind.yml" \
6777
-e "s/$default_registry_name/${KIND_REGISTRY_NAME}/g" \
6878
-e "s/$default_registry_port/${REGISTRY_PORT}/g" \
79+
-e "s|KIND_DIR_PLACEHOLDER|${KIND_DIR}|g" \
6980
>"$KIND_CONFIG_YAML"
7081

7182
for ((i = 0; i < KIND_WORKER_NODES; i++)); do
@@ -76,6 +87,8 @@ _prepare_config() {
7687
containerPath: /proc-host
7788
- hostPath: /usr/src
7889
containerPath: /usr/src
90+
- hostPath: ${KIND_DIR}/certs.d
91+
containerPath: /etc/containerd/certs.d
7992
8093
EOF_NODE
8194
done
@@ -151,10 +164,11 @@ kind_down() {
151164
run $CTR_CMD rm -v -f "${KIND_REGISTRY_NAME}"
152165

153166
info "Removing all generated files"
154-
run rm -f \
167+
run rm -rf \
155168
"$KIND_CONFIG_YAML" \
156169
"$KIND_REGISTRY_YAML" \
157-
"$KIND_KUBECONFIG"
170+
"$KIND_KUBECONFIG" \
171+
"$KIND_DIR/certs.d"
158172

159173
ok "kind cluster deleted successfully"
160174
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# containerd registry hosts configuration for local registry
2+
# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md
3+
[host."http://kind-registry:5000"]

providers/kind/manifests/kind.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ apiVersion: kind.x-k8s.io/v1alpha4
44
networking:
55
ipFamily: ipv4
66
# create a cluster with the local registry enabled in containerd
7+
# Updated for containerd 2.0 (kind >= 0.24.0) - uses hosts.toml format
78
containerdConfigPatches:
8-
- |-
9-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5001"]
10-
endpoint = ["http://kind-registry:5000"]
9+
- |-
10+
[plugins."io.containerd.grpc.v1.cri".registry]
11+
config_path = "/etc/containerd/certs.d"
1112
nodes:
1213
- role: control-plane
1314
extraMounts:
1415
- hostPath: /proc
1516
containerPath: /proc-host
1617
- hostPath: /usr/src
1718
containerPath: /usr/src
18-
19-
# NOTE: worker nodes will be added by the script here
19+
# Mount certs.d directory for local registry (containerd 2.0+)
20+
- hostPath: KIND_DIR_PLACEHOLDER/certs.d
21+
containerPath: /etc/containerd/certs.d

0 commit comments

Comments
 (0)