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

@@ -1,8 +1,19 @@
#!/bin/bash
/preload-k8s-images.sh || exit 1
REGISTRY_DATA_DIR="${KUBE_IMG_CACHE}/registry-data/${ARCH}/${KUBE_VERSION}"
mkdir -p "${ROOTFS}/var/lib/registry"
echo "Copying registry data into rootfs..."
cp -a "${REGISTRY_DATA_DIR}/." "${ROOTFS}/var/lib/registry/"
mkdir -p "$ROOTFS/var/cache/apk"
mkdir -p "$ROOTFS/var/cache/k8s-images"
mkdir -p "$ROOTFS/build"
mount --bind /var/cache/apk "$ROOTFS/var/cache/apk"
mount --bind /var/cache/k8s-images "$ROOTFS/var/cache/k8s-images"
mount --bind /dev "$ROOTFS/dev"
mount --bind /proc "$ROOTFS/proc"
mount --bind /sys "$ROOTFS/sys"
@@ -11,6 +22,7 @@ mount --bind /run "$ROOTFS/run"
cp /usr/bin/qemu-aarch64-static "$ROOTFS/usr/bin/"
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
cp /build/crio.tar.gz "$ROOTFS/build/"
cp /build/registry.tar.gz "$ROOTFS/build/"
cp -r /build/rootfs/* "$ROOTFS/"
chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
@@ -21,6 +33,7 @@ chroot "$ROOTFS" /bin/bash /install-packages.sh || exit 1
rm "$ROOTFS/install-packages.sh"
umount "$ROOTFS/var/cache/apk"
umount "$ROOTFS/var/cache/k8s-images"
umount "$ROOTFS/dev"
umount "$ROOTFS/proc"
umount "$ROOTFS/sys"
@@ -28,11 +41,13 @@ umount "$ROOTFS/run"
rm -r "$ROOTFS/build"
/merge-rootfs.sh "/build/rootfs-extra" "$ROOTFS"
### Begin making full disk image for the device
echo "=========================== RootFS "$( du -sh "$ROOTFS/" )
IMG=output.img
SIZE=1024MB
SIZE=1536MB
dd if=/dev/zero of="$IMG" bs=1 count=0 seek=$SIZE