|
| 1 | +// Package features provides the JSON structure that is printed by `runc features` (since runc v1.1.0). |
| 2 | +package features |
| 3 | + |
| 4 | +// Features represents the supported features of the runtime. |
| 5 | +type Features struct { |
| 6 | + // OCIVersionMin is the minimum OCI Runtime Spec version recognized by the runtime, e.g., "1.0.0". |
| 7 | + OCIVersionMin string `json:"ociVersionMin,omitempty"` |
| 8 | + |
| 9 | + // OCIVersionMax is the maximum OCI Runtime Spec version recognized by the runtime, e.g., "1.0.2-dev". |
| 10 | + OCIVersionMax string `json:"ociVersionMax,omitempty"` |
| 11 | + |
| 12 | + // Hooks is the list of the recognized hook names, e.g., "createRuntime". |
| 13 | + // Nil value means "unknown", not "no support for any hook". |
| 14 | + Hooks []string `json:"hooks,omitempty"` |
| 15 | + |
| 16 | + // MountOptions is the list of the recognized mount options, e.g., "ro". |
| 17 | + // Nil value means "unknown", not "no support for any mount option". |
| 18 | + MountOptions []string `json:"mountOptions,omitempty"` |
| 19 | + |
| 20 | + // Linux is specific to Linux. |
| 21 | + Linux *Linux `json:"linux,omitempty"` |
| 22 | + |
| 23 | + // Annotations contains implementation-specific annotation strings, |
| 24 | + // such as the implementation version, and third-party extensions. |
| 25 | + Annotations map[string]string `json:"annotations,omitempty"` |
| 26 | +} |
| 27 | + |
| 28 | +// Linux is specific to Linux. |
| 29 | +type Linux struct { |
| 30 | + // Namespaces is the list of the recognized namespaces, e.g., "mount". |
| 31 | + // Nil value means "unknown", not "no support for any namespace". |
| 32 | + Namespaces []string `json:"namespaces,omitempty"` |
| 33 | + |
| 34 | + // Capabilities is the list of the recognized capabilities , e.g., "CAP_SYS_ADMIN". |
| 35 | + // Nil value means "unknown", not "no support for any capability". |
| 36 | + Capabilities []string `json:"capabilities,omitempty"` |
| 37 | + |
| 38 | + Cgroup *Cgroup `json:"cgroup,omitempty"` |
| 39 | + Seccomp *Seccomp `json:"seccomp,omitempty"` |
| 40 | + Apparmor *Apparmor `json:"apparmor,omitempty"` |
| 41 | + Selinux *Selinux `json:"selinux,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// Seccomp represents the "seccomp" field. |
| 45 | +type Seccomp struct { |
| 46 | + // Enabled is true if seccomp support is compiled in. |
| 47 | + // Nil value means "unknown", not "false". |
| 48 | + Enabled *bool `json:"enabled,omitempty"` |
| 49 | + |
| 50 | + // Actions is the list of the recognized actions, e.g., "SCMP_ACT_NOTIFY". |
| 51 | + // Nil value means "unknown", not "no support for any action". |
| 52 | + Actions []string `json:"actions,omitempty"` |
| 53 | + |
| 54 | + // Operators is the list of the recognized actions, e.g., "SCMP_CMP_NE". |
| 55 | + // Nil value means "unknown", not "no support for any operator". |
| 56 | + Operators []string `json:"operators,omitempty"` |
| 57 | + |
| 58 | + // Operators is the list of the recognized archs, e.g., "SCMP_ARCH_X86_64". |
| 59 | + // Nil value means "unknown", not "no support for any arch". |
| 60 | + Archs []string `json:"archs,omitempty"` |
| 61 | +} |
| 62 | + |
| 63 | +// Apparmor represents the "apparmor" field. |
| 64 | +type Apparmor struct { |
| 65 | + // Enabled is true if AppArmor support is compiled in. |
| 66 | + // Unrelated to whether the host supports AppArmor or not. |
| 67 | + // Nil value means "unknown", not "false". |
| 68 | + // Always true in the current version of runc. |
| 69 | + Enabled *bool `json:"enabled,omitempty"` |
| 70 | +} |
| 71 | + |
| 72 | +// Selinux represents the "selinux" field. |
| 73 | +type Selinux struct { |
| 74 | + // Enabled is true if SELinux support is compiled in. |
| 75 | + // Unrelated to whether the host supports SELinux or not. |
| 76 | + // Nil value means "unknown", not "false". |
| 77 | + // Always true in the current version of runc. |
| 78 | + Enabled *bool `json:"enabled,omitempty"` |
| 79 | +} |
| 80 | + |
| 81 | +// Cgroup represents the "cgroup" field. |
| 82 | +type Cgroup struct { |
| 83 | + // V1 represents whether Cgroup v1 support is compiled in. |
| 84 | + // Unrelated to whether the host uses cgroup v1 or not. |
| 85 | + // Nil value means "unknown", not "false". |
| 86 | + // Always true in the current version of runc. |
| 87 | + V1 *bool `json:"v1,omitempty"` |
| 88 | + |
| 89 | + // V2 represents whether Cgroup v2 support is compiled in. |
| 90 | + // Unrelated to whether the host uses cgroup v2 or not. |
| 91 | + // Nil value means "unknown", not "false". |
| 92 | + // Always true in the current version of runc. |
| 93 | + V2 *bool `json:"v2,omitempty"` |
| 94 | + |
| 95 | + // Systemd represents whether systemd-cgroup support is compiled in. |
| 96 | + // Unrelated to whether the host uses systemd or not. |
| 97 | + // Nil value means "unknown", not "false". |
| 98 | + // Always true in the current version of runc. |
| 99 | + Systemd *bool `json:"systemd,omitempty"` |
| 100 | + |
| 101 | + // SystemdUser represents whether user-scoped systemd-cgroup support is compiled in. |
| 102 | + // Unrelated to whether the host uses systemd or not. |
| 103 | + // Nil value means "unknown", not "false". |
| 104 | + // Always true in the current version of runc. |
| 105 | + SystemdUser *bool `json:"systemdUser,omitempty"` |
| 106 | +} |
| 107 | + |
| 108 | +const ( |
| 109 | + // AnnotationRuncVersion represents the version of runc, e.g., "1.2.3", "1.2.3+dev", "1.2.3-rc.4.", "1.2.3-rc.4+dev". |
| 110 | + // Third party implementations such as crun and runsc MAY use this annotation to report the most compatible runc version, |
| 111 | + // however, parsing this annotation value is discouraged. |
| 112 | + AnnotationRuncVersion = "org.opencontainers.runc.version" |
| 113 | + |
| 114 | + // AnnotationRuncCommit corresponds to the output of `git describe --dirty --long --always` in the runc repo. |
| 115 | + // Third party implementations such as crun and runsc SHOULD NOT use this annotation, as their repo is different from the runc repo. |
| 116 | + // Parsing this annotation value is discouraged. |
| 117 | + AnnotationRuncCommit = "org.opencontainers.runc.commit" |
| 118 | + |
| 119 | + // AnnotationRuncCheckpointEnabled is set to "true" if CRIU-based checkpointing is supported. |
| 120 | + // Unrelated to whether the host supports CRIU or not. |
| 121 | + // Always set to "true" in the current version of runc. |
| 122 | + // This is defined as an annotation because checkpointing is a runc-specific feature that is not defined in the OCI Runtime Spec. |
| 123 | + // Third party implementations such as crun and runsc MAY use this annotation. |
| 124 | + AnnotationRuncCheckpointEnabled = "org.opencontainers.runc.checkpoint.enabled" |
| 125 | + |
| 126 | + // AnnotationLibseccompVersion is the version of libseccomp, e.g., "2.5.1". |
| 127 | + // Note that the runtime MAY support seccomp even when this annotation is not present. |
| 128 | + AnnotationLibseccompVersion = "io.github.seccomp.libseccomp.version" |
| 129 | +) |
0 commit comments