Skip to content

Commit 3dfdac4

Browse files
authored
Merge pull request #67 from bart0sh/PR0013-config-documentation
documentation: add configuration instructions
2 parents 3b39456 + 221a03d commit 3dfdac4

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,52 @@ However, as devices and software grows more complex, vendors want to perform mor
2020
In the absence of a standard for third party devices, vendors often have to write and maintain multiple plugins for different runtimes or even directly contribute vendor specific code in the runtime.
2121
Additionally runtimes don't uniformly expose a plugin system (or even expose a plugin system at all) leading to duplication of the functionality in higher level abstractions (such as Kubernetes device plugins).
2222

23+
## How does CDI work?
24+
25+
For CDI to work the following needs to be done:
26+
27+
- CDI file containing update for the OCI spec in JSON format should be present in the CDI
28+
spec directory. Default directories are /etc/cdi and /var/run/cdi
29+
30+
- Fully qualified device name should be passed to the runtime either
31+
using command line parameters for podman or using container annotations
32+
for CRI-O and Containerd
33+
34+
- Container runtime should be able to find CDI file by the device name
35+
and update container config using CDI file content.
36+
37+
## How to configure CDI?
38+
39+
### CRI-O configuration
40+
41+
In CRI-O CDI support is enabled by default. It is configured with the default `/etc/cdi, /var/run/cdi`
42+
CDI directory locations. Therefore you can start using CDI simply by dropping CDI configuration files
43+
in either of those directories, static configuration into `/etc/cdi` and dynamically updated one into
44+
`/var/run/cdi`. If you are unsure of the configured directories you can run this command to find them
45+
out:
46+
47+
```bash
48+
$ crio config |& grep -B1 -A5 cdi_spec_dirs
49+
```
50+
51+
### Containerd configuration
52+
53+
To enable and configure CDI support in the [containerd runtime](https://github.com/containerd/containerd) 2 configuration options `enable_cdi` and `cdi_spec_dirs` should be set in the `plugins."io.containerd.grpc.v1.cri` section of the containerd configuration file (`/etc/containerd/config.toml` by default):
54+
55+
```
56+
[plugins."io.containerd.grpc.v1.cri"]
57+
enable_cdi = true
58+
cdi_spec_dirs = ["/etc/cdi", "/var/run/cdi"]
59+
```
60+
61+
Remember to restart containerd for any configuration changes to take effect.
62+
63+
### Podman configuration
64+
65+
[podman](https://github.com/containers/podman) does not require any specific configuration to enable CDI support and processes specified `--device` flags directly. If fully-qualified device selectors (e.g. `vendor.com/device=myDevice`) are included the CDI specifications at the default location (`/etc/cdi` and `/var/run/cdi`) are checked for matching devices.
66+
67+
*Note:* Although initial support was added in [`v3.2.0`](https://github.com/containers/podman/releases/tag/v3.2.0) this was updated for the tagged `v0.3.0` CDI spec in [`v4.1.0-rc.1`](https://github.com/containers/podman/releases/tag/v4.1.0-rc1) with [commit a234e4e](https://github.com/containers/podman/commit/a234e4e19662e172472877ce69523f4afea5c12e).
68+
2369
## Examples
2470
```bash
2571
$ mkdir /etc/cdi

0 commit comments

Comments
 (0)