From a7171355afd176cc66c3e6ae53ec8ee561752b0c Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Mon, 30 Dec 2024 11:55:18 +0530 Subject: [PATCH] Remove initramfs/vmlinuz references for mac bundles After https://github.com/crc-org/crc/pull/4309 we don't need to use those references for running the bundle on macOS so better to remove this unused code/reference. fixes: #992 --- crc-bundle-info.json.sample | 7 +------ createdisk-library.sh | 17 +---------------- createdisk.sh | 22 +--------------------- test-metadata-generation.sh | 3 +-- 4 files changed, 4 insertions(+), 45 deletions(-) diff --git a/crc-bundle-info.json.sample b/crc-bundle-info.json.sample index 17318388..d63f26fb 100644 --- a/crc-bundle-info.json.sample +++ b/crc-bundle-info.json.sample @@ -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", # Type of this bundle content # Currently the only valid type is 'snc' (which stands for 'single-node-cluster') @@ -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": { diff --git a/createdisk-library.sh b/createdisk-library.sh index 1d25ca45..82fbbae6 100755 --- a/createdisk-library.sh +++ b/createdisk-library.sh @@ -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}') @@ -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}\"" \ diff --git a/createdisk.sh b/createdisk.sh index 95601077..7fed08ec 100755 --- a/createdisk.sh +++ b/createdisk.sh @@ -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} @@ -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 - diff --git a/test-metadata-generation.sh b/test-metadata-generation.sh index 7a475446..ded4f173 100644 --- a/test-metadata-generation.sh +++ b/test-metadata-generation.sh @@ -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"' \