Skip to content

Commit 731f713

Browse files
committed
docs(rootfs-view): document config and task flow
Signed-off-by: sidneychang <2190206983@qq.com>
1 parent 374e602 commit 731f713

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

docs/configuration.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ default_vcpus = 1
3838
[extra_binaries.virtiofsd]
3939
path = "/usr/libexec/virtiofsd"
4040
options = "--sandbox none"
41+
42+
[rootfs_view]
43+
enabled = false
4144
```
4245

4346
## Configuration Sections
@@ -89,6 +92,36 @@ destination = "/tmp/urunc-timestamps.log"
8992

9093
When enabled, `urunc` will log performance timestamps to help with debugging and optimization.
9194

95+
### Rootfs View Configuration
96+
97+
The `[rootfs_view]` section controls whether the urunc shim prepares a
98+
per-container containerd rootfs view at task Create (for `devmapper` /
99+
`blockfile` snapshotters). This is a **host-level** setting in
100+
`/etc/urunc/config.toml`, not an OCI bundle annotation.
101+
102+
| Option | Type | Default | Description |
103+
|--------|------|---------|-------------|
104+
| `enabled` | boolean | `false` | Prepare rootfs views for container block rootfs after shim task Create |
105+
106+
When `enabled = true`, the shim first lets the wrapped task service create the
107+
task so the bundle rootfs is mounted. It then runs `ChooseRootfs` and prepares a
108+
view only if **all** of the following hold:
109+
110+
1. The container snapshotter is block-based (`devmapper` or `blockfile`).
111+
2. Shim `ChooseRootfs` selected **container block rootfs** (`type=block` with a
112+
non-empty `MountedPath`).
113+
114+
This matches the block-rootfs boot-artifact path: kernel/initrd are read from a
115+
read-only view instead of being copied out of the container rootfs before attach.
116+
`com.urunc.unikernel.rootfsView` is not used for this gate.
117+
118+
**Example:**
119+
120+
```toml
121+
[rootfs_view]
122+
enabled = true
123+
```
124+
92125
### Monitor Configuration
93126

94127
The `[monitors]` section allows you to configure default settings for different

docs/package/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ Except of the above, `urunc` accepts the following optional annotations:
7272
- `com.urunc.unikernel.mountRootfs`: A boolean value that if it is `true`,
7373
requests from `urunc` to mount the container's image rootfs in the unikernel
7474
(either as a block device or through shared-fs).
75+
- Per-container rootfs views are enabled in `/etc/urunc/config.toml`
76+
(`[rootfs_view] enabled = true`), not via a bundle annotation. See
77+
[configuration](../configuration.md#rootfs-view-configuration). When enabled,
78+
the container must also use `com.urunc.unikernel.mountRootfs=true` (typically
79+
from image annotations merged into `config.json` before shim task Create).
80+
Supported snapshotters include `devmapper` and `blockfile`. After the wrapped
81+
task service creates the task and mounts the bundle rootfs, the shim runs
82+
`ChooseRootfs` and prepares a view only when that selection is container block
83+
rootfs.
7584

7685
Due to the fact that [Docker](https://www.docker.com/) and some high-level
7786
container runtimes do not pass the image annotations to the underlying container
@@ -80,6 +89,10 @@ container's rootfs. The file should be named `urunc.json`, it should be
8089
placed in the root directory of the container's rootfs and it should have a JSON
8190
format with the above information, where the values are base64 encoded.
8291

92+
Enable rootfs views on the host with `[rootfs_view] enabled = true` in
93+
`/etc/urunc/config.toml`. The shim prepares a view after task Create when
94+
`ChooseRootfs` selects container block rootfs on a block snapshotter.
95+
8396
## Tools to construct OCI images with `urunc`'s annotations
8497

8598
As previously mentioned we currently provide 2 different tools to build and

0 commit comments

Comments
 (0)