diff --git a/README.md b/README.md index 5b7f6d51..ba937878 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,9 @@ containerRunOptions: - OTHER_SECRET_BAR capabilities: # Add list of Linux capabilities (--cap-add) - NET_BIND_SERVICE + sysctls: + net.core.somaxconn: "1024" + net.ipv4.tcp_max_syn_backlog: "4096" bindMounts: # Bind mount a volume (--volume, -v) - /etc/example/dir:/etc/dir ``` diff --git a/bazel/test/test.yaml b/bazel/test/test.yaml index 6e1013ad..936b333e 100644 --- a/bazel/test/test.yaml +++ b/bazel/test/test.yaml @@ -6,3 +6,8 @@ metadataTest: value: "/test" entrypoint: ["/custom_bin"] cmd: ["--arg1", "--arg2"] + +containerRunOptions: + sysctls: + net.core.somaxconn: "1024" + net.ipv4.tcp_max_syn_backlog: "4096" diff --git a/pkg/drivers/docker_driver.go b/pkg/drivers/docker_driver.go index 47083f98..a3b15fab 100644 --- a/pkg/drivers/docker_driver.go +++ b/pkg/drivers/docker_driver.go @@ -19,13 +19,13 @@ import ( "bufio" "bytes" "fmt" - "github.com/joho/godotenv" "io" "os" "path" "path/filepath" "strings" + "github.com/joho/godotenv" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -69,6 +69,7 @@ func (d *DockerDriver) hostConfig() *docker.HostConfig { Capabilities: d.runOpts.Capabilities, Binds: d.runOpts.BindMounts, Privileged: d.runOpts.Privileged, + Sysctls: d.runOpts.Sysctls, Runtime: d.runtime, } } @@ -77,6 +78,7 @@ func (d *DockerDriver) hostConfig() *docker.HostConfig { Capabilities: d.runOpts.Capabilities, Binds: d.runOpts.BindMounts, Privileged: d.runOpts.Privileged, + Sysctls: d.runOpts.Sysctls, } } if d.runtime != "" { diff --git a/pkg/types/unversioned/types.go b/pkg/types/unversioned/types.go index 84dfb602..12e77e56 100644 --- a/pkg/types/unversioned/types.go +++ b/pkg/types/unversioned/types.go @@ -47,9 +47,10 @@ type Config struct { type ContainerRunOptions struct { User string Privileged bool - TTY bool `yaml:"allocateTty"` - EnvVars []string `yaml:"envVars"` - EnvFile string `yaml:"envFile"` + TTY bool `yaml:"allocateTty"` + EnvVars []string `yaml:"envVars"` + EnvFile string `yaml:"envFile"` + Sysctls map[string]string `yaml:"sysctls"` Capabilities []string BindMounts []string `yaml:"bindMounts"` } @@ -61,7 +62,8 @@ func (opts *ContainerRunOptions) IsSet() bool { len(opts.EnvFile) > 0 || (opts.EnvVars != nil && len(opts.EnvVars) > 0) || (opts.Capabilities != nil && len(opts.Capabilities) > 0) || - (opts.BindMounts != nil && len(opts.BindMounts) > 0) + (opts.BindMounts != nil && len(opts.BindMounts) > 0) || + len(opts.Sysctls) > 0 } type TestResult struct {