diff --git a/conmon-rs/common/proto/conmon.capnp b/conmon-rs/common/proto/conmon.capnp index b71fa953ec..9cac0e884d 100644 --- a/conmon-rs/common/proto/conmon.capnp +++ b/conmon-rs/common/proto/conmon.capnp @@ -39,6 +39,7 @@ interface Conmon { commandArgs @9 :List(Text); metadataOld @10 :Data; # deprecated metadata @11 :Metadata; # Standard metadata to carry. + envVars @12 :TextTextMap; } struct LogDriver { @@ -72,6 +73,7 @@ interface Conmon { terminal @3 :Bool; metadataOld @4 :Data; # deprecated metadata @5 :Metadata; # Standard metadata to carry. + envVars @6 :TextTextMap; } struct ExecSyncContainerResponse { diff --git a/conmon-rs/server/src/child_reaper.rs b/conmon-rs/server/src/child_reaper.rs index 0baa150dfe..3ff22816e6 100644 --- a/conmon-rs/server/src/child_reaper.rs +++ b/conmon-rs/server/src/child_reaper.rs @@ -63,6 +63,7 @@ impl ChildReaper { stdin: bool, container_io: &mut ContainerIO, pidfile: &Path, + env_vars: Vec<(String, String)>, ) -> Result<(u32, CancellationToken)> where P: AsRef, @@ -79,6 +80,7 @@ impl ChildReaper { .args(args) .stdout(Stdio::piped()) .stderr(Stdio::piped()) + .envs(env_vars) .spawn() .context("spawn child process: {}")?; diff --git a/conmon-rs/server/src/rpc.rs b/conmon-rs/server/src/rpc.rs index 1c6c8ccdba..246fc0246a 100644 --- a/conmon-rs/server/src/rpc.rs +++ b/conmon-rs/server/src/rpc.rs @@ -1,4 +1,5 @@ use crate::{ + capnp_util, child::Child, container_io::{ContainerIO, SharedContainerIO}, container_log::ContainerLog, @@ -134,13 +135,14 @@ impl conmon::Server for Server { let runtime = self.config().runtime().clone(); let exit_paths = capnp_vec_path!(req.get_exit_paths()); let oom_exit_paths = capnp_vec_path!(req.get_oom_exit_paths()); + let env_vars = pry!(req.get_env_vars().and_then(capnp_util::into_map)); Promise::from_future( async move { capnp_err!(container_log.write().await.init().await)?; let (grandchild_pid, token) = capnp_err!(match child_reaper - .create_child(runtime, args, stdin, &mut container_io, &pidfile) + .create_child(runtime, args, stdin, &mut container_io, &pidfile, env_vars) .await { Err(e) => { @@ -212,11 +214,19 @@ impl conmon::Server for Server { 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)); Promise::from_future( async move { match child_reaper - .create_child(&runtime, &args, false, &mut container_io, &pidfile) + .create_child( + &runtime, + &args, + false, + &mut container_io, + &pidfile, + env_vars, + ) .await { Ok((grandchild_pid, token)) => { diff --git a/internal/proto/conmon.capnp.go b/internal/proto/conmon.capnp.go index 4d06b6500e..4ea6ca8459 100644 --- a/internal/proto/conmon.capnp.go +++ b/internal/proto/conmon.capnp.go @@ -822,12 +822,12 @@ type Conmon_CreateContainerRequest capnp.Struct const Conmon_CreateContainerRequest_TypeID = 0xba77e3fa3aa9b6ca func NewConmon_CreateContainerRequest(s *capnp.Segment) (Conmon_CreateContainerRequest, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 10}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 11}) return Conmon_CreateContainerRequest(st), err } func NewRootConmon_CreateContainerRequest(s *capnp.Segment) (Conmon_CreateContainerRequest, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 10}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 11}) return Conmon_CreateContainerRequest(st), err } @@ -1089,13 +1089,36 @@ func (s Conmon_CreateContainerRequest) NewMetadata(n int32) (Conmon_TextTextMapE err = capnp.Struct(s).SetPtr(9, l.ToPtr()) return l, err } +func (s Conmon_CreateContainerRequest) EnvVars() (Conmon_TextTextMapEntry_List, error) { + p, err := capnp.Struct(s).Ptr(10) + return Conmon_TextTextMapEntry_List(p.List()), err +} + +func (s Conmon_CreateContainerRequest) HasEnvVars() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Conmon_CreateContainerRequest) SetEnvVars(v Conmon_TextTextMapEntry_List) error { + return capnp.Struct(s).SetPtr(10, v.ToPtr()) +} + +// NewEnvVars sets the envVars field to a newly +// allocated Conmon_TextTextMapEntry_List, preferring placement in s's segment. +func (s Conmon_CreateContainerRequest) NewEnvVars(n int32) (Conmon_TextTextMapEntry_List, error) { + l, err := NewConmon_TextTextMapEntry_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Conmon_TextTextMapEntry_List{}, err + } + err = capnp.Struct(s).SetPtr(10, l.ToPtr()) + return l, err +} // Conmon_CreateContainerRequest_List is a list of Conmon_CreateContainerRequest. type Conmon_CreateContainerRequest_List = capnp.StructList[Conmon_CreateContainerRequest] // NewConmon_CreateContainerRequest creates a new list of Conmon_CreateContainerRequest. func NewConmon_CreateContainerRequest_List(s *capnp.Segment, sz int32) (Conmon_CreateContainerRequest_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 10}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 11}, sz) return capnp.StructList[Conmon_CreateContainerRequest](l), err } @@ -1322,12 +1345,12 @@ type Conmon_ExecSyncContainerRequest capnp.Struct const Conmon_ExecSyncContainerRequest_TypeID = 0xf41122f890a371a6 func NewConmon_ExecSyncContainerRequest(s *capnp.Segment) (Conmon_ExecSyncContainerRequest, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 4}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 5}) return Conmon_ExecSyncContainerRequest(st), err } func NewRootConmon_ExecSyncContainerRequest(s *capnp.Segment) (Conmon_ExecSyncContainerRequest, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 4}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 5}) return Conmon_ExecSyncContainerRequest(st), err } @@ -1456,13 +1479,36 @@ func (s Conmon_ExecSyncContainerRequest) NewMetadata(n int32) (Conmon_TextTextMa err = capnp.Struct(s).SetPtr(3, l.ToPtr()) return l, err } +func (s Conmon_ExecSyncContainerRequest) EnvVars() (Conmon_TextTextMapEntry_List, error) { + p, err := capnp.Struct(s).Ptr(4) + return Conmon_TextTextMapEntry_List(p.List()), err +} + +func (s Conmon_ExecSyncContainerRequest) HasEnvVars() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Conmon_ExecSyncContainerRequest) SetEnvVars(v Conmon_TextTextMapEntry_List) error { + return capnp.Struct(s).SetPtr(4, v.ToPtr()) +} + +// NewEnvVars sets the envVars field to a newly +// allocated Conmon_TextTextMapEntry_List, preferring placement in s's segment. +func (s Conmon_ExecSyncContainerRequest) NewEnvVars(n int32) (Conmon_TextTextMapEntry_List, error) { + l, err := NewConmon_TextTextMapEntry_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Conmon_TextTextMapEntry_List{}, err + } + err = capnp.Struct(s).SetPtr(4, l.ToPtr()) + return l, err +} // Conmon_ExecSyncContainerRequest_List is a list of Conmon_ExecSyncContainerRequest. type Conmon_ExecSyncContainerRequest_List = capnp.StructList[Conmon_ExecSyncContainerRequest] // NewConmon_ExecSyncContainerRequest creates a new list of Conmon_ExecSyncContainerRequest. func NewConmon_ExecSyncContainerRequest_List(s *capnp.Segment, sz int32) (Conmon_ExecSyncContainerRequest_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 4}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 5}, sz) return capnp.StructList[Conmon_ExecSyncContainerRequest](l), err } @@ -4009,195 +4055,198 @@ func (p Conmon_createNamespaces_Results_Future) Response() Conmon_CreateNamespac return Conmon_CreateNamespacesResponse_Future{Future: p.Future.Field(0, nil)} } -const schema_ffaaf7385bc4adad = "x\xda\xb4Y}p\x14\xf5\xf9\x7f\x9e\xfd\xdees!" + - "xY\xf6\"1\x13~Q\x04\x7f@\x8b\xbc\x04+e" + - "pH\x80\x0cBA\xb39\xf0\x0du\xd8\xdc-\xc9a" + - "\xee\xf6\xb2\xbb\x07\x04\xb5\xf8R\xa6\x82\xa2\x92\xc2(L" + - "\x9d!\x0aV\xa8T\xa9\xc5\x0a\xa2#\xbe\x8c\x8a\xda\x0a" + - "U\xda:b[\x91\x8a\x8cU\xa9v\x8a\x8ev;\xcf" + - "wo_r\x89xG\xf5\x0f&\xb7\xcf~\xf6\xfb|" + - "\xbf\xcf\xeb\xe7\xf92~Oych\xc2\xe0\xa1\x83A" + - "P\xee\x0d\x97\xd9\xe6\xdf\xba\x8d\x07\xef\x9bu+H\xe7" + - "\"@\x18E\x80\x86\xae\xb2w\x11P^U6\x0d\xd0" + - "\xfe\xd7\x96\x97.\xbag\xdd\xc7k\x82\x80\xad\x0e`7" + - "\x07\xbc=y\xcc\xe2\xcdl\xee\xedA\xc0\xe1\xb2\xb7\x08" + - "p\x82\x03~\xbc(\xba\xfegg.\xe4\x00\xfbD\xc3" + - "\xe2\xc3\x1b\x8f]\xf8[\x08\x8b\x04\x94\xc4\xb7P\x1e\xcb" + - "\x7f\x8e\x16\xefB@\xfb\x95\xff[qy\xf4\xc1\x9f\xde" + - "[\x80\xe6\xcbF\"\xef\xa2<2\"\x02\xc8\xe7Dh" + - "\xe9U\x1f\\\xf2\xf8\x82[?\xde\x1c\xd4\xbd \xf2O" + - "\xd2\x9d\xe2\x80\x8d\x0b\x8f]\xd7<;z\x7f\xdf\xd5B" + - "\x84[\x1b\xd9\x8e\xf2\xd6\x88\x08\xcc>\xf3\x8b#[\x0e" + - "\xc5'o\x03\xe5\\\xec\xa7\xf4f\xc2m\xe4J7D" + - "\x96\x01\xda#\x1ey\xee\xc0\x9a\xa9\xe3\xb6\x07\x95\x9e\x88" + - "\x1c$\xa5\xe1\x0aR\xbal\xd1K\x8f\xacP\x8e><" + - "\x80\xd2\x91\x15=(_TAJ\xe5\x99\xe3w\x1fj" + - "\x18\xb3\xa3P\xa9@\xb8\xb3\x087\xa1\x82\x94\x8e\xadx" + - "\x04\xd0\x9e\xd4\xfb\xd8\xe3w~\xb4\xfcW\x84\x16\x0a\xb7" + - "x\xb8b\x09\xca'*\x86\x02\xc8\x9fs\xf4\xf5\x07\x8e" + - "?t\xe7\xedM\xbb\x0a\xd7f\x84^7\xe8Y\x94\xb7" + - "\x0d\xe2\x8e\x1cTO6\xf7\x00R\x1d\xb3w\xecx~" + - "\xe1\xe4\x7fo\xb7\x01\xb0\xe1\xb5\xcaZl8\\\xf9\xff" + - "\x08\xd0p\xc1\x19/\xa2\x9c\x8b\x8a\x00\xf6\xfe\xc7\xb7M" + - "\xf9\xe2\xc8\xb2=\x85\xcb\xd3~\x1b\xae\x89\x1eD\xb9\x9b" + - "p\x0d\xb9\xe8/\x04@\xbbj\xe1\xef/\xfa\xf0\xda\xbf" + - "\xbf\x104\xd8\xbe!\xb4h\xd7" + - "\xba\xd8!\x90\xce\x0d\xd8\x1a\xb0\xe1\x9a\xd8\x12\x94\xbbb" + - "\x84L\xc7V\x02\xda_\xae\x9az\xd3\xb0a\x87\xfe<" + - "\xa0\x13{c\xc7Q~\x8a\xa3w\xc7\xde\x07\xb47}" + - "oY\xf6\xda\xb6)\xef\x14\xa0ydl\xa8~\x0b\xe5" + - "\x9d\xd5|\x13\xd5\xb4\xe3/\xa7|\xf9\xf4\xe6\xa9\xd9\xbf" + - "\x14.\x1d&\xf4\x81\xea5(\x7f@\xe8\x86\xa3\xd5\x97" + - "\x93\x0f\x17dgI\xe7\xb5\x9e\xf1\xd7\xa0\x05\xae\x1c:" + - "\x84l\xd85\x94\xd6\x1b\x7f\xfd\xacm\xd7\xa6\xe4#A" + - "\xc0\x86\xa1\x9b\xc8D[9\xe0\x07\xf2s\x8ff\xd6\x1d" + - "?\x1a\x04\xbc<\xf48\x01\x0es\xc0\xbe\x85\x0d-\x7f" + - "\xf0Q\xfd\xc3\xaf\x1c\xfd" + - "\xd1\xa7\x85{\x8f\xf0\x9c\xaf\xd9\x84\xf2\xe8\x1a\x9e\x0e5" + - "\x17R\x80<\xd8\xf5\xc0\xdd'\x87K\x9f\x15\x0677" + - "Lw\xed\xbb(o\xa8\xe5\x91[\xcb\x8f\xfa\xc4\xa6\xf5" + - "w=?q\xd6g\xc1\x8d\x0e\xae\xe3\x09xN\x1dm" + - "t/n\x1ft\xf5\x92c'\x83\x80\xa6:~\x92\x05" + - "\x1cp\xb2\xf7\x97\x0d7\xbd\xf6\xd8\xe7\x03dhw\xdd" + - "~\x947\xd4Q\x86\xf6\xfcaN\xfa\x9d\xaf\x9e\xfc\xa2" + - " f\xb8o\xbb\xea\xeeGyu\x1d\x1dyU\xdd2" + - "\x18k\xa72\x96fd\xd4\xce\xb2qYC\xb7\xf4q" + - "\x09=\x93\xd63\xe7'\xd4l&;e\x86\xf3\xa0-" + - "\xd7\x12\xf1\xeeLb\x86\x9e\xb1\xd4TF3F\xb4\xa8" + - "\x86\xa8\xa6M%\xc4B\x00!\x04\x90\x06O\x07P\xca" + - "\x19*1\x01W\x1aZWN3-\xac\xf2M\x04\x88" + - "U\x80E\xa9K\x18\x9aji\x97\xa8i\xcd\xcc\xaa\x09" + - "\xcd\x1c\xd1\xaa\x999\xb1\xd3\xea\xa3n\x0e\x80R\xc9P" + - "\xa9\x11\xd0643\xabgL\x0d\x00\xb0\xca\xaf\xc4\xff" + - "\x8b\xca\x16\xd5PY1\x07\xf4\xbaD\x09\xdaf\x14h" + - "k\xa5\xd5\x98i\xb5 *u\x9e\xc2]m\x00\xcao" + - "\x18*\xcf\x08(!\xc6\x90\x84O]\x05\xa0\xece\xa8" + - "\xfcI@I\x10b(\x00Ho\x12\xf2\x0d\x86\xca'" + - "\x02J\x8c\xc5\x90\x01H\xff \xe1\x87\x0c\xe3\xe5(\xa0" + - "\x14\x0a\xc50\x04 \x87q\x0e@<\x84\x0c\xe3U$" + - "\x0f\x87c\x18\x06\x90\x07\xe3D\x80x9\xc9c$/" + - "+\x8ba\x19\xe5\x05\xc7W\x91\xfc\xfb(\xa0\x9d\xd6," + - "5\xa9Z*\x88\x97v&q0\x088\x18\xd0\xce\xe4" + - "\x8f\x02L3\xf1\x0c\xc0\x16\x86\x18\xf5\xcb\x11 \x09\xed" + - "\\*9O\xcdfS f\xda=X%\x08\xfce" + - "\xfb\xa9^\xb6\xa9\xa6\xd6\xa2Z\x1d\xe4`\x92U\x02\xd6" + - "g\xf5\xe4\xec\xa4\xfb\xe4\xef\x0b\xc0\xfd\xb8\xcaO\x84\xfc" + - "\x06N\xcf7fV\x173\xa6F\xce\x09D\xc3U\xf9" + - "\xf8\x1b%\x0c|\xfc*\xbf;\x97\xa0\xdd\xd0\xf4\xac\x96" + - "\x99\xab\xb7\xfb\xa9\xd6\xaa\xd5\x9b\xb9\xa2\x83\xdf#\x0e\x05" + - "\xe1\x18>\x85\xd2VW)\x9d5\xaa;g-\xeaK" + - "\xcfL\xc1/\x95ro\xa3\xa3\xc7\x00(#\x18*\xe3" + - "\x05t#x,\xc9F1T&\x09\x18\xb5\xba\xb3Z" + - "A\xa4D\x01\xa3Y\xd5\xea\xf0\\[\x8c\xddT\xcbR" + - "\x13\x1d}\xea\x93\x9a\xc6\"\xd2\xd7\xebV%\xd8\xab\x89" + - "+ku\xec\x8eE\x1b\xeb2\xcd0Sz\x86'\xbb" + - "\x89<\xd9+\xbd\xed5\xd3\xf6\x1a\x19*s}K\xcd" + - "\xa6\x0c\xbe\x98\xa12\x9fr\x1d\x9d\\W\xc8\xf7-\x0c" + - "\x95N\x01W.\xd5\x8c6\xdd\xd4\x10A@\x84\xaf\xcb" + - "\xce\x92r#t\x8a\x13\xcc\xd5\xdbg\x1a\xd1\xd4R\xcd" + - "PB\x18\xec\xab8&:\xbf;\xab\x05\xcf3f\x80" + - "\xf3\x90l&C\xa5%p\x9ey\xd3\xfdC\xba\xe1\xe0" + - "-<@8\xacL\xab\xcb\xe3\xa9\x15\x1aF@\xc0H" + - "\x91\xe1\x11\xd7\xac\xcbS\x99\xa4\xbe\x8c\xbet\x1c`\x01" + - "9 \xe6m\xf8\xc6Z\x00e9C\xe5'\xfe\x86o" + - "\x9e\x08\xa0\xdc\xc0P\xb9-\xb0\xe1US\x00\x94\x9b\x18" + - "*wP\xb1E\xa7\xd8\xae&W\xdd\xc6PYO\xb5" + - "V\xe0\xb5VZG\xae\xba\x9b\xa1\xf2\xb0\x80,\xe5\xd5" + - "\xaa\xfae\xa9\xa4\xd5\x81\"\x08(\x02N\xeb\xd0R\xed" + - "\x1d\x96\xfb\xf8m\xb8\x90}\x9d%\x98\x9eQ.F\xf4" + - ")\xbc\xb4z\x85\xcfy\xa4\xd5\xb7\xf8\x0cYZ\xbd\xc7" + - "\xa7J\xd2\xdaV\x9f\x03Jk\x9f\xf5\xbb\xba\xb4n\xbf" + - "\xcf%\xa5\x8d\x07\xfd|\x92z\x8d\xc0@\xd1\xbb\"\xc0" + - "d{\xd7\x04\xe6\x9b\xad=>\xeb\x97\xb6m\x0fP\x9c" + - "\x1d\xbf\x0e\x8c`;\x9f\x0d\xb0\xdb]\xad\x81qk\xd7" + - "~\xbf\xd2JO\xf5\x04\xd8\xcf\xbe5\xb6\x9bs0\xcd" + - "q\xba'`n\xd5t\xea\xbdW9Z] \x8f\xf5" + - "\xd4R\x0d\xd0\xb0]L\xd8\x05\xb9\x1f7\x17\x12#7" + - "\xb6\xc0v_\x09\x81w\xf9\x82a\xbb\x05\x04\xea\x1d]" + - "\xde\xf34g]\xdb\xad\xc8\xd8\xee/\x18\x94\xb9\x0b\xb9" + - "q\x8dn`G\xf9z\x85b\xb3\xdeY\xd6\xedm\xac" + - "\x0f\xf10-p\xeb8\xfa\x18\xa1O\x03\xe4\xfd\xc5\xf6" + - "a\xfe\x16\xe6k\xcb-\xfa\x87\xf3\xd4ls\xc62\xba" + - "\x01\x94:\x16\x06\xf0\x86\x1ft\x19\xbct`:\x08\xd2" + - "\x0b\"\xfaT\x18\xdd\x01H\xda}\x0b\x08\xd2N\x11\x05" + - "o\xb4G\x97\x0eK[{@\x90zEd\xde\x0c\x8b" + - "\xeel&m\xa0\xef\xd6\x8a\x18\xf2\xe6\x00t\xa7k\xe9" + - "\xe6M H7\x8a\x18\xf6&5t\xc7\x0d\xa9k\x0f" + - "\x08RZ\xc42\xef\"\x00\xdd+\x03I]\x03\x82t" + - "\x8dH\xe5\x95\x82\xa5\x11\xedD>\x020\xefKhD" + - "\xdbe\xc5\xe8z\x18\x8dF\xb4\xddN\x14D\x1a\x9e\xeb" + - "\xf2P\xa6\x11\xd4\xec\xe3\xa6\x19zf\x9a\xf3\x89\xa7\xef" + - "\x12\x15]/\x004b\xb0\xd1|3\x85)\x88I\xa7" + - "\xe1\x8cw\xeb\x9d\xdc\x84\xb5\x00\xf1\xa9D\xec.F\x9f" + - "`\xca\xcdx\x15@|&\xc9[P@t(\xa6<" + - "\x8f\xf3\xc0\xb9$\xbe\x02\xfd\xc2'/\xe0\xbc\xb1\x85\xe4" + - "W\xa3_\xfb\xe4+\xb1\x15 ~\x05\xc9-\xce3\x99" + - "\xc33\xbbp\x09@!\x97^&\xe4K\x0c" + - "\x95\xf7\xfa\xd67\x8a\\=g\xc5\x81i\x09\xf7\xaee" + - "e\x9eD\x16\xd2\xc7\x01H\xf1wM)\x0biP\xd1" + - "\x9c\xcb\xbb\xe1(\xa1\xc0\xf4\xff\xff\x8fV\xcd\x8c\x16\x7f" + - ")\xeb\xdd\x90\x94\xa0\xb3\xe0\xca\xca]\xae\xd8\xcbFw" + - ",\xe7S\xb9h\x19\xdd\x05\x17\xb3\xc3\xfd\x8bY\xaf{" + - "\x8e\x9d\xe8\xdf\xcc\x8a\xd7i\xdd\xde\x85\xd5R\xb53\xe7" + - "\x05\xfe\x7f\x03\x00\x00\xff\xff\xbd\xfa\xda\xb6" +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/" func RegisterSchema(reg *schemas.Registry) { reg.Register(&schemas.Schema{ diff --git a/pkg/client/client.go b/pkg/client/client.go index 865f22e357..2f837a9978 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -627,6 +627,9 @@ type CreateContainerConfig struct { // CommandArgs are the additional arguments passed to the create runtime call // after the command. e.g: crun create --runtime-opt CommandArgs []string + + // EnvVars are the environment variables passed to the create runtime call. + EnvVars map[string]string } // ContainerLogDriver specifies a selected logging mechanism. @@ -708,11 +711,15 @@ func (c *ConmonClient) CreateContainer( } if err := stringSliceToTextList(cfg.GlobalArgs, req.NewGlobalArgs); err != nil { - return fmt.Errorf("convert cleanup command string slice to text list: %w", err) + return fmt.Errorf("convert global arguments string slice to text list: %w", err) } if err := stringSliceToTextList(cfg.CommandArgs, req.NewCommandArgs); err != nil { - return fmt.Errorf("convert cleanup command string slice to text list: %w", err) + return fmt.Errorf("convert command arguments string slice to text list: %w", err) + } + + if err := stringStringMapToMapEntryList(cfg.EnvVars, req.NewEnvVars); err != nil { + return fmt.Errorf("convert environment variables string slice to text list: %w", err) } return nil @@ -748,6 +755,9 @@ type ExecSyncConfig struct { // Terminal specifies if a tty should be used. Terminal bool + + // EnvVars are the environment variables passed to the exec runtime call. + EnvVars map[string]string } // ExecContainerResult is the result for calling the ExecSyncContainer method. @@ -796,6 +806,9 @@ func (c *ConmonClient) ExecSyncContainer(ctx context.Context, cfg *ExecSyncConfi return err } req.SetTerminal(cfg.Terminal) + if err := stringStringMapToMapEntryList(cfg.EnvVars, req.NewEnvVars); err != nil { + return err + } return nil })