-
Notifications
You must be signed in to change notification settings - Fork 707
Remove VMType check from the lima-init boot script #3861
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
Conversation
This should be returned by the driver, instead of hardcoded on driver name like now: func useCloudInit(instConfig *limayaml.LimaYAML) bool {
// all drivers but WSL2 use cloud-init
return *instConfig.VMType != limayaml.WSL2
} Not so keen on the variable name, but it does follow the "default is false" convention.
|
Needs rebase |
Now the script has been duplicated in each driver instead:
https://github.com/lima-vm/lima/blob/master/pkg/driver/wsl2/boot/02-wsl2-setup.sh # This script replaces the cloud-init functionality of creating a user and setting its SSH keys
# when using a WSL2 VM.
[ "$LIMA_CIDATA_VMTYPE" = "wsl2" ] || exit 0 # This script replaces the cloud-init functionality of creating a user and setting its SSH keys
# when using a AC VM.
[ "$LIMA_CIDATA_VMTYPE" = "ac" ] || exit 0 # This script replaces the cloud-init functionality of creating a user and setting its SSH keys
# when using a DC VM.
[ "$LIMA_CIDATA_VMTYPE" = "dc" ] || exit 0 But it still needs to be fixed in the cidata, still hardcoded: if args.VMType == limatype.WSL2 || args.VMType == limatype.AC || args.VMType == limatype.DC {
layout = append(layout, iso9660util.Entry{
Path: "ssh_authorized_keys",
Reader: strings.NewReader(strings.Join(args.SSHPubKeys, "\n")),
})
return writeCIDataDir(filepath.Join(instDir, filenames.CIDataISODir), layout)
}
return iso9660util.Write(filepath.Join(instDir, filenames.CIDataISO), "cidata", layout) |
Do this when setting up the cidata instead, next to the decision on whether to use "cidata" dir or "cidata.iso". This means that this particular boot script is not depending on the driver, but can be used from all container drivers. Signed-off-by: Anders F Björklund <[email protected]>
94551ef
to
06b4afa
Compare
Instead of hardcoding which drivers do not use cloud-init, make it into a driver feature. Currently, that is only WSL2. The container drivers do mount a cidata.iso, instead they mount a cidata dir. Then they include a boot script for it. Signed-off-by: Anders F Björklund <[email protected]>
06b4afa
to
78f6afc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Do this when setting up the cidata instead, next to the decision on whether to use "cidata/" directory or "cidata.iso".
This means that this particular boot script is not depending on the driver, but can be used from all container drivers.
Apple Container external driver for macOS #3839
Kata/Docker Container external driver for Linux #3840
We probably want to add an explicit
bool
config for it to the driver, instead of checking for the driver name?And there are still some features left to add to the script (from cloud-config), like the hostname and timezone.
Currently we dont use
user-data
, butlima.env
(+ ssh key)We execute this script through the
boot.sh
directly (lima-init).