runtime: Add trusted runtime option
Some CRI compatible runtimes may not support provileged operations. Specifically hypervisor based runtimes (like kata-containers, cc-runtime and runv) do not support privileged operations like: - Provide access to the host namespaces - Create fully privileged containers with access to host devices Hypervisor based runtimes create container workloads within virtual machines. When a running host privileged containers using them, they wont provide support to requested the privileged opertations. This commits add the new options to define two runtimes: Trusted runtime : Used when a privileged container is requested. Default runtime : for non-privileged workloads. A container that belongs to a privileged pod will inherent this property an will be created with the trusted runtime. - Add options to define trusted runtime - Add logic to decide if a sanbox is trusted - Export annotation containers below to a trusted sandbox Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
@@ -18,20 +18,24 @@ package config
|
||||
|
||||
import "github.com/containerd/containerd"
|
||||
|
||||
// Runtime struct to contain the type(ID), engine, and root variables for a default and a privileged runtime
|
||||
type Runtime struct {
|
||||
//Type is the runtime type to use in containerd e.g. io.containerd.runtime.v1.linux
|
||||
Type string `toml:"runtime_type" json:"runtimeType,omitempty"`
|
||||
// Engine is the name of the runtime engine used by containerd.
|
||||
Engine string `toml:"runtime_engine" json:"runtimeEngine,omitempty"`
|
||||
// Root is the directory used by containerd for runtime state.
|
||||
Root string `toml:"runtime_root" json:"runtimeRoot,omitempty"`
|
||||
}
|
||||
|
||||
// ContainerdConfig contains toml config related to containerd
|
||||
type ContainerdConfig struct {
|
||||
// Snapshotter is the snapshotter used by containerd.
|
||||
Snapshotter string `toml:"snapshotter" json:"snapshotter,omitempty"`
|
||||
// Runtime is the runtime to use in containerd. We may support
|
||||
// other runtimes in the future.
|
||||
Runtime string `toml:"runtime" json:"runtime,omitempty"`
|
||||
// RuntimeEngine is the name of the runtime engine used by containerd.
|
||||
// Containerd default should be "runc"
|
||||
// We may support other runtime engines in the future.
|
||||
RuntimeEngine string `toml:"runtime_engine" json:"runtimeEngine,omitempty"`
|
||||
// RuntimeRoot is the directory used by containerd for runtime state.
|
||||
// Containerd default should be "/run/containerd/runc"
|
||||
RuntimeRoot string `toml:"runtime_root" json:"runtimeRoot,omitempty"`
|
||||
// DefaultRuntime is the runtime to use in containerd.
|
||||
DefaultRuntime Runtime `toml:"default_runtime" json:"defaultRuntime,omitempty"`
|
||||
// PrivilegedRuntime is a non-secure runtime used only to run trusted workloads on it
|
||||
PrivilegedRuntime Runtime `toml:"privileged_runtime" json:"privilegedRuntime,omitempty"`
|
||||
}
|
||||
|
||||
// CniConfig contains toml config related to cni
|
||||
@@ -101,10 +105,17 @@ func DefaultConfig() PluginConfig {
|
||||
NetworkPluginConfDir: "/etc/cni/net.d",
|
||||
},
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
Snapshotter: containerd.DefaultSnapshotter,
|
||||
Runtime: "io.containerd.runtime.v1.linux",
|
||||
RuntimeEngine: "",
|
||||
RuntimeRoot: "",
|
||||
Snapshotter: containerd.DefaultSnapshotter,
|
||||
DefaultRuntime: Runtime{
|
||||
Type: "io.containerd.runtime.v1.linux",
|
||||
Engine: "",
|
||||
Root: "",
|
||||
},
|
||||
PrivilegedRuntime: Runtime{
|
||||
Type: "io.containerd.runtime.v1.linux",
|
||||
Engine: "",
|
||||
Root: "",
|
||||
},
|
||||
},
|
||||
StreamServerAddress: "",
|
||||
StreamServerPort: "10010",
|
||||
|
||||
Reference in New Issue
Block a user