Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove initramfs/vmlinuz references for mac bundles #996

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions crc-bundle-info.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# - 1.2: addition of 'storage.fileList'
# - 1.3: remove of 'clusterInfo.kubeadminPasswordFile'
# - 1.4: addition of 'arch'
# - 1.5: remove of 'node[0].kernelCmdLine', 'node[0].initramfs', 'node[0].kernel'
"version": "1.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be set to 1.5

# Type of this bundle content
# Currently the only valid type is 'snc' (which stands for 'single-node-cluster')
Expand Down Expand Up @@ -56,12 +57,6 @@
"diskImage": "crc.qcow2"
# Internal IP for which etcd certs are valid
"internalIP": "192.168.126.11"
# kernel command line of the node
"kernelCmdLine": "BOOT_IMAGE=/ostree/rhcos-bf3b38268ddb2a2070dc587b361ce45c46a6f9e3606bbd3b5e15b2e6d3d47e5d/vmlinuz-4.18.0-80.1.2.el8_0.x86_64 console=tty0 console=ttyS0,115200n8 rootflags=defaults,prjquota rw root=UUID=a8fbdcb1-63ea-421e-8f6f-dac9cbbcc822 ostree=/ostree/boot.0/rhcos/bf3b38268ddb2a2070dc587b361ce45c46a6f9e3606bbd3b5e15b2e6d3d47e5d/0 coreos.oem.id=qemu ignition.platform.id=qemu"
# initramfs file of the node
"initramfs": "initramfs-4.18.0-80.1.2.el8_0.x86_64.img"
# kernel file of the node
"kernel": "vmlinuz-4.18.0-80.1.2.el8_0.x86_64"
}
],
"storage": {
Expand Down
17 changes: 1 addition & 16 deletions createdisk-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,27 +257,15 @@ function generate_macos_bundle {
local bundleType=$1
local srcDir=$2
local destDir=$3
local tmpDir=$4
local kernel_release=$5
local kernel_cmd_line=$6


mkdir -p "$destDir"
cp $srcDir/kubeconfig $destDir/
cp $srcDir/id_ecdsa_crc $destDir/
cp $tmpDir/vmlinuz-${kernel_release} $destDir/
cp $tmpDir/initramfs-${kernel_release}.img $destDir/

# Copy oc client
cp openshift-clients/mac/oc $destDir/

# aarch64 only supports uncompressed kernels, see
# https://github.com/code-ready/vfkit/commit/4aaa4fbdc76f9fc0ccec2b9fda25c5235664e7d6
# for more details
if [ "${ARCH}" == "aarch64" ]; then
mv $destDir/vmlinuz-${kernel_release} $destDir/vmlinuz-${kernel_release}.gz
gunzip $destDir/vmlinuz-${kernel_release}.gz
fi

cp podman-remote/mac/podman $destDir/

ocSize=$(du -b $destDir/oc | awk '{print $1}')
Expand All @@ -289,9 +277,6 @@ function generate_macos_bundle {
# Update the bundle metadata info
cat $srcDir/crc-bundle-info.json \
| ${JQ} ".name = \"${destDir}\"" \
| ${JQ} ".nodes[0].kernel = \"vmlinuz-${kernel_release}\"" \
| ${JQ} ".nodes[0].initramfs = \"initramfs-${kernel_release}.img\"" \
| ${JQ} ".nodes[0].kernelCmdLine = \"${kernel_cmd_line}\"" \
| ${JQ} ".storage.fileList[0].name = \"oc\"" \
| ${JQ} '.storage.fileList[0].type = "oc-executable"' \
| ${JQ} ".storage.fileList[0].size = \"${ocSize}\"" \
Expand Down
22 changes: 1 addition & 21 deletions createdisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,6 @@ fi

podman_version=$(${SSH} core@${VM_IP} -- 'rpm -q --qf %{version} podman')

# Get the rhcos ostree Hash ID
ostree_hash=$(${SSH} core@${VM_IP} -- "cat /proc/cmdline | grep -oP \"(?<=${BASE_OS}-).*(?=/vmlinuz)\"")

# Get the rhcos kernel release
kernel_release=$(${SSH} core@${VM_IP} -- 'uname -r')

# Get the kernel command line arguments
kernel_cmd_line=$(${SSH} core@${VM_IP} -- 'cat /proc/cmdline')

# Get the vmlinux/initramfs to /tmp/kernel and change permission for initramfs
${SSH} core@${VM_IP} -- "mkdir /tmp/kernel && sudo cp -r /boot/ostree/${BASE_OS}-${ostree_hash}/*${kernel_release}* /tmp/kernel && sudo chmod 644 /tmp/kernel/initramfs*"

# SCP the vmlinuz/initramfs from VM to Host in provided folder.
${SCP} -r core@${VM_IP}:/tmp/kernel/* $INSTALL_DIR
${SSH} core@${VM_IP} -- "sudo rm -fr /tmp/kernel"

# Shutdown the VM
shutdown_vm ${VM_NAME}

Expand Down Expand Up @@ -196,9 +180,5 @@ fi
if [ "${SNC_GENERATE_MACOS_BUNDLE}" != "0" ]; then
vfkitDestDir="${destDirPrefix}_vfkit_${destDirSuffix}"
rm -fr ${vfkitDestDir} ${vfkitDestDir}.crcbundle
generate_vfkit_bundle "$libvirtDestDir" "$vfkitDestDir" "$INSTALL_DIR" "$kernel_release" "$kernel_cmd_line"

# Cleanup up vmlinux/initramfs files
rm -fr "$INSTALL_DIR/vmlinuz*" "$INSTALL_DIR/initramfs*"
generate_vfkit_bundle "$libvirtDestDir" "$vfkitDestDir"
fi

3 changes: 1 addition & 2 deletions test-metadata-generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ mkdir -p "$srcDir"
mkdir -p "$srcDir/auth"
touch "$srcDir"/auth/kubeconfig
touch id_ecdsa_crc
touch "$srcDir"/vmlinuz-0.0.0
touch "$srcDir"/initramfs-0.0.0.img


echo {} | ${JQ} '.version = "1.2"' \
| ${JQ} '.type = "snc"' \
Expand Down