add yamls and mods to accept various images
This commit is contained in:
parent
e9825ad01a
commit
b44639dfe0
6 changed files with 133 additions and 18 deletions
|
|
@ -5,19 +5,13 @@ set -exu
|
|||
apt-get update
|
||||
apt-get install -y \
|
||||
curl \
|
||||
bzip2 \
|
||||
openssh-client \
|
||||
qemu-kvm
|
||||
|
||||
URL="http://${CL_CHANNEL}.release.core-os.net/amd64-usr/${CL_VERSION}/coreos_production_qemu_image.img.bz2"
|
||||
echo "Downloading Container Linux $CL_CHANNEL $CL_VERSION $URL"
|
||||
curl -O $URL
|
||||
bzip2 -d coreos_production_qemu_image.img.bz2
|
||||
|
||||
curl -L https://github.com/coreos/container-linux-config-transpiler/releases/download/v0.3.0/ct-v0.3.0-x86_64-unknown-linux-gnu -o ct
|
||||
chmod +x ct
|
||||
|
||||
apt-get remove -y curl bzip2
|
||||
apt-get autoremove -y
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eox pipefail
|
||||
|
||||
VM_NAME="${VM_NAME:-coreos-kvm}"
|
||||
VM_NAME="${VM_NAME:-k8s-kvm}"
|
||||
VM_MEMORY="${VM_MEMORY:-4G}"
|
||||
VM_DISK_SIZE="${VM_DISK_SIZE:-12G}"
|
||||
# hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport
|
||||
HOSTFWD="${HOSTFWD:-hostfwd=tcp::2222-:22}"
|
||||
DISK_IMG="${DISK_IMG:-./coreos_production_qemu_image.img}"
|
||||
CD_ARG=""
|
||||
|
||||
if [ -n "${CLOUD_CONFIG_FILE}" ]; then
|
||||
echo "Setting cloud config file: ${CLOUD_CONFIG_FILE}"
|
||||
|
|
@ -32,7 +33,9 @@ if [ -n "$CONFIG_FILE" ]; then
|
|||
set -- -fw_cfg name=opt/com.coreos/config,file="${PWD}/ignition.json" "$@"
|
||||
fi
|
||||
|
||||
qemu-img resize ./coreos_production_qemu_image.img "${VM_DISK_SIZE}"
|
||||
if [ -n "$CD_IMG" ]; then
|
||||
CD_ARG="-drive file=${CD_IMG},media=cdrom"
|
||||
fi
|
||||
|
||||
# https://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu.sh
|
||||
qemu-system-x86_64 \
|
||||
|
|
@ -40,10 +43,12 @@ qemu-system-x86_64 \
|
|||
-enable-kvm \
|
||||
-cpu host \
|
||||
-m "${VM_MEMORY}" \
|
||||
-net nic,model=virtio \
|
||||
-net user,"${HOSTFWD}",hostname="${VM_NAME}" \
|
||||
-drive if=virtio,file=./coreos_production_qemu_image.img \
|
||||
-device virtio-net,netdev=vmnic \
|
||||
-netdev user,id=vmnic,"${HOSTFWD}",hostname="${VM_NAME}" \
|
||||
-drive if=virtio,file="${DISK_IMG}" \
|
||||
${CD_ARG} \
|
||||
-nographic \
|
||||
-machine accel=kvm \
|
||||
-vga std \
|
||||
-smp 2 \
|
||||
"$@"
|
||||
$@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue