coreos / coreos-installer

Installer for CoreOS disk images
https://coreos.github.io/coreos-installer/
Apache License 2.0
216 stars 92 forks source link

cmdline: Provide dest_device when using iso/pxe customize #1480

Open duyiwei7w opened 3 weeks ago

duyiwei7w commented 3 weeks ago

During the execution of coreos-installer install, users are required to provide dest-device through parameters or config file. However, when executing iso/pxe customize, it is not necessary to provide dest-device to successfully execute customize. This will obviously result in errors when using a customized image for installation. Some previous discussions can be found at:

https://github.com/coreos/coreos-installer/issues/1469

This modification unifies the behavior of the customize command and the install command during the image install phase, requiring users to provide dest-device through parameters or config files.

jlebon commented 2 weeks ago

Kernel arguments can also be used to specify the destination device (coreos.inst.install_dev).

How about instead as soon as any --dest argument is passed but not --dest-device we print a note that we expect the destination device to be passed either through a later customize call or via coreos.inst.install_dev?

duyiwei7w commented 2 weeks ago

Thank you for your suggestion @jlebon . As far as I know, if we use coreos-installer install parameters, in addition to directly specifying dest_device or using configfile. We can also use kernel parameters to pass the destination device .

So I want to make as little modification as possible in customize, and keep the behavior basically consistent with the coreos-installer install concept.

That is, the user is required to enter --dest-device by default, and a prompt is printed if there is no dest_device. If configfile is used, dest_device does not need to be specified. For advanced kernel parameters, there is no unified requirement, and it will not detect whether coreos.inst.install_dev is explicitly specified.

duyiwei7w commented 2 weeks ago

Also, as you said, if the user enters any--dest parameter but no --dest-device, we print a prompt. But if the user passes the target disk throughinstallerconfig or kernel parameters, then this prompt is unnecessary.

In other words, we may need to parse all the customize parameters entered by the user again to confirm that they have not been passed to the destination device before printing the prompt. In fact, it is better to directly ask the user to use --dest-device as mentioned above.

jlebon commented 2 weeks ago

We need to be flexible in how the ISO can be used. For example, you can imagine someone providing a pre-customized ISO/PXE initramfs to a user, with the understanding that the user will customize it further with the actual destination device (or e.g. add the needed karg in their PXE config).

But note also that the customize command can also be used to customize a live ISO that will be used solely for its live environment, with no intent of installing a CoreOS system.