Skip to content

Commit

Permalink
features-linux: Expose idmap information
Browse files Browse the repository at this point in the history
High level container runtimes sometimes need to know if the OCI runtime
supports idmap mounts or not, as the OCI runtime silently ignores
unknown fields.

This means that if it doesn't support idmap mounts, a container with
userns will be started, without idmap mounts, and the files created on
the volumes will have a "garbage" owner/group. Furthermore, as the
userns mapping is not guaranteed to be stable over time, it will be
completely unusable.

Let's expose idmap support in the features subcommand, so high level
container runtimes use the feature safely.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
  • Loading branch information
rata committed Aug 22, 2023
1 parent e8c4134 commit a3ba2b0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
18 changes: 18 additions & 0 deletions features-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,21 @@ Irrelevant to the availability of Intel RDT on the host operating system.
"enabled": true
}
```

## <a name="linuxFeaturesMountExtensions" />MountExtensions

**`mountExtensions`** (object, OPTIONAL) represents the runtime's implementation status of different mount features.
Irrelevant to the availability of the features on the host operating system.

* **`idmap`** (object, OPTIONAL) represents whether the runtime supports idmap mounts using the uidMappings and gidMappings properties of the mount.
* **`enabled`** (bool, OPTIONAL) represents whether the feature is enabled.

### Example

```json
"mountExtensions": {
"idmap":{
"enabled": true
}
}
```
13 changes: 13 additions & 0 deletions schema/features-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@
"type": "boolean"
}
}
},
"mountExtensions": {
"type": "object",
"properties": {
"idmap": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
}
}
}
}
}
}
Expand Down
24 changes: 19 additions & 5 deletions specs-go/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ type Linux struct {
// Nil value means "unknown", not "no support for any capability".
Capabilities []string `json:"capabilities,omitempty"`

Cgroup *Cgroup `json:"cgroup,omitempty"`
Seccomp *Seccomp `json:"seccomp,omitempty"`
Apparmor *Apparmor `json:"apparmor,omitempty"`
Selinux *Selinux `json:"selinux,omitempty"`
IntelRdt *IntelRdt `json:"intelRdt,omitempty"`
Cgroup *Cgroup `json:"cgroup,omitempty"`
Seccomp *Seccomp `json:"seccomp,omitempty"`
Apparmor *Apparmor `json:"apparmor,omitempty"`
Selinux *Selinux `json:"selinux,omitempty"`
IntelRdt *IntelRdt `json:"intelRdt,omitempty"`
MountExtensions *MountExtensions `json:"mountExtensions,omitempty"`
}

// Cgroup represents the "cgroup" field.
Expand Down Expand Up @@ -123,3 +124,16 @@ type IntelRdt struct {
// Nil value means "unknown", not "false".
Enabled *bool `json:"enabled,omitempty"`
}

// MountExtensions represents the "mountExtensions" field.
type MountExtensions struct {
// IDMap represents the status of idmap mounts support.
IDMap *IDMap `json:"idmap,omitempty"`
}

type IDMap struct {
// Enabled represents whether idmap mounts supports is compiled in.
// Unrelated to whether the host supports it or not.
// Nil value means "unknown", not "false".
Enabled *bool `json:"enabled,omitempty"`
}

0 comments on commit a3ba2b0

Please sign in to comment.