Skip to content

Commit

Permalink
proto: spoof out oom exit paths
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <pehunt@redhat.com>
  • Loading branch information
haircommander committed May 4, 2022
1 parent 54978f7 commit 22a1616
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 131 deletions.
3 changes: 2 additions & 1 deletion conmon-rs/common/proto/conmon.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ interface Conmon {
bundlePath @1 :Text;
terminal @2 :Bool;
exitPaths @3 :List(Text);
logDrivers @4 :List(LogDriver);
oomExitPaths @4 :List(Text);
logDrivers @5 :List(LogDriver);
}

struct LogDriver {
Expand Down
285 changes: 155 additions & 130 deletions internal/proto/conmon.capnp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ type CreateContainerConfig struct {
// ExitPaths is a slice of paths to write the exit statuses.
ExitPaths []string

// OOMExitPaths is a slice of files that should be created if the given container is OOM killed.
OOMExitPaths []string

// LogDrivers is a slice of selected log drivers.
LogDrivers []LogDriver
}
Expand Down Expand Up @@ -458,6 +461,9 @@ func (c *ConmonClient) CreateContainer(
if err := stringSliceToTextList(cfg.ExitPaths, req.NewExitPaths); err != nil {
return fmt.Errorf("convert string slice to text list: %w", err)
}
if err := stringSliceToTextList(cfg.OOMExitPaths, req.NewOomExitPaths); err != nil {
return err
}

if err := c.initLogDrivers(&req, cfg.LogDrivers); err != nil {
return fmt.Errorf("init log drivers: %w", err)
Expand Down

0 comments on commit 22a1616

Please sign in to comment.