Remove unused /var/lib/registry data
This commit is contained in:
@@ -4,20 +4,11 @@ set -euo pipefail
|
||||
|
||||
/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/opt/monok8s/config"
|
||||
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"
|
||||
@@ -42,7 +33,6 @@ chroot "$ROOTFS" /bin/bash /configure-system.sh || exit 1
|
||||
rm "$ROOTFS/configure-system.sh"
|
||||
|
||||
umount "$ROOTFS/var/cache/apk"
|
||||
umount "$ROOTFS/var/cache/k8s-images"
|
||||
umount "$ROOTFS/dev"
|
||||
umount "$ROOTFS/proc"
|
||||
umount "$ROOTFS/sys"
|
||||
@@ -60,8 +50,8 @@ dd if=/dev/zero of="$IMG" bs=1 count=0 seek=$SIZE
|
||||
|
||||
sgdisk -o "$IMG" \
|
||||
-n 1:2048:+64M -t 1:0700 -c 1:config \
|
||||
-n 2:0:+3G -t 2:8300 -c 2:rootfsA \
|
||||
-n 3:0:+3G -t 3:8300 -c 3:rootfsB \
|
||||
-n 2:0:+2G -t 2:8300 -c 2:rootfsA \
|
||||
-n 3:0:+2G -t 3:8300 -c 3:rootfsB \
|
||||
-n 4:0:0 -t 4:8300 -c 4:data
|
||||
|
||||
losetup -D
|
||||
@@ -75,11 +65,18 @@ mkfs.ext4 -F "${TMP_LOOP}p2"
|
||||
mkfs.ext4 -F "${TMP_LOOP}p3"
|
||||
mkfs.ext4 -F "${TMP_LOOP}p4"
|
||||
|
||||
mkdir -p /mnt/img-root
|
||||
mkdir -p /mnt/img-root /mnt/data
|
||||
|
||||
mount "${TMP_LOOP}p2" /mnt/img-root
|
||||
mount "${TMP_LOOP}p4" /mnt/data
|
||||
|
||||
# Put the real /var onto the data partition
|
||||
cp -a "$ROOTFS/var" /mnt/data/
|
||||
|
||||
# Copy rootfs to root partition, but exclude /var
|
||||
cp -a "$ROOTFS"/. /mnt/img-root/
|
||||
rm -rf /mnt/img-root/var
|
||||
mkdir -p /mnt/img-root/var
|
||||
|
||||
mkdir -p /mnt/img-root/boot
|
||||
cp /build/Image.gz /mnt/img-root/boot/Image.gz
|
||||
@@ -88,6 +85,7 @@ cp /build/${DEVICE_TREE_TARGET}.dtb /mnt/img-root/boot/${DEVICE_TREE_TARGET}.dtb
|
||||
|
||||
sync
|
||||
umount /mnt/img-root
|
||||
umount /mnt/data
|
||||
|
||||
losetup -d "$LOOP"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ FUSE_OVERLAYFS="${FUSE_OVERLAYFS:-/usr/bin/fuse-overlayfs}"
|
||||
ARCHIVE_DIR="${KUBE_IMG_CACHE}/archives/${ARCH}/${KUBE_VERSION}"
|
||||
|
||||
# Seed directly into the target rootfs image store.
|
||||
TARGET_GRAPHROOT="${ROOTFS}/var/lib/containers/storage"
|
||||
TARGET_GRAPHROOT="${ROOTFS}/usr/lib/monok8s/imagestore"
|
||||
|
||||
# Build-host temporary runtime state for containers/storage.
|
||||
TMPDIR="$(mktemp -d)"
|
||||
@@ -117,4 +117,4 @@ done
|
||||
echo
|
||||
echo "Done."
|
||||
echo "Archives: ${ARCHIVE_DIR}"
|
||||
echo "CRI-O storage: ${TARGET_GRAPHROOT}"
|
||||
echo "CRI-O storage: ${TARGET_GRAPHROOT}"
|
||||
|
||||
9
alpine/rootfs-extra/etc/containers/storage.conf
Normal file
9
alpine/rootfs-extra/etc/containers/storage.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
[storage]
|
||||
driver = "overlay"
|
||||
runroot = "/run/containers/storage"
|
||||
graphroot = "/var/lib/containers/storage"
|
||||
|
||||
[storage.options]
|
||||
additionalimagestores = [
|
||||
"/usr/lib/monok8s/imagestore"
|
||||
]
|
||||
@@ -1,2 +1,3 @@
|
||||
PARTLABEL=config /opt/monok8s/config vfat defaults,noatime 0 0
|
||||
PARTLABEL=data /data ext4 defaults,noatime 0 21
|
||||
/data/var /var none rbind,noatime 0 0
|
||||
|
||||
Reference in New Issue
Block a user