Commit Graph

71 Commits

Author SHA1 Message Date
Fabiano Fidêncio
7f0289de60 kata-manager: Avoid docker rate-limit
To do so, use a test image from quay.io instead of docker.io.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-08-23 11:56:09 +02:00
Fabiano Fidêncio
5fe65e9fc2
kata-manager: Only check files when tarball is not passed
Only do the checking in case the tarball was not explicitly passed by
the user.  We have no control of what's passed and we cannot expect that
all the files are going to be under /opt.

Fixes: #10147

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-08-12 13:54:24 +02:00
Fabiano Fidêncio
bfd014871a kata-manager: Ensure distro specific TDX config is set
We've done something quite similar for kata-deploy, but I've noticed we
forgot about the kata-manager counterpart.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-08-01 17:27:01 +02:00
Archana Shinde
7a3e13fae8 kata-manager: Add symlinks for runc and slirp4netns
For nerdctl install, add symlinks for runc and slirp4netns in the
binary install path.
runc link comes in handy for running runc containers with nerdctl fir
quick tests.
slirp4netns allows for running containers with user mode networking
useful in case of rootless containers.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-05-31 13:53:42 -07:00
Archana Shinde
0e28e904e0 kata-manager: Install cni for containerd
When just containerd is installed without installing nerdctl,
cni plugins are missing from the installation.
containerd tarball does not include cni plugin files.
Hence install cni plugins separately for containerd.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-05-18 00:19:57 +00:00
Archana Shinde
d23d58a484 kata-manager: Copy cni files under /opt/cni
nerdctl requires cni plugins to be installed in /opt/cni/bin
Without bridge plugin installed, it is not possible to run a
container with nerdctl.
The downloaded nerdctl tarball contains cni plugin files, but are
extracted under /usr/local/libexec.
Copy extracted tarball cni files under /usr/local/libexec
to /opt/cni/bin

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-05-18 00:16:48 +00:00
James O. D. Hunt
13966f4d1d docs: kata-manager: Add help for permissions issue
The 3.3.0 release installs the `kata-manager` script with overly restrictive
permissions (see #9373), so add details to help users handle the situation.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-28 16:22:10 +00:00
James O. D. Hunt
5589e4e291 docs: kata-manager: Update with latest details
Now that v3.3.0 has been released, simplify
the `kata-manager` documentation.

Fixes: #9227.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-28 16:22:10 +00:00
James O. D. Hunt
52fe60c94b docs: kata-manager: Fix heading levels
Add an extra heading indent so that there is only a single
top-level heading.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-28 16:21:31 +00:00
James O. D. Hunt
a6c3f75872 kata-manager: Fix Docker install
Fix the Docker install by removing the second (erroneous) call to
`containerd_installed()` in `handle_docker()`.

Without this fix, installing using Docker (`-D`) will work *iff* you
already have containerd installed. However, if you do not have
containerd installed, the `containerd_installed()` function returns 1,
which exits the script as we're running with `set -e`, leaving a broken
Docker installation.

> **Note:** containerd is installed via Docker's `get-docker.sh` script.

Fixes: #9292.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-18 14:08:35 +00:00
James O. D. Hunt
7af892f8d8 docs: Update kata-manager docs for switching hypervisor
Add details to the README for `kata-manager` showing how to list
available hypervisor configs (packaged and local), and switch between
the configurations. Also, update the hypervisors page to show a lot more
detail about the hypervisor configurations, including the "short name"
used by `kata-manager` for switching hypervisor config.

> **Note:**
>
> These changes only apply to the current default golang runtime.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 12:24:31 +00:00
James O. D. Hunt
1ac3caf656 kata-manager: Allow hypervisor to be changed
Add new options to allow the configured hypervisor to be changed:

- `-L`: List available _packaged_ hypervisor config short names.
- `-e`: List available _local_ hypervisor config names.
- `-H <hypervisor>`: Install Kata then switch to the specified hypervisor.
- `-S <hypervisor>`: Switch to the specified hypervisor (by config short name [Errors if Kata not installed]).

For example, to install Kata and configure it to use Cloud Hypervisor
with the golang Kata runtime:

```bash
$ kata-manager.sh -H clh
```

To switch back to the default hypervisor:

```bash
$ kata-manager.sh -S default
```

To show details of the available packaged configs:

```bash
$ kata-manager.sh -L
```

To show details of the local configs:

```bash
$ kata-manager.sh -e
```

> **Notes:**
>
> - This change **only** applies to the current default (golang) Kata runtime.
>
> - Although this is mainly for users wishing to switch hypervisor (by
>   changing the Kata config file to another of the packaged config files
>   provided for specific hypervisors), strictly it allows users to change
>   to _any_ config file. For example, if the user has a config file called
>   `/etc/kata-containers/configuration-my-custom-config.toml`, they could
>   switch to this by running:
>
>   ```bash
>   $ kata-manager.sh -S my-custom-config
>   ```
>
> - The "config short names" are the hypervisor specific part of the configuration file name.
>   For example, the config short name for file `configuration-qemu.toml` is
>   `qemu` and the config short name for `configuration-clh.toml` is `clh`.

Fixes: #8305.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 12:18:00 +00:00
James O. D. Hunt
0bb558c0b9 kata-manager: Fix symlink handling
The `configure_kata()` function modifies the configuration file to
enable debug. But it was doing this by calling `sed -i` which, by
default, creates a new _file_ from the `configuration.toml` symbolic
link. This defeated the point of the symbolic link which is supposed to
resolve to the local copy of the pristine config file, so we now use
the GNU sed(1) specific `---follow-symlinks` option to retain the
sym-link.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
455637b30a kata-manager: Show message when checking file
Add an info message just before the archive file is checked. This keeps
the user informed about what is happening as it can take a few seconds
to perform the checks on slower systems.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
ce350450e8 kata-manager: Sort options in usage
Ensure the usage statement lists all options in alphabetical order.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
159d29665a kata-manager: Whitespace fixes
Remove extraneous whitespace.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
Fabiano Fidêncio
ed6816e29f
kata-manager: Add support for nerdctl installation
As already done for docker, let's also add support for installing
nerdctl + kata containers.

For now, at least for now, we are explicitly not allowing the
combination of installing both docker and nerdctl in the same
installation in order to reduce the script complexity.

Also, nerdctl installation, for now, is limited to x86_64 and aarch64 as
those are the only architectures that nerdctl releases a "full" package
for.

Fixes: #8358

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-01 09:19:35 +01:00
wvell
af4622fcc1 docs: Remove warning for cgroupsv2 only operating systems
Removes warning for cgroupsv2 as it is not needed anymore according to #6259.

Fixes #8650

Signed-off-by: wvell <w.vellema@slash2.nl>
2023-12-13 09:18:39 +01:00
Fabiano Fidêncio
1699b84f13 utils: kata-manager: Remove $enable_debug from the install_kata call
This was added as part of d4d65bed38, but
install_kata has never actually used the passed enable_debug var.

With this in mind, let's just remove it.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-14 17:34:03 +01:00
Fabiano Fidêncio
38d2edd83b utils: kata-manager: Allow installing kata from a given tarball
With this change, we give the users the change to try kata-containers
with their own pre-built tarball.

This will become very useful in the CI context, as we won't be
downloading a specific version of kata-containers, but rather installing
whatever was built in previous steps of the CI pipeline.

Fixes: #8438

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-14 17:34:01 +01:00
James O. D. Hunt
a781ce33b0
Merge pull request #8383 from jodh-intel/kata-manager-add-list-option
utils: kata-manager: Add option to list versions
2023-11-13 16:18:36 +00:00
James O. D. Hunt
0ead018d0a utils: kata-manager: Add Docker details to list output
Add Docker version details to the output of the list versions
CLI option.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
be3044fd01 utils: kata-manager: Add option to list versions
Add a command-line option to list the installed and available versions
of Kata and containerd.

Fixes: #8355.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
9969f5a94a utils: kata-manager: Make test container name more unique
Rather than creating a container called `test-kata`, prefix with the
script name to make it a bit "more unique" and less likely for users to
have an existing container with the test container name. The new test
container name is `kata-manager-sh-test-kata`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
436d7d1275 utils: kata-manager: Improve usage message
Update the usage to show that the latest Kata version can also be queried using
`kata-ctl`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:29:14 +00:00
James O. D. Hunt
1625a5ce48 utils: kata-manager: Improve version check
Update `github_get_latest_release()` to use `sort -V` rather than
sub-sorting on the major, minor and patch level version number elements.

The new approach is safer and more accurate.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:29:14 +00:00
James O. D. Hunt
c72a27e219 utils: kata-manager: Ensure only one download URL
Add an extra sanity check to ensure that only a single download URL is
found for the specified release version.

Fixes: #8364.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:27:23 +00:00
James O. D. Hunt
839f6c3d44 utils: kata-manager: Improve info messages
Improve some of the information messages a little by adding
more detail and quoting file names.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:27:20 +00:00
Fabiano Fidêncio
5d10aed9ba kata-manager: Make containerd_config a global var
As "/etc/containerd/config.toml" is used from more than one place, let's
just make it a global var.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:47:52 +01:00
Fabiano Fidêncio
66d1b2c173 kata-manager: Add support for docker installation
Add support for also installing the Docker CLI, giving users the chance
to try Kata Containers with docker in the same way we provide users the
chance to try Kata Containers with `ctr`.

Fixes: #8357

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:47:52 +01:00
Fabiano Fidêncio
0352f1e029 kata-manager: Allow passing a specific tool to test_installation
Right now we're only testing with `ctr` and there's no change in
behaviour with this commit.  However, allowing to pass a tool to run the
tests with gives us an easier time when expanding kata-manager to
support, for instance, docker and nerdctl.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 11:24:37 +01:00
Fabiano Fidêncio
8b4fc847d7 kata-manager: Accept only "lts" or "active" as containerd versions
kata-manager is a very nice tool, but we shouldn't be trying to take
care of "everything" in "all possible scenarios", and we should focus on
installing Kata Containers dependencies that are supported.

With this in mind, let's limit a little bit the scope of which versions
of containerd can be installed, limitting to "active" and "lts", which
will then install the latest version of those "flavours".  The default
value will always be "lts" as that's supposed to be the stable one.

NOTE: This is a breaking change, as it changes the behaviour of what the
script takes in its `-c` parameter.  I'm assuming here we're safe to do
so as the majority of the users should / would only be using the full
installation by default.

Fixes: #8356

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-03 10:30:37 +01:00
Fabiano Fidêncio
37233622da kata-manager: Ensure we run apt-get update before apt-get install
As that's an operation that can easily fail, and it's quite simple /
cheap for us to run it, let's just do it and avoid the failure.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-02 14:14:32 +01:00
briwan.wang
437db15916 kata-manager: Fix Mulit-Arch deployment for containerd
Fix: Kata-Manager fails to retrieve the correct Containerd string name
for architectures other than amd64.

Update the 'github_get_release_file_url()' function to make it compatible
with different architecture expressions. eg. aarch64/arm64, or x86_64/amd64,
allowing it to acquire the correct URL addresses

Fixes: #7071

Signed-off-by: briwan.wang <briwan.wang@arm.com>
2023-11-02 06:12:04 +00:00
James O. D. Hunt
ae3ea1421d utils: kata-manager: Fix containerd version check
Contained release files include the version number without a "v" prefix.
However, the tag for the equivalent release does include it so handle
this distinction and also tighten up the Kata check by specifying an
explicit version number in the regex.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-10-26 16:34:56 +01:00
James O. D. Hunt
346f195532 utils: kata-manager: Fix whitespace
Use tabs consistently.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-10-26 16:06:51 +01:00
James O. D. Hunt
2ac7ac1dd2 utils: kata-manager: Fix "Cannot determine download URL" issue
The archive names for x86_64 [Kata releases](https://github.com/kata-containers/kata-containers/releases)
used to include the tag `x86_64`, but that has now been changed to
`amd64`, which unfortunately broke `kata-manager.sh`:

```
kata-static-3.1.3-x86_64.tar.xz
                  ~~~~~~
                  expected

kata-static-3.2.0-alpha3-x86_64.tar.xz
                         ~~~~~~
                         expected

kata-static-3.2.0-alpha4-amd64.tar.xz
                         ~~~~~
                         changed
```

Fixes: #8321.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-10-26 15:27:37 +01:00
James O. D. Hunt
59bd534827 utils: kata-manager: Lint fixes
Improve the code by fixing some lint issues:

- defining variables before using them.
- Using `grep -E` rather than `egrep`.
- Quoting variables.
- Adding a check for invalid CLI arguments.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-10-26 15:24:46 +01:00
Archana Shinde
d3250dff34 kata-manager: Add clh config to containerd config file
kata-manager currently adds default config which currently is qemu.
Add config for clh as well to containerd configuration.
This should allow new users to get started with clh using kata-manager.

Also add config related to enabling privileged_without_host_devices.
Always good to have this config enabled when users try to run privileged
containers so that devices from host are not inadverdantly passed to the
guest.

Fixes: #8280

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2023-10-20 18:16:16 -07:00
James O. D. Hunt
52f6449b70 kata-manager: Remove initcall_debug kernel option
Removed the addition of the `initcall_debug` kernel option when agent
debugging enabled. This option has nothing to do with the agent.

If the user wishes to use this option, they can add it to the
`kernel_params=` setting in the Kata configuration file's hypervisor
stanza.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-09-11 09:31:44 +01:00
James O. D. Hunt
73913c8eb7 kata-manager: Fix '-o' syntax and logic error
Fix the syntax and logic error that is only displayed if the user runs
the script with `-o`. This option requests that "only" Kata Containers
is installed and stops containerd from being installed.

Fixes: #6822.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-05-12 16:44:24 +01:00
Archana Shinde
96e8470dbe kata-manager: Fix containerd download
Newer containerd releases have an additional static package published.
Because of this,  download_url contains two urls causing curl to fail.
To resolve this, pick the first url from the containerd releases to
download containerd.

Fixes: #6695

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2023-04-20 23:08:51 -07:00
Gabe Venberg
dd23f452ab utils: renamed only_kata to skip_containerd
Renamed for greater clarity as to what that flag does.

Signed-off-by: Gabe Venberg <gabevenberg@gmail.com>
2023-03-17 16:09:45 -05:00
Gabe Venberg
59c81ed2bb utils: informed pre-check about only_kata
passed the only_kata variable through to pre_check, only_kata does not
abort the install when containerd is already installed.

fixes #6385

Signed-off-by: Gabe Venberg <gabevenberg@gmail.com>
2023-03-17 15:58:57 -05:00
tg5788re
f8e44172f6 utils: Make kata-manager.sh runs checks
Updated the `kata-manager.sh` script to make it run all the checks on
the host system before attempting to create a container. If any checks
fail, they will indicate to the user what the problem is in a clearer
manner than those reported by the container manager.

Fixes: #6281.

Signed-off-by: tg5788re <jfokugas@gmail.com>
2023-03-03 09:56:12 -06:00
Alec Pemberton
4b8a5a1a3d utils: Remove kata-manager.sh cgroups v2 check
Removed the part in the `kata-manager.sh` script that checks if the host system only runs cgroups v2.

Fixes: #6259.

Signed-off-by: Alec Pemberton <pembek1901@gmail.com>
2023-02-28 11:23:51 -06:00
Gabe Venberg
3cfce5a709 utils: improved unsupported distro message.
previously, if installing on unkown distro, script would tell user that
their distro was unsupported. Changed error message prompting user to
install dependecies manually, then retry.

Signed-off-by: Gabe Venberg <gabevenberg@gmail.com>
2023-02-17 09:06:26 -06:00
Gabe Venberg
1047840cf8 utils: always check some dependencies.
Every dependency in check_deps is used inside the script (apart from
git, which may be a historical artifact), and therefore should be
checked even when the -f option is passed to the script. Simply changed
at what point check_deps is called in order to always run it.

Fixes #6302.

Signed-off-by: Gabe Venberg <gabevenberg@gmail.com>
2023-02-16 23:00:19 -06:00
James O. D. Hunt
be12baf3cf manager: Change here documents to use standard delimiter
All scripts should use `EOF` as the shell here document delimiter as
this is checked by the static checker.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-10 09:19:29 +00:00
James O. D. Hunt
9576a7da5d manager: Add options to change self test behaviour
Added new `kata-manager` options to control the self-test behaviour. By
default, after installation the manager will run a test to ensure a Kata
Containers container can be created. New options allow:

- The self test to be disabled.
- Only the self test to be run (no installation).

These features allow changes to be made to the installed system before
the self test is run.

Fixes: #3851.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-10 09:19:29 +00:00