diff --git a/conmon-rs/common/proto/conmon.capnp b/conmon-rs/common/proto/conmon.capnp index 9cac0e884d..5e941d965b 100644 --- a/conmon-rs/common/proto/conmon.capnp +++ b/conmon-rs/common/proto/conmon.capnp @@ -40,6 +40,7 @@ interface Conmon { metadataOld @10 :Data; # deprecated metadata @11 :Metadata; # Standard metadata to carry. envVars @12 :TextTextMap; + cgroupManager @13 :CgroupManager; } struct LogDriver { @@ -58,6 +59,11 @@ interface Conmon { } } + enum CgroupManager { + systemd @0; + cgroupfs @1; + } + struct CreateContainerResponse { containerPid @0 :UInt32; } @@ -74,6 +80,7 @@ interface Conmon { metadataOld @4 :Data; # deprecated metadata @5 :Metadata; # Standard metadata to carry. envVars @6 :TextTextMap; + cgroupManager @7 :CgroupManager; } struct ExecSyncContainerResponse { diff --git a/conmon-rs/server/src/config.rs b/conmon-rs/server/src/config.rs index aa1b3b0d2d..cbe57258f5 100644 --- a/conmon-rs/server/src/config.rs +++ b/conmon-rs/server/src/config.rs @@ -101,17 +101,10 @@ pub struct Config { /// Do not fork if true. skip_fork: bool, - #[get_copy = "pub"] - #[arg( - default_value_t, - env(concat!(prefix!(), "CGROUP_MANAGER")), - long("cgroup-manager"), - short('c'), - value_enum, - value_name("MANAGER") - )] - /// Select the cgroup manager to be used. - cgroup_manager: CgroupManager, + // TODO: remove in next major release + #[arg(default_value(""), long("cgroup-manager"), short('c'), hide(true))] + /// (ignored for backwards compatibility) + cgroup_manager: String, #[get_copy = "pub"] #[arg( @@ -301,38 +294,6 @@ impl Default for LogDriver { } } -#[derive( - AsRefStr, - Clone, - Copy, - Debug, - Deserialize, - Display, - EnumIter, - EnumString, - Eq, - Hash, - IntoStaticStr, - PartialEq, - Serialize, - ValueEnum, -)] -#[strum(serialize_all = "lowercase")] -/// Available cgroup managers. -pub enum CgroupManager { - /// Use systemd to create and manage cgroups - Systemd, - - /// Use the cgroup filesystem to create and manage cgroups - Cgroupfs, -} - -impl Default for CgroupManager { - fn default() -> Self { - Self::Systemd - } -} - impl Default for Config { fn default() -> Self { Self::parse() diff --git a/conmon-rs/server/src/rpc.rs b/conmon-rs/server/src/rpc.rs index 246fc0246a..4b5c613c86 100644 --- a/conmon-rs/server/src/rpc.rs +++ b/conmon-rs/server/src/rpc.rs @@ -4,7 +4,7 @@ use crate::{ container_io::{ContainerIO, SharedContainerIO}, container_log::ContainerLog, pause::Pause, - server::Server, + server::{GenerateRuntimeArgs, Server}, telemetry::Telemetry, version::Version, }; @@ -121,16 +121,17 @@ impl conmon::Server for Server { debug!("PID file is {}", pidfile.display()); let child_reaper = self.reaper().clone(); - let global_args = capnp_vec_str!(req.get_global_args()); - let command_args = capnp_vec_str!(req.get_command_args()); - let args = pry_err!(self.generate_create_args( - &id, - bundle_path, - &container_io, - &pidfile, - global_args, - command_args - )); + let global_args = pry!(req.get_global_args()); + let command_args = pry!(req.get_command_args()); + let cgroup_manager = pry!(req.get_cgroup_manager()); + let args = GenerateRuntimeArgs { + config: self.config(), + id: &id, + container_io: &container_io, + pidfile: &pidfile, + cgroup_manager, + }; + let args = pry_err!(args.create_args(bundle_path, global_args, command_args)); let stdin = req.get_stdin(); let runtime = self.config().runtime().clone(); let exit_paths = capnp_vec_path!(req.get_exit_paths()); @@ -213,8 +214,17 @@ impl conmon::Server for Server { let mut container_io = pry_err!(ContainerIO::new(req.get_terminal(), logger)); let command = pry!(req.get_command()); - let args = pry_err!(self.generate_exec_sync_args(&id, &pidfile, &container_io, &command)); let env_vars = pry!(req.get_env_vars().and_then(capnp_util::into_map)); + let cgroup_manager = pry!(req.get_cgroup_manager()); + + let args = GenerateRuntimeArgs { + config: self.config(), + id: &id, + container_io: &container_io, + pidfile: &pidfile, + cgroup_manager, + }; + let args = pry_err!(args.exec_sync_args(command)); Promise::from_future( async move { diff --git a/conmon-rs/server/src/server.rs b/conmon-rs/server/src/server.rs index 3822f3dfd6..06106d6c67 100644 --- a/conmon-rs/server/src/server.rs +++ b/conmon-rs/server/src/server.rs @@ -2,7 +2,7 @@ use crate::{ child_reaper::ChildReaper, - config::{CgroupManager, Commands, Config, LogDriver, Verbosity}, + config::{Commands, Config, LogDriver, Verbosity}, container_io::{ContainerIO, ContainerIOType}, init::{DefaultInit, Init}, journal::Journal, @@ -14,7 +14,7 @@ use crate::{ use anyhow::{format_err, Context, Result}; use capnp::text_list::Reader; use capnp_rpc::{rpc_twoparty_capnp::Side, twoparty, RpcSystem}; -use conmon_common::conmon_capnp::conmon; +use conmon_common::conmon_capnp::conmon::{self, CgroupManager}; use futures::{AsyncReadExt, FutureExt}; use getset::Getters; use nix::{ @@ -279,80 +279,87 @@ impl Server { task::spawn_local(Box::pin(rpc_system.map(|_| ()))); } } +} + +pub(crate) struct GenerateRuntimeArgs<'a> { + pub(crate) config: &'a Config, + pub(crate) id: &'a str, + pub(crate) container_io: &'a ContainerIO, + pub(crate) pidfile: &'a Path, + pub(crate) cgroup_manager: CgroupManager, +} +impl GenerateRuntimeArgs<'_> { const SYSTEMD_CGROUP_ARG: &'static str = "--systemd-cgroup"; /// Generate the OCI runtime CLI arguments from the provided parameters. - pub(crate) fn generate_create_args( - &self, - id: &str, + pub fn create_args( + self, bundle_path: &Path, - container_io: &ContainerIO, - pidfile: &Path, - global_args: Vec, - command_args: Vec, + global_args: Reader, + command_args: Reader, ) -> Result> { let mut args = vec![]; - if let Some(rr) = self.config().runtime_root() { + if let Some(rr) = self.config.runtime_root() { args.push(format!("--root={}", rr.display())); } - if self.config().cgroup_manager() == CgroupManager::Systemd { + if self.cgroup_manager == CgroupManager::Systemd { args.push(Self::SYSTEMD_CGROUP_ARG.into()); } - args.extend(global_args); + for arg in global_args { + args.push(arg?.to_string()); + } args.extend([ "create".to_string(), "--bundle".to_string(), bundle_path.display().to_string(), "--pid-file".to_string(), - pidfile.display().to_string(), + self.pidfile.display().to_string(), ]); - args.extend(command_args); + for arg in command_args { + args.push(arg?.to_string()); + } - if let ContainerIOType::Terminal(terminal) = container_io.typ() { + if let ContainerIOType::Terminal(terminal) = self.container_io.typ() { args.push(format!("--console-socket={}", terminal.path().display())); } - args.push(id.into()); + + args.push(self.id.into()); + debug!("Runtime args {:?}", args.join(" ")); Ok(args) } /// Generate the OCI runtime CLI arguments from the provided parameters. - pub(crate) fn generate_exec_sync_args( - &self, - id: &str, - pidfile: &Path, - container_io: &ContainerIO, - command: &Reader, - ) -> Result> { + pub(crate) fn exec_sync_args(&self, command: Reader) -> Result> { let mut args = vec![]; - if let Some(rr) = self.config().runtime_root() { + if let Some(rr) = self.config.runtime_root() { args.push(format!("--root={}", rr.display())); } - if self.config().cgroup_manager() == CgroupManager::Systemd { + if self.cgroup_manager == CgroupManager::Systemd { args.push(Self::SYSTEMD_CGROUP_ARG.into()); } args.push("exec".to_string()); args.push("-d".to_string()); - if let ContainerIOType::Terminal(terminal) = container_io.typ() { + if let ContainerIOType::Terminal(terminal) = self.container_io.typ() { args.push(format!("--console-socket={}", terminal.path().display())); args.push("--tty".to_string()); } - args.push(format!("--pid-file={}", pidfile.display())); - args.push(id.into()); + args.push(format!("--pid-file={}", self.pidfile.display())); + args.push(self.id.into()); - for value in command.iter() { - args.push(value?.to_string()); + for arg in command { + args.push(arg?.to_string()); } debug!("Exec args {:?}", args.join(" ")); diff --git a/internal/proto/conmon.capnp.go b/internal/proto/conmon.capnp.go index 4ea6ca8459..33e30b2c86 100644 --- a/internal/proto/conmon.capnp.go +++ b/internal/proto/conmon.capnp.go @@ -1112,6 +1112,13 @@ func (s Conmon_CreateContainerRequest) NewEnvVars(n int32) (Conmon_TextTextMapEn err = capnp.Struct(s).SetPtr(10, l.ToPtr()) return l, err } +func (s Conmon_CreateContainerRequest) CgroupManager() Conmon_CgroupManager { + return Conmon_CgroupManager(capnp.Struct(s).Uint16(2)) +} + +func (s Conmon_CreateContainerRequest) SetCgroupManager(v Conmon_CgroupManager) { + capnp.Struct(s).SetUint16(2, uint16(v)) +} // Conmon_CreateContainerRequest_List is a list of Conmon_CreateContainerRequest. type Conmon_CreateContainerRequest_List = capnp.StructList[Conmon_CreateContainerRequest] @@ -1267,6 +1274,50 @@ func NewConmon_LogDriver_Type_List(s *capnp.Segment, sz int32) (Conmon_LogDriver return capnp.NewEnumList[Conmon_LogDriver_Type](s, sz) } +type Conmon_CgroupManager uint16 + +// Conmon_CgroupManager_TypeID is the unique identifier for the type Conmon_CgroupManager. +const Conmon_CgroupManager_TypeID = 0xaa4bbac12765a78a + +// Values of Conmon_CgroupManager. +const ( + Conmon_CgroupManager_systemd Conmon_CgroupManager = 0 + Conmon_CgroupManager_cgroupfs Conmon_CgroupManager = 1 +) + +// String returns the enum's constant name. +func (c Conmon_CgroupManager) String() string { + switch c { + case Conmon_CgroupManager_systemd: + return "systemd" + case Conmon_CgroupManager_cgroupfs: + return "cgroupfs" + + default: + return "" + } +} + +// Conmon_CgroupManagerFromString returns the enum value with a name, +// or the zero value if there's no such value. +func Conmon_CgroupManagerFromString(c string) Conmon_CgroupManager { + switch c { + case "systemd": + return Conmon_CgroupManager_systemd + case "cgroupfs": + return Conmon_CgroupManager_cgroupfs + + default: + return 0 + } +} + +type Conmon_CgroupManager_List = capnp.EnumList[Conmon_CgroupManager] + +func NewConmon_CgroupManager_List(s *capnp.Segment, sz int32) (Conmon_CgroupManager_List, error) { + return capnp.NewEnumList[Conmon_CgroupManager](s, sz) +} + type Conmon_CreateContainerResponse capnp.Struct // Conmon_CreateContainerResponse_TypeID is the unique identifier for the type Conmon_CreateContainerResponse. @@ -1502,6 +1553,13 @@ func (s Conmon_ExecSyncContainerRequest) NewEnvVars(n int32) (Conmon_TextTextMap err = capnp.Struct(s).SetPtr(4, l.ToPtr()) return l, err } +func (s Conmon_ExecSyncContainerRequest) CgroupManager() Conmon_CgroupManager { + return Conmon_CgroupManager(capnp.Struct(s).Uint16(10)) +} + +func (s Conmon_ExecSyncContainerRequest) SetCgroupManager(v Conmon_CgroupManager) { + capnp.Struct(s).SetUint16(10, uint16(v)) +} // Conmon_ExecSyncContainerRequest_List is a list of Conmon_ExecSyncContainerRequest. type Conmon_ExecSyncContainerRequest_List = capnp.StructList[Conmon_ExecSyncContainerRequest] @@ -4055,198 +4113,206 @@ func (p Conmon_createNamespaces_Results_Future) Response() Conmon_CreateNamespac return Conmon_CreateNamespacesResponse_Future{Future: p.Future.Field(0, nil)} } -const schema_ffaaf7385bc4adad = "x\xda\xc4Y{\x90\x14\xd5\xd5?\xa7\xef\xcc\xf6\xce\xb2" + - "8\xdb_\xcf\xc2\xba\xb5\xfb-\"\xf8\x01_V\x1e\x8b" + - "\x91PX,\x8f-\x84\xa0n\xef\xa0\xa6 X43" + - "\xcd\xee\xe0\xcc\xf4\xd0\xdd\x03,j\xf0\x11*\x82\xa2\xb2" + - "\xc1R\xa8X\x05\x0a\x16\x10\x89\x1a\x83\x11\x04K|\x94" + - "\x16\xc6$\x10%j\x89\x8aH$\x94\xa8DS\x01K" + - "\xd2\xa9s{\xfa\xb1\xb3+\xcenL\xe5\x0fj\xa7O" + - "\xff\xfa\x9e{\xcf=\x8f\xdf9\x8c\xf9\xa0\xbc94v" + - "\xe0\xe0\x81 (\x0f\x86\xcbl\xf3h\xa7\xf1\xe8C3" + - "\xee\x00\xe9b\x04\x08\xa3\x08\xd0\xb4\xa4\xecC\x04\x94W" + - "\x95M\x06\xb4\xff\xbe\xe5\xd5+\x1eX\xf7\xd9\x9a `" + - "\xab\x03\xd8\xcd\x01\xefN\x18\xb5h\x13\x9b}W\x10p" + - "\xa4\xec\x1d\x02\x9c\xe6\x80\x9f,\x88\xae\xff\xf9\xa0y\x1c" + - "`\x9fnZtd\xc3\x89\xcb\x7f\x0ba\x91\x80\x92\xf8" + - "\x0e\xca\x8d\xfc\xe7H\xf1^\x04\xb4_\xfb\xdf\x15\xd7G" + - "\x1f\xfd\xd9\x83Eh\xbel$\xf2!\xca\xc3#\"\x80" + - "|Q\x84\x96^\xf5\xd7\xab\x9f\xbe\xf6\x8e\xcf6\x05u" + - "_\x1b\xf9\x1b\xe9Nq\xc0\x86y'nl\x99\x19}" + - "\xb8\xfbj!\xc2\xad\x8d\xec@ykD\x04f\x0f\xfa" + - "\xea\xd8\x96\xc3\xf1\x09\xdbA\xb9\x18{(\xbd\x8dp\x1b" + - "\xb8\xd2\xfb#\xcb\x00\xeda\x8f\xbfxp\xcd\xa4\xd1;" + - "\x82JOG\x0e\x91\xd2p\x05)]\xb6\xe0\xd5\xc7W" + - "(\xc7\x1f\xebE\xe9\xf0\x8a.\x94\xaf\xa8 \xa5\xf2\xf4" + - "1\xbb\x0f7\x8d\xdaY\xacT \xdc\x85\x84\x1b[A" + - "J\x1b+\x1e\x07\xb4\xc7o~\xea\xe9{>]\xfe+" + - "B\x0b\xc5[\xfa\xbe\x00hW\xcd\xfb\xc3\x15\x9f" + - "\xdc\xf0\x97\x97\x83\x06\x1b(s\x0f\xb9H&\x83}\xac" + - ">+\xb4\xbc\x9e~%\x08h\x91+\x04@y\xbe\x03" + - "\xf8\xe8\x9f\x8b\xdbs\xa3\x7f\x17\x04\xdc\"w\xd1\x0ak" + - "9\xe0L\xf5s\x0f\xd4N\xda\xf3\xfb `\xa7\xa3b" + - "?\x07\xd4N98>\x9a\x9d\xf1\xc7\"\xb7\xe2\x069" + - ".?\x8c\xf29\x99\x8c}V&\xf3=\xf2\xc5\xb6\x05" + - "\xbb\xd6\xc5\x0e\x83tq\xc0\xd6\x80M\xdbc\x8bQ\xde" + - "\x17#\xe4\xee\xd8J@\xfb\xebU\x93n\xad\xaf?\xfc" + - "v\xaf\x97x*v\x12\xe5H5\xa1\xc3\xd5\x1f\x03\xda" + - "\x1b\xff\x7fY\xee\x86\x85\x13\xdf+Bs\xcf8Z\xfd" + - "\x0e\xca\xe78\xf8l5\xed\xf8\xeb\x89_?\xb7iR" + - "\xee\xfd\xe2\xa5\xc3\x84\xae\x1f\xb4\x06\xe5\xcb\x06\xd1\xcf\xb1" + - "\x83\xae\xa7;\xbc67C\xba\xa4\xed\x82\x0f\xba\xc5\xe9" + - "\xe0\xff!\x1b\xee\x1bL\xeb\x8d\xb9i\xc6\xf6\x1bR\xf2" + - "\xb1 \xe0\xe8\xe0\x8d\x9bLk\xad*\xb0\x00I\xb14" + - "#\x93\xca\xaaiJ\xd0\x85j\xdc`Z\xc9T\xd6\xab" + - "\xcd\xda\xf2\x94\xc59,\xf6\xa0\xb7\xba\x9ei\xa1\xb7\x10" + - "U\xad\x8e\x1eo\xd3n&bF\x80]\x06\xfaX\x8e" + - "J\xa455\x9b\xcfM\x03\x96I\xf6\xe0\xd6i}\xa1" + - "\x9a\x9eb\x00\xebI\xad\x13z&\xa3f\x93S@4" + - "z\xbe\xec\x7f1Z\xa9e\x97^\xa7\x067\xdc\x1f2" + - "^L\xeb\xa8\x11L\xb3R\xb9\xb0W~\x8a\xb8\x9dx" + - "\x1e\x8df\x90)\x14\xf1I\x13\xe0\xdb\x09\xa5W\xcc\xfa" + - "@(\x0by\xa6t\xd6\xea\x15\xf0>\xb7\xb8\xfd\xb5\xa5" + - "W\xfe\xfb\xd7W,\xc9\x8b\x9aYLyk}\x8a(" + - "\xf5\xcey\x85\x9e\x9c7\x18\x89\xffa\xba\xcb\xcb]\x94" + - "\xd2/\xa7\x8a|+\x97\x0d\xa5\x15\xa4F\xfa#H\xc3" + - "\xe9\x0f\x93\xeaG\x01`H\xaa\x1e\x0a \xa6r\x091" + - "\xabYb.\x95\x8c\xe6M\xcd\x10\xf3\x96Y\xd2\xfd\xf4" + - "\xc2%\x02=U\x95g6\x95\x8c\xb1\xc01\x86k\xb5" + - "\x14q\xd2$C%\x17 \xaa\x19\x12v0T,\xca" + - "\xd7C\x1c\xa2\xba\x84\xbe\xce1Tn\x16\x9c\x944M" + - "O\xf2+\x0e\x81\x80!\xc0\xc9\xa6\x95\xd4\xf3\x96kL" + - "z\xd4\x0c\xc3\xb3\xad\x95\xcah\xc9k\xf2V \xcd\xf5" + - "\xaf$\x91o\xb1\x1eM\xf5\xe2\x80\xff%\x0a`\x88\x1a" + - "\xad\xa9$\x96\x83\x80\xe5}l\xd0\x0a\xd4\x89\x94\xd4x" + - "J6\x90\xdb\xadg\xa8l\x0a\xb8\xddC\xd4\xce\xff\x82" + - "\xa1\xb2-\xe0v[\x0d\x00e\x0bC\xe5\x09\x01\xb10" + - "U\xd9\xd9\x05\xa0<\xc1P\xd9K\xc5\x8e9D\x7f7" + - "9\xed3\x0c\x95\x97\xa8\xd2\x85x\xa5\x93\xf6\x93\xa5\x9f" + - "g\xa8\xbc\xdb\xddiM=q\xa3f\x15\x95\x0f\xce%" + - "4\xd3\x84\x86\x94\x9e\x0d\x8c5LK\xcfMYdi" + - "h\xc4\xa9\x98\xb4\xe8\xb8\xe8\xbbl\xf6\xfa\x91\x09y\xda" + - "\xb0\xb0\xc4\xb4\xe1\xb1\xf9~d\xc3\xbe%(\xaf\x8d\xe9" + - "CJ\xece\xda\xd2\xaaF\x8d\x92\x06\x9b^;\xd3\x87" + - "\x93\xb9=\x85q\xe9\x9c\xce\x1c:\xce\xcf=-|\x08" + - "\xc0sx\xc1h\xcbg)\xd0f\xd2\x92\x8b8+\xef" + - "\xd3|!\x10[#<\xbe\x17\xe1\x84\xcc\x1b\xf0\xb9t" + - "OB\xe29\x95$\xaeA?y\xc8\xd58\xd4\x9d\xfb" + - "\xd5q\xbe'8|\xefB\x9c\x08\x10\x8f\x91|\x08\xfa" + - "! \xd7\xf3\xe5\xebH>\x02\xfd(\x90\x87s\xfc\x10" + - "w~(\x95\x85\x1d\xbe7\x92\xf3\xb4\x11$\x1f\xcf\xf9" + - "^\x99\xc3\xf7\xc6r~8\x86\xe4\x938\xdf\x13\x1d\xbe" + - "\xf7\x03\xbe\xfe\x04\x92O\xe7|\xaf\xdc\xe1{S8/" + - "m&\xf9l\x14\xd0\xce\x19zB3\xcd\x99\x80^\xca" + - "pi\xbc\x1bT\xa2\xa5\xb6\xbb\xbf'\x13\xfdIY\x01" + - "n\x97J'\xa7\xab\x16\xa0\xe6A,\xd5h\xd7|\x88" + - "\x917-25\x88\x815\xed\x84j\xb4\xeb\xd7i\x06" + - "D\xcd\x1e\xe29\x86\x16X\xaf[\x84\xbaQ\xdb\xcf\x02" + - "\xe1\x97\xd5\xc0\xd8\xb8\xd6\xcfPnz\xdb=7\x90\xa0" + - "\xdc\xfa\xb0\x7fj`\x94\xcc\x9a\x9d\xfc\xf6\xe6\xac\xc2(" + - "\xf9\x83\xc0 \xe3\x08\xe5\xb7w\x19*'|&/\x1d" + - "'\xe4G\x0c\xdb\x024^:Gk\x9e)\xf8X0" + - "\xeb\x91?\xeby+\x0eLK\xb8\xa3\x9b\x95\x05\xeeY" + - "\xcc:{\xe1\xd2\xffu&Z\xcc\x9eJ\xa6j\xdeD" + - "\xa5\x0fy\xa9\xe7\xff\xb7\xb4if\xb4\xf4!\xb07\x91" + - "\xe9\x83\xce\xa2\x11\x99\xbb\\\xa9\xc3Mw\x0c\xc0\xa7\x00" + - "\xa2et\x16\x0d\x82\x87\xfa\x83`\xaf\xe86\x8e\xf3'" + - "\xc1\xe2\x8dZ\xa77 [\xaa\xa6\xf3^\xbc\xfc+\x00" + - "\x00\xff\xff\x99\x96\xf5/" +const schema_ffaaf7385bc4adad = "x\xda\xd4Y}p\x14\xf5\xf9\x7f\x9e\xfd\xdeesy" + + "\xf1\xb2\xbf\xbd`@b\x10\xc1\x1fR\x11$X\x90\x81" + + "!\x012\x14\x04\xcd\xe6@+T\x87\xe5nI\x0es" + + "\xb7\xc7\xee\x1e\x10\x94\x82/L1V%)\x8c\x85\x91" + + "\x19\xf0\xad@\xa1J-V\xf0eDaT\x94\xb6\xa1" + + "\x95\xaa\xa3V\xa5Te|\x81\x0aSph\xb7\xf3|" + + "/\xfb\x92K\xc4Kj\xff\xe8\x1fLn\x9f\xfd\xec\xf3" + + "}{\xbe\x9f\xe7\xf3<\x8c\xba$T\x13\xb8\xaaT/" + + "\x05Ay(X`\x9b\x1f\xb6\x18\x8fo\x9av\x17H" + + "\x97\"@\x10E\x80\xeaM\x05\x1f!\xa0\xbc\xab`\x12" + + "\xa0}\xfa\xd1W'>\xd8\xf6e\xab\x1f\xd0\x91\x05\x1c" + + "\xe3\x80w\xc7\x0d_\xb8\x99\xcd\xbc\xd7\x0f\x08\x89\xef\x10" + + "\xa0R$\xc0\x8f\xe7\x87\xd7\xfd\xac\xdf<\x0e\xb0OV" + + "/|o\xc3'c\x7f\x0bA\x91\x80\x13\xc5wP\xbe" + + "\x89\xff\x9c#>\x80\x80\xf6\xeb\x17/\xbf1\xfc\xf8O" + + "~\x9e\x83\xe6n\xaf\x0e}\x84\xb2\x12\x12\x01\xe4Y!" + + "r\xbd\xfa\xd3\xeb\x9e\x9es\xd7\x97\x9b\xfdc\xdf\x11\xfa" + + ";\x8d\xbd\x9e\x036\xcc\xfb\xe4\xd6\xba\xe9\xe1\x87\xbbz" + + "\x0b\x10nOh;\xca\x1d!\x11\x98\xdd\xef\xeb\xa3\x8f" + + "\x1e\x89\x8e\xdb\x06\xca\xa5\xd8m\xd0\x9d\x84;\xc0\x07\xdd" + + "\x17Z\x0ah\x0fy\xe2\xe5\x8e\xd6\x09#\xb7\xfb\x07\xad" + + ",:L\x83^UD\x83\xb6\xfeB\xfb\xff}{\xaf" + + "%\x80\xe0y\x03\xacV\x8aZQN\x14\x91+\xadh" + + ",\xa0\xbdt\xfe\xabO,W\x8e\xed\xe8az\xc9\xa2" + + "v\x94W\x17\xd1\xf4\xe4\xa9\xa3\xf6\x1c\xa9\x1e\xbe3w" + + "z\x02\xe1T\xc2\xb5p\x9f\x99\xa2'\x00\xed1[\x9e" + + "z\xfa\xfe/\x96\xfd\x8a\xd0B\xeeb\x86\x16/B\xf9" + + "\x9a\xe2\x0b\x01\xe4\xdabB\xdf\xd6q|\xeb\xfd\xf7\xd6" + + "\xee\xce\xf5\xcd\x08\xfdv\xf1K(\x9f,\xa6\x9f\x9f\x17" + + "W\xd1\xe9\xb8\x00i \xb3w\xee\xdc?o\xdc?\xb6" + + "\xdb\xb4\xb4\xf2\xd2\x01X=\xb4t,\x02T\xdfw\xc1" + + "+(\x1f\x0a\x8b\x00\xf6\xc1\xa7\xb7\x8d\xff\xfa\xe8\xd2\xbd" + + "\xb9\xee\xb9\xcf\xdd\xe1\xc3(w\x10\xae\xfaP\xf8B\x06" + + "h\x97\xcd\xfb\xfd\xc4\xcfn\xf9\xdb\x01\xff\xd6>&\xf3" + + "X\xda#\xd3\xd6~\xac>+\xd4\x1dj~\xc5\x0fx" + + "O.\x12\x00\xe5\xd3Y\xc0_\xff\xb5\xa81=\xf2\x0d" + + "?\xa0<\xd2N\x1e\x86F\x08p\xa6\xfc\x85\x07\x07L" + + "\xd8\xfb;?\xa0.\xc2\x87\xb8\x89\x03\x06\xd4v\x8c\x09" + + "\xa7\xa6\xfd!'\x00\xf9\x86\xac\x88<\x8c\xf2\xfa\x08m" + + "v[\x84\xb6\xef\x91\xaf\xb6\xce\xdf\xdd\x169\xd2\xed\xa8" + + "k\xcb\x17\xa1<\xa7\x9c\x90J\xf9J@\xfb\xdc\xea\x09" + + "\xab*+\x8f\xbc\xdd\xe3!\xae.?\x8e\xf2\x16\x8e\xde" + + "T\xfe1\xa0\xbd\xf1{K\xd3\xb7,\x18\xff~\x0e\x9a" + + "GFK\xbfwP^\xdf\x8fO\xa2\x1f\xcd\xf8\xdc\xf8" + + "s/l\x9e\x90\xfeK\xae\xeb \xdf\xe4~\xad(\x1f" + + "\"t\xf5k\xfdn\xa43\x9c\x93\x9e&]\xd6p\xc1" + + "\x07\xfe\x1d\x98X\xf1\x7f\xb4\x87s*\xc8\xdf\xa8\xdb\xa6" + + "m\xbb%!\x1f\xf5\x03Z*6\xd2\x16\xdd\xc3\x01\xdf" + + "\x97_~2\xd5v\xfc\x98\x1f\xb0\xb3\xe28\x01\xf6q" + + "\xc0\xbey\xd5\xf5\x7f>z\xd9\x09\x90F\x08^@\x02" + + "V\x7fX\xd1\x8e\xf2\xd9\x0a\x9a\xfb\xe9\x8a*@\xbb\xe3" + + "\x8b\xaa\x1d\xaf\x1f\xbb\xf6\xab\xdc\xb9\xd3}\xab>]\xb1" + + "\x11\xe5\xd2\xfe\x9cQ\xfa\x8f\x15\x00\xed\xc7\x17?\xb2\xf6" + + "\xcc`\xe9Tnp\xf3\xa5\xde|\xd1G(\xb7\\D" + + "?3\x17\xbdBK}f\xe3\xba\x07\xf6\x8f\x9ev\xca" + + "?\xd1\x15\x95\xfc\xaa\xb6U\xd2D\x9f\xc3\xed\xc5?Z" + + "\xf4\xc9\x19?`W%_\xc9\x01\x0e8\xb3\xe5\x97\xd5" + + "\xab\x0e=u\xb6\x87\x1b\xfai\xe5A\x94\x83\x17\xd3\x0d" + + "m\xff\xe3\x8c\xe4\xfb\xff|\xf6\xeb\x9c\x98\xe1g\xfba" + + "\xe5\xc3(\x9f\xad\xe4K\xae\\\x0a#\xecD\xca\xd2\x8c" + + "\x94\xda\\02m\xe8\x96>2\xa6\xa7\x92z\xea\xca" + + "\x98\x9aN\xa5\xc7O\xc9>h\xcb\xb4X\xb4%\x15\x9b" + + "\xa2\xa7,5\x91\xd2\x8c!\xf5\xaa!\xaaIS\x09\xb0" + + "\x00@\x00\x01\xa4\xd2\xc9\x00J!C%\"\xe0JC" + + "[\x9c\xd1L\x0b\xcb\xbc-\x02\xc42\xc0\xbc\x86\x8b\x19" + + "\x9aji\xd7\xa9I\xcdL\xab1\xcd\x1c\xd2\xa0\x99\x19" + + "\xb1\xd9\xea2\xdc\x0c\x00\xa5\x84\xa1R!\xa0mhf" + + "ZO\x99\x1a\x00`\x99\xc7\xd9\xff\xc9\x90\xf5\xaa\xa1\xb2" + + "|\x16\xe8\xe6\x93^\x8c6%g\xb4\x06\xf2\xc6L\xab" + + "\x1eQ\x19\xe8\x0e\xb8{\x01\x80\xf2\x1b\x86\xca\x8b\x02J" + + "\x88\x11$\xe3\xf3s\x01\x94\xe7\x18*o\x09(\x09B" + + "\x04\x05\x00\xe9MB\xfe\x89\xa1rB@\x89\xb1\x082" + + "\x00\xe9s2~\xc60Z\x88\x02J\x81@\x04\x03\x00" + + "r\x10g\x00D\x03\xc80ZF\xf6`0\x82A\x00" + + "\xb9\x14G\x03D\x0b\xc9\x1e!{AA\x04\x0b\x00d" + + "\x89\xe3\xcb\xc8~\x05\x0ah'5K\x8d\xab\x96\x0a\xe2" + + "\xf5\xcdq,\x05\x01K\x01\xedT\xe7R\x80i&^" + + "\x00X\xcf\x10\xc3\x1e\x1d\x01\x92\xd1\xce$\xe2\xb3\xd4t" + + ":\x01b\xaa\xd1\x85\x95\x80\xc0_6\x9e\xef\xe5\x02\xd5" + + "\xd4\xeaU\xab\x89\x0e\x98l%\x80Ui=>=\xee" + + ".\xf3.B\xe7\x04\xfav6f" + + "Z\x17S\xa6F\x87\xe3\x8b\x86\xb9\x9d\xf17L\xe8y" + + "\xf9e^\x1e\xef\xc5\xe8\x86\xa6\xa7\xb5\xd4L\xbd\xd1\xbb" + + "j\x0dZ\x95\x99\xc9;\xf8]\x89\x91\x13\x8e\xc1\xf3\x0c" + + "\xda\xe0\x0cJk\x0d\xeb\xd9\xb5\xe6\xf5\xa5\xbbM\xfe/" + + "\x95Bw\xa2\x97\x0f\x07P\x860TF\x09\xe8D\xf0" + + "\x08\xb2\x0dc\xa8\x8c\x110l\xb5\xa4\xb5\x9cH\x09\x03" + + "\x86\xd3\xaa\xd5\xe4\x1em>\xfb\xa6Z\x96\x1ak\xea\xc2" + + "Oj\x12\xf3\xb8\xben\xb6\xea\xc5~Mi4\xf4L" + + "z\x96\x9aR\x1b5\x03\x80/\x99\xdfCi2\xb9\x91" + + "B3\x00V\x9a-\xa6\xa5%\xe3v\x8c\x83\x17\x9a\x00" + + "\x90\x97\xf3Z\xbe\x92\x86\xec\xa1b\xde'q\x83f\x98" + + "\x09=\xc5\x99\xc4D\xce$%\xee\xda\xebh\xed5\x0c" + + "\x95\x99\xde1L'z\xf8\x01Ce6\x11\x09f\x89" + + "D\xa1\xc0\xaag\xa84\x0b\xb8r\x89f,\xd0M\x0d" + + "\x11\x04D\xf8\xa6\xab\xdf\xab\x8b\x178\xcf\x0af\xea\x8d" + + "S\x8dpb\x89f(\x01\xf4'm\x1c\x1e\x9e\xdd\x92" + + "\xd6\xfc\xeb\x19\xde\xc3z\xc86\x95\xa1R\xef[\xcf\xac" + + "\xc9\xde\"\x9dXs\x1d\xf7\x10k+\x93\xea\xb2hb" + + "\xb9\x86!\x100\x94g\xecE5\xeb\xc6D*\xae/" + + "\xa5/\xb3\x07`\xf1\xa0\x88\xb8\x13^1\x00@Y\xc6" + + "P\xb9\xdb\x9b\xf0\x1d\xa3\x01\x94\xdb\x19*k|\x13^" + + "=\x1e@Y\xc5P\xf9)19f\x99\xfc\x1e:\xaa" + + "5\x0c\x95uD\xe4\x02'r\xa9\x8d\x8ej-Ce" + + "\x87\x80,\xe1\x12a\xd5\xd2D\xdcjB\x11\x04\x14\x01" + + "'5i\x89\xc6&\xcby\xfc.\x8e\x90}\xd3N0" + + "=\xa5\xccD\xf4\xea\x03\xa9m\xb9'\xa8\xa4\xb6;=" + + "\xf9-\xb5\xed\xf5t\x98\xb4\xbe\xc1W\xa3\xac7<\xb5" + + ")\xad\x7f\xc9\xd3\x0f\xd2\x86\x83\x9ej\x95\xb6\x1c\xf6n" + + "\xae\xb4\xcd\xf0\x95.\xdb\x96\xfb4\xf3\xb6V_\xcd\xb5" + + "\xb3\xdd\xab/\xa4]\xdb}bj\xf7\xaf}e\xe1\x9e" + + "\x97|:\xfa\xf9\x06_\x09\xf8\xfcA\x8f\xd3\xa5\x03\xed" + + ">\x9d\xf5Z\xab\xed\\@\x98\x94\x8d\x00\xd7\xc0\x1c~" + + "\xcef\x16\x97\xa3\x1a\x1c \x0f\xfc\xc4\x12\x0d\xd0\xb0\x1d" + + "j\x81*N.\xb6\xf3M\xd0\xf9\xc8qV\x97+\xc9" + + "\x9c\xc0\x03\xdby%\xf8\xdeu\xb2\x89\xed\xb0\x0bTe" + + "\xc7v\x9f'e\xfd\xdaN.\xc0F\xcf\xa1\xdf\xe68" + + "r\x82\x1e\x9d\xa8\x0fs\x7f\xb9f\xb3*\xeb\xd6\xc9\xaa" + + "\xac\x8b\xe41-p2\x08z\x18\xa1K\xea\xe5\x99\xcd" + + "\xf6`\xde\x14fk\xcb,\xfa\x87\xb3\xd4t]\xca2" + + "Z\x00\x94\x81,\x08\xe0\x96]\xe8\xd4\x0eR\xc7d\x10" + + "\xa4\x03\"z\"\x1c\x9d\xd2K\xdas'\x08\xd2.\x11" + + "\x05\xb7\xfd\x80\x8e\x10\x97\x1ek\x07A\xda\"\"s\xeb" + + "lt\xaaBi=}w\x9f\x88\x01\xb7\x02A\xa7\x03" + + " \xdd\xb1\x11\x04i\x85\x88A\xb7FD\xa7\xd0\x91\x16" + + "\xef\x05AJ\x8aX\xe06+\xd0ikHj+\x08" + + "\xd2\xcd\"q/\x05O\x0d\xda\xb1\xce\x08\xc0\xce\xb3\x84" + + "\x1a\xb4\x1d=\x8e\xce\x09\xa3Q\x83\xb6\x93\x03\xfdH\xc3" + + "=\xbaN(\xd3\x08jv9\xa6)zjR\xf6\x13" + + "w\xbc\xebTtN\x01\xa0\x06\xfdY\xe8\xdb\xc5SN" + + "Lf\xb3\xd18\x87\x0c\xe5\x16\x1c\x00\x10\xb5HR\xae" + + "BO\xda\xca+p.@\xf4v\xb2\xafA\x011+" + + "n\xe5\xd5\\\x81\xdeM\xe6\xb5\xe8\xb1\xa2|\x1fW\xac" + + "k\xc8\xbe\x0e=b\x94\xdb\xb0\x01 \xba\x96\xec;\xb8" + + "\xc2eY\x85\xbb\x0d\x17\x01D\xb7\x92}?W\xb8\x81" + + "\xac\xc2\xdd\xc7\x87}\x91\xec\xef\x92]\x0cF\xa8\xf0\x92" + + "\xdf\xe6\xf6\xb7\xc8~\x8a\xec\x85\x05\x11,\x04\x90Or" + + "\xfb\x09\xb2\x97\x08\x02J!1\x82!\x009$, " + + "\x05-0\x8c\x0e!{Qa\x04\x8b\x00\xe4K\xb8}" + + "\x10\xd9\xaf {q(\x82\xc5\x00\xf2\xe5\x02\xadk\x18" + + "\xd9\xa7\x92\xbd\xa4(\x82%\x00r\xad0\x19 :\x81" + + "\xec?${)F\xb0\x14@\x9e#\x18\x00\xd1\xd9d" + + "\x9f/t\xe1|{A&\x15o\xd6\xeaU`>\xd9" + + "diF2\x91R\x9b\x89\xd5;Sx\x95i\xc5\x13" + + ")7\xa1k\xcb\x12\x16W\xd5\xd8Mp\xebz\xb2\x8e" + + "\xdeBX\xb5\x9a\xba\xbdmv\x18\x8b\x19>\xbd\xeb\xab" + + "\xac9*\xd6\xac\xa9\xa9Lz\x0a\xb0d\xbc\x9b\xdao" + + "\xd6\x17\xa8\xcd\xb5\x06\xb0\xeeb?\xa6'\x93j*^" + + "\x0b\xa2\xd1\xfde\xdf3\xd8J-\xb5\xe4\x06\xd5?\xe1" + + "\xdc\x14\x17\xebJ\xbe\x18\xf6\xf2RV+\xf4I\x8aR" + + "\xf1\xda\xcc\xf2\xd5\xefn\"\xcb\xd1\xa3\xe2yF4\xfd" + + "\x02$G\x03\x9b\x00\xdf.\x82\xdd\xb4\xd8\x0b\x11\xdc\xc9" + + "P\xf9+mW\x17\xf4\xba,\xef\xeb^\xbaB\xa2o" + + "\xb5\xd0\xe2\x8c\xa8\x99\xb9Jz\x80\xa7<\xa5\x9e\xa5\xb4" + + "\xd0]J\xfb\xef\xea\x7fYE\xf3D\x19&\xe2\xe6\x0a" + + "\x94O\xe5\xea\xc1\xbc,\x19A\x7f\x04i(\xfdaR" + + "\xe5p\x00\x0cH\xe5\x83\x01\xc4D:&\xa64KL" + + "'\xe2\xe1\x8c\xa9\x19b\xc62\xf3:\x9f\x1eT\x88\xaf" + + "\x0e,s\xb7M\xa5\xcd\x98\x9f\xdd\x0cg\xd7\x12$u" + + "\xe3\x0c\x95\xb4O\xff&\xc9\xd8\xc4P\xb1\x88\xe9\x07e" + + "\xf5\xefb\xfa:\xcdP\xb9]\xc8\x92\xd6\x14=\xce\x8f" + + "8\x00\x02\x06\x00'\x99V\\\xcfX\xcef\xd2\xa3f" + + "\x18\xee\xdeZ\x89\xa4\x16\xbf>c\xf9\x88\xb0o\xc9\x8c" + + "b\x8buk\x04,\xf2\xc5_\xac\x13\x0ca\xa3>\x11" + + "\xc7B\x10\xb00\xcf\xc0s\x94X\xa7\xe8\xa2A*\xdc" + + "A6P\xd8\xadc\xa8l\xf6\x85\xdd\xa6\xb9\x00\xcaC" + + "\x0c\x95\xad\xbe\xb0{\xcc\x00P\x1ee\xa8<) v" + + "v\x82v\xb6\x03(O2T\x9e\xa34\xc9\xb2\xf5\xc3" + + "\x1e\x0a\xdag\x18*\xfb)G\x06x\x8e\x94\xf6\xd1N" + + "\xbf\xc8Py\xb7k\xd0\x9az\xecV\xcd\xcaI0\\" + + "\x85h\xa6\x09U\x09=\xe5k\xc5\x98\x96\x9e\xae]h" + + "ihD)\xdd\xd4\xe9\xb8\xf0\xbb\xac!\xfb\xc0\x84\x9c" + + "6,\xcc\x936\xdc\xba\xa0\x0fl\xd8;\x82r\xab\xa3" + + "^Pb\x0f\x1d\xa2z5l\xe4\xd5\x8cu\x0b\xa3^" + + "\xac\xcc\xa9N\x8c+g\xb7\xa41\x1b\xfc<\xd2\x82\x87" + + "\x01\xdc\x80\x17\x8c\x86L\x8a.\xdatr\xb9\x90\xeb\xf9" + + "^\xb5-|wk\x98\xab\x14C\\\xca\xb9MIG" + + "(JH\x0a\xa9\x84\xcc\x15\xe8\x91\x87\\\x8e\x83\x9d^" + + "\xe5@\xae\x14\x85\xacR\xec\x8f\xe3\x01\xa2\x11\xb2\x0fB" + + "\xef\x0a\xc8\x95\xdc\xfd@\xb2\x0fC\xef\x16\xc8C9~" + + "\x90\xd3\xf3\x94\x0a\x82Y\xa5x9\x92\x92\x1bF\xf61" + + "\\)\x16d\x95\xe2U\\Y\x8e\"\xfb\x04\xae\x14\xc5" + + "\xacR\xbc\x86\xfb\x1fG\xf6\xa9d\x0f\x15f\x95b-" + + "W\xb45d\x9f\x89\x02\xdaiC\x8fi\xa69\x1d\xd0" + + "\xa5\x0c\xa7\x00p.\x95h\xa9\x8d\xce\xefI$\x90\x12" + + "\x96O\xfd%\x9a\xe3SU\x0bPs!\x96j4j" + + "\x1e\xc4\xc8\x98\x16m5\x88>\x9fvL5\x1a\xf5\x1b" + + "4\x03\xc2f7\xf3lC\xf3\xf9\xebrC\x9d[\xdb" + + "\xc7\x04\xe1\xa5\xd5An\xbcv\x10\xbf\xbd\x91\xedj;" + + "\xf4\xf6\xe6\xdc\xce\xa6\xf6\x07\xbe\xfc\xf0\x1e\x05\xf6[\x0c" + + "\x95St\xbe5Y~;I7\xec\x04C\xe5\x9c\xaf" + + "?r\x96\xf8\xed\x0c\xc3h\xc0_\x04 m}\x83\x1b" + + "!N\x0d\xd0\x9fG\x14\x8f\x90Q\xfe\x1a`\x04\x92\xe6" + + "\xbe\x82\xec\xe3\xb0+%R\xb0\xeb\x19+\x0aL\x8b9" + + "\xed\xa2\x95\x9d\xd25W\xb4\xf6 \xc5\xff\x07\x84l\xae" + + "\xf8\xca[\xe9\xb9}\x9e^\xd0Z\xf7\xffbj\xd0\xcc" + + "p\xfe}o\xb75\xd4\x8b1s\x1aw\x8e\xbb|[" + + "\xaeN\xff\x81\xb7\x1fD\xcbh\xc9\xe9}\x0f\xf6z\xdf" + + "n\xce\x1e1\xdak~\x8b\xb7j-n\xdbn\x89\xda" + + "\x9cq\xaf\xdb\xbf\x03\x00\x00\xff\xff%\x93J\x19" func RegisterSchema(reg *schemas.Registry) { reg.Register(&schemas.Schema{ @@ -4261,6 +4327,7 @@ func RegisterSchema(reg *schemas.Registry) { 0xa20f49456be85b99, 0xa93853d6a4e3fa16, 0xaa2f3c8ad1c3af24, + 0xaa4bbac12765a78a, 0xace5517aafc86077, 0xad2a33d6b9304413, 0xae78ee8eb6b3a134, diff --git a/pkg/client/client.go b/pkg/client/client.go index 2f837a9978..f77289a2a8 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -50,6 +50,7 @@ type ConmonClient struct { tracingEnabled bool tracer trace.Tracer serverVersion semver.Version + cgroupManager CgroupManager } // ConmonServerConfig is the configuration for the conmon server instance. @@ -226,6 +227,7 @@ func (c *ConmonServerConfig) toClient() (*ConmonClient, error) { logger: c.ClientLogger, attachReaders: &sync.Map{}, tracer: tracer, + cgroupManager: c.CgroupManager, }, nil } @@ -321,6 +323,9 @@ func (c *ConmonClient) toArgs(config *ConmonServerConfig) (entrypoint string, ar case CgroupManagerCgroupfs: args = append(args, cgroupManagerFlag, "cgroupfs") + case CgroupManagerPerCommand: + // nothing to do, will use the cgroup manager specified per command + default: return "", args, errUndefinedCgroupManager } @@ -593,6 +598,23 @@ func (c *ConmonClient) Version( }, nil } +func (c *ConmonClient) setCgroupManager( + cfg CgroupManager, + req interface { + SetCgroupManager(proto.Conmon_CgroupManager) + }, +) { + cgroupManager := c.cgroupManager + if cgroupManager == CgroupManagerPerCommand { + cgroupManager = cfg + } else if cfg != CgroupManager(0) { + c.logger.Warnf( + "cgroup manager specified in per command config, but global cgroup manager is not set to CgroupManagerPerCommand", + ) + } + req.SetCgroupManager(proto.Conmon_CgroupManager(cgroupManager)) +} + // CreateContainerConfig is the configuration for calling the CreateContainer // method. type CreateContainerConfig struct { @@ -630,6 +652,11 @@ type CreateContainerConfig struct { // EnvVars are the environment variables passed to the create runtime call. EnvVars map[string]string + + // CgroupManager can be use to select the cgroup manager. + // + // To use this option set `ConmonServerConfig.CgroupManager` to `CgroupManagerPerCommand`. + CgroupManager CgroupManager } // ContainerLogDriver specifies a selected logging mechanism. @@ -722,6 +749,8 @@ func (c *ConmonClient) CreateContainer( return fmt.Errorf("convert environment variables string slice to text list: %w", err) } + c.setCgroupManager(cfg.CgroupManager, req) + return nil }) defer free() @@ -758,6 +787,11 @@ type ExecSyncConfig struct { // EnvVars are the environment variables passed to the exec runtime call. EnvVars map[string]string + + // CgroupManager can be use to select the cgroup manager. + // + // To use this option set `ConmonServerConfig.CgroupManager` to `CgroupManagerPerCommand`. + CgroupManager CgroupManager } // ExecContainerResult is the result for calling the ExecSyncContainer method. @@ -809,6 +843,7 @@ func (c *ConmonClient) ExecSyncContainer(ctx context.Context, cfg *ExecSyncConfi if err := stringStringMapToMapEntryList(cfg.EnvVars, req.NewEnvVars); err != nil { return err } + c.setCgroupManager(cfg.CgroupManager, req) return nil }) diff --git a/pkg/client/consts.go b/pkg/client/consts.go index 4866a69dd1..9e1643fde7 100644 --- a/pkg/client/consts.go +++ b/pkg/client/consts.go @@ -1,5 +1,7 @@ package client +import "github.com/containers/conmon-rs/internal/proto" + // LogLevel is the enum for all available server log levels. type LogLevel string @@ -35,16 +37,22 @@ const ( ) // CgroupManager is the enum for all available cgroup managers. -type CgroupManager int +type CgroupManager proto.Conmon_CgroupManager const ( // CgroupManagerSystemd specifies to use systemd to create and manage // cgroups. - CgroupManagerSystemd CgroupManager = iota + CgroupManagerSystemd CgroupManager = CgroupManager(proto.Conmon_CgroupManager_systemd) // CgroupManagerCgroupfs specifies to use the cgroup filesystem to create // and manage cgroups. - CgroupManagerCgroupfs + CgroupManagerCgroupfs CgroupManager = CgroupManager(proto.Conmon_CgroupManager_cgroupfs) + + // CgroupManagerPerCommand opts-in to the new CgroupManager option specified at the command level. + // + // Set `ConmonServerConfig.CgroupManager` to `CgroupManagerPerCommand` to use + // the CgroupManager specified in the command config (e.g. CreateContainerConfig). + CgroupManagerPerCommand CgroupManager = CgroupManager(0xffff) ) // Namespace is the enum for all available namespaces.