Skip to content

Commit 79f77a6

Browse files
committed
kaps: add cpu and memory resources in container config file example
Signed-off-by: Hugo Amalric <hugo.amalric01@etu.umontpellier.fr>
1 parent d391810 commit 79f77a6

4 files changed

Lines changed: 20 additions & 23 deletions

File tree

container/src/cgroups.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

container/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mod environment;
1919
mod memory;
2020
mod mounts;
2121
mod namespaces;
22-
mod resources;
2322
pub mod spec;
2423
mod state;
2524

@@ -159,7 +158,7 @@ impl Container {
159158
};
160159

161160
self.state.pid = child.pid();
162-
self.state.set_status(Status::Running).unwrap();
161+
self.state.set_status(Status::Running)?;
163162

164163
child.wait().map_err(Error::ContainerWaitCommand)?.code()
165164
};

hack/fixtures/config.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@
181181
"/proc/irq",
182182
"/proc/sys",
183183
"/proc/sysrq-trigger"
184-
]
184+
],
185+
"resources": {
186+
"cpu": {
187+
"shares": 1024,
188+
"quota": 1000000,
189+
"period": 500000,
190+
"realtimeRuntime": 950000,
191+
"realtimePeriod": 1000000
192+
},
193+
"memory": {
194+
"limit": 536870912,
195+
"reservation": 536870912,
196+
"kernel": -1,
197+
"kernelTCP": -1,
198+
"swappiness": 0,
199+
"disableOOMKiller": false
200+
}
201+
}
185202
}
186203
}

src/cli/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct RunCommand {
2626
#[async_trait]
2727
impl Handler for RunCommand {
2828
async fn handler(&self, _: &mut env_logger::Builder) -> Result<()> {
29-
// Create a container by passing the bundle provided in arguments to it's constructor.
29+
// Create a container by passing the bundle and the id provided in arguments to it's constructor.
3030
let mut container = Container::new(&self.bundle, &self.name)?;
3131

3232
// Run the container

0 commit comments

Comments
 (0)