Skip to content

Commit fb286f3

Browse files
committed
feat(config): add rootfs view host opt-in
Add UruncRootfsView and rootfs_view.enabled to urunc.toml so the shim can opt in to per-container read-only rootfs views on block/devmapper rootfs. Signed-off-by: sidneychang <2190206983@qq.com>
1 parent 0233433 commit fb286f3

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

deployment/urunc-deploy/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ syslog = false
77
[timestamps]
88
enabled = false
99

10+
[rootfs_view]
11+
enabled = false
12+
1013
[monitors.qemu]
1114
default_memory_mb = 256
1215
default_vcpus = 1

docs/configuration.md

Lines changed: 26 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,23 @@ 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).
100+
101+
| Option | Type | Default | Description |
102+
|--------|------|---------|-------------|
103+
| `enabled` | boolean | `false` | Prepare rootfs views for container block rootfs after shim task Create |
104+
105+
**Example:**
106+
107+
```toml
108+
[rootfs_view]
109+
enabled = true
110+
```
111+
92112
### Monitor Configuration
93113

94114
The `[monitors]` section allows you to configure default settings for different
@@ -201,6 +221,9 @@ To create a configuration file, you can:
201221
[monitors.spt]
202222
default_memory_mb = 256
203223
default_vcpus = 1
224+
225+
[rootfs_view]
226+
enabled = false
204227
EOF
205228
```
206229
@@ -244,6 +267,9 @@ default_vcpus = 1
244267
default_memory_mb = 256
245268
default_vcpus = 1
246269
# path is not set by default - urunc will search in PATH
270+
271+
[rootfs_view]
272+
enabled = false
247273
```
248274
249275
## Notes

pkg/unikontainers/urunc_config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ type UruncTimestamps struct {
3434
Destination string `toml:"destination"` // Used to specify a file for timestamps
3535
}
3636

37+
// UruncRootfsView configures shim-side per-container rootfs views (devmapper/blockfile).
38+
type UruncRootfsView struct {
39+
Enabled bool `toml:"enabled"`
40+
}
41+
3742
type UruncConfig struct {
3843
Log UruncLog `toml:"log"`
3944
Timestamps UruncTimestamps `toml:"timestamps"`
45+
RootfsView UruncRootfsView `toml:"rootfs_view"`
4046
Monitors map[string]types.MonitorConfig `toml:"monitors"`
4147
ExtraBins map[string]types.ExtraBinConfig `toml:"extra_binaries"`
4248
}
@@ -94,10 +100,15 @@ func defaultExtraBinConfig() map[string]types.ExtraBinConfig {
94100
}
95101
}
96102

103+
func defaultRootfsViewConfig() UruncRootfsView {
104+
return UruncRootfsView{Enabled: false}
105+
}
106+
97107
func defaultUruncConfig() *UruncConfig {
98108
return &UruncConfig{
99109
Log: defaultLogConfig(),
100110
Timestamps: defaultTimestampsConfig(),
111+
RootfsView: defaultRootfsViewConfig(),
101112
Monitors: defaultMonitorsConfig(),
102113
ExtraBins: defaultExtraBinConfig(),
103114
}

0 commit comments

Comments
 (0)