Skip to content

Add make target to fetch the default kernel#33

Merged
adityaramani merged 4 commits intomainfrom
users/a_ramani/kernel-prompt
Jun 7, 2025
Merged

Add make target to fetch the default kernel#33
adityaramani merged 4 commits intomainfrom
users/a_ramani/kernel-prompt

Conversation

@adityaramani
Copy link
Contributor

@adityaramani adityaramani commented Jun 7, 2025

Replaces the --install-dependencies flag with the (enable/disable)-kernel-install flag. If the flag is not passed - the default behavior is prompting the user for a response.

Also adds a make target install-kernel

➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: n
Please use the `container system kernel set --recommended` command to configure the default kernel

➜ bin/container system start --disable-kernel-install
Verifying apiserver is running...

➜ bin/container system start --enable-kernel-install
Verifying apiserver is running...
Installing kernel...

➜ bin/container system start --help

USAGE: container system start ... [--enable-kernel-install] [--disable-kernel-install]
...
  --enable-kernel-install/--disable-kernel-install
                          Specify if the default kernel should be installed or not.

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
@egernst
Copy link
Contributor

egernst commented Jun 7, 2025

I feel like if the user specifies the fetch kernel flag they are effectively saying yes. Do you think it’s necessary to take prompt?

@adityaramani
Copy link
Contributor Author

Well, today there was no way for a headless user to say that they didnt want the default kernel to be configured on system start. And using of the same --fetch-default-kernel option for this made sense.

Since we need to provide 3 possible options, we couldnt treat the parameter as a boolean flag - which is the reason for needing the 'yes' or 'no'

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
@adityaramani
Copy link
Contributor Author

adityaramani commented Jun 7, 2025

Updated the behavior to switch back to using a flag that defaults to a nil value - which uses the interactive mode. The description reflects the new behavior

Copy link
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

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

See comments, feel free to merge as is and changes can go into a small follow-up, or ping me after changes and I'll approve again.

print("No default kernel configured.")
print("Install the recommended default kernel from [\(kernelDependency.source)]? [Y/n]: ", terminator: "")
if !installDependencies {
var shouldInstallKernel = false
Copy link
Contributor

@jglogan jglogan Jun 7, 2025

Choose a reason for hiding this comment

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

a discussion for a follow-up maybe:

Better to assume --enable-kernel-install or --disable-kernel-install if system start isn't run from an interactive terminal?

My feeling is that that is too magical. It's simpler to have it just as it is now, with yes/no/default to interactive, and that the following sort of usage is accepted (though flags would be the recommended approach):

echo y | container system start

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
@adityaramani adityaramani force-pushed the users/a_ramani/kernel-prompt branch from 97eba30 to a6b039f Compare June 7, 2025 19:26
@adityaramani adityaramani merged commit f86dcef into main Jun 7, 2025
2 checks passed
@adityaramani adityaramani deleted the users/a_ramani/kernel-prompt branch June 7, 2025 19:45
owenarthur pushed a commit to owenarthur/container that referenced this pull request Jun 10, 2025
Replaces the `--install-dependencies` flag with the
`(enable/disable)-kernel-install` flag. If the flag is not passed - the
default behavior is prompting the user for a response.

Also adds a make target `install-kernel`

```
➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: n
Please use the `container system kernel set --recommended` command to configure the default kernel

➜ bin/container system start --disable-kernel-install
Verifying apiserver is running...

➜ bin/container system start --enable-kernel-install
Verifying apiserver is running...
Installing kernel...

➜ bin/container system start --help

USAGE: container system start ... [--enable-kernel-install] [--disable-kernel-install]
...
  --enable-kernel-install/--disable-kernel-install
                          Specify if the default kernel should be installed or not.

```

---------

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants