Skip to content

Commit

Permalink
kaps: add cpu and memory resources in container config file example
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Amalric <[email protected]>
  • Loading branch information
hugoamalric committed May 2, 2022
1 parent d391810 commit 79f77a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
19 changes: 0 additions & 19 deletions container/src/cgroups.rs

This file was deleted.

3 changes: 1 addition & 2 deletions container/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mod environment;
mod memory;
mod mounts;
mod namespaces;
mod resources;
pub mod spec;
mod state;

Expand Down Expand Up @@ -159,7 +158,7 @@ impl Container {
};

self.state.pid = child.pid();
self.state.set_status(Status::Running).unwrap();
self.state.set_status(Status::Running)?;

child.wait().map_err(Error::ContainerWaitCommand)?.code()
};
Expand Down
19 changes: 18 additions & 1 deletion hack/fixtures/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
],
"resources": {
"cpu": {
"shares": 1024,
"quota": 1000000,
"period": 500000,
"realtimeRuntime": 950000,
"realtimePeriod": 1000000
},
"memory": {
"limit": 536870912,
"reservation": 536870912,
"kernel": -1,
"kernelTCP": -1,
"swappiness": 0,
"disableOOMKiller": false
}
}
}
}
2 changes: 1 addition & 1 deletion src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct RunCommand {
#[async_trait]
impl Handler for RunCommand {
async fn handler(&self, _: &mut env_logger::Builder) -> Result<()> {
// Create a container by passing the bundle provided in arguments to it's constructor.
// Create a container by passing the bundle and the id provided in arguments to it's constructor.
let mut container = Container::new(&self.bundle, &self.name)?;

// Run the container
Expand Down

0 comments on commit 79f77a6

Please sign in to comment.