crictl can import images but slow

This commit is contained in:
2026-03-24 20:52:17 +08:00
parent ac05d3e5dc
commit 58da0aada6
15 changed files with 474 additions and 19 deletions

View File

@@ -0,0 +1,9 @@
INTERVAL=10
DEVPATH=hwmon0=devices/platform/soc/2180000.i2c/i2c-0/i2c-7/7-002e hwmon1=devices/virtual/thermal/thermal_zone0
DEVNAME=hwmon0=emc2305 hwmon1=ddr_thermal
FCTEMPS=hwmon0/pwm2=hwmon1/temp1_input
FCFANS= hwmon0/pwm2=hwmon0/fan1_input
MINTEMP=hwmon0/pwm2=40
MAXTEMP=hwmon0/pwm2=60
MINSTART=hwmon0/pwm2=60
MINSTOP=hwmon0/pwm2=45

View File

@@ -0,0 +1 @@
none /sys/fs/cgroup cgroup2 defaults 0 0

View File

@@ -0,0 +1 @@
${ALPINE_HOSTNAME}

View File

@@ -0,0 +1,2 @@
# Dev only
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 -n -l /bin/bash

View File

@@ -0,0 +1,56 @@
#!/bin/sh
set -eu
KUBE_VERSION="${KUBE_VERSION:-v1.35.3}"
REGISTRY_ADDR="${REGISTRY_ADDR:-127.0.0.1:5000}"
mkdir -p /opt/registry
cat >/opt/registry/config.yml <<EOF
version: 0.1
log:
level: info
storage:
filesystem:
rootdirectory: /var/lib/registry
http:
addr: ${REGISTRY_ADDR}
EOF
cat >/opt/crictl.yaml <<'EOF'
runtime-endpoint: unix:///var/run/crio/crio.sock
image-endpoint: unix:///var/run/crio/crio.sock
timeout: 10
debug: false
EOF
registry serve /opt/registry/config.yml >/var/log/registry.log 2>&1 &
REG_PID=$!
cleanup() {
kill "$REG_PID" 2>/dev/null || true
}
trap cleanup EXIT INT TERM
for _ in $(seq 1 30); do
if curl -fsS "http://${REGISTRY_ADDR}/v2/_catalog" >/dev/null; then
break
fi
sleep 1
done
curl -fsS "http://${REGISTRY_ADDR}/v2/_catalog" >/dev/null
for img in $(kubeadm config images list --kubernetes-version "${KUBE_VERSION}"); do
name="${img#registry.k8s.io/}"
echo "Importing ${img} from ${REGISTRY_ADDR}/${name}"
skopeo copy --src-tls-verify=false \
"docker://${REGISTRY_ADDR}/${name}" \
"containers-storage:${img}"
done
echo "Imported images now visible to CRI-O:"
crictl images
kill "$REG_PID" 2>/dev/null || true
wait "$REG_PID" 2>/dev/null || true
trap - EXIT INT TERM