Skip to content

Commit d1d793a

Browse files
authored
Merge pull request #108 from vprashar2929/chore-bump-kind
chore: update deprecated registry config
2 parents 49ac58b + 05896f5 commit d1d793a

4 files changed

Lines changed: 30 additions & 11 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

test/ubi.Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From registry.access.redhat.com/ubi9
1+
FROM registry.access.redhat.com/ubi9
22

33
USER 0
44

@@ -9,6 +9,6 @@ RUN yum update -y && yum install -y git sudo
99
#RUN yum install -y yum-utils
1010
#RUN yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
1111
#RUN yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
12-
RUN sudo ./main.sh prerequisites
13-
RUN sudo ./main.sh containerruntime
14-
RUN sudo ./verify.sh containerruntime
12+
RUN ./main.sh prerequisites
13+
RUN ./main.sh containerruntime
14+
RUN ./verify.sh containerruntime

0 commit comments

Comments
 (0)