add global resource limmits
This commit is contained in:
@@ -73,6 +73,15 @@ type Config struct {
|
||||
Trusted bool `envconfig:"DRONE_LIMIT_TRUSTED"`
|
||||
}
|
||||
|
||||
Resources struct {
|
||||
Memory int64 `envconfig:"DRONE_MEMORY_LIMIT"`
|
||||
MemorySwap int64 `envconfig:"DRONE_MEMORY_SWAP_LIMIT"`
|
||||
CPUQuota int64 `envconfig:"DRONE_CPU_QUOTA"`
|
||||
CPUPeriod int64 `envconfig:"DRONE_CPU_PERIOD"`
|
||||
CPUShares int64 `envconfig:"DRONE_CPU_SHARES"`
|
||||
CPUSet []string `envconfig:"DRONE_CPU_SET"`
|
||||
}
|
||||
|
||||
Secret struct {
|
||||
Endpoint string `envconfig:"DRONE_SECRET_PLUGIN_ENDPOINT"`
|
||||
Token string `envconfig:"DRONE_SECRET_PLUGIN_TOKEN"`
|
||||
|
||||
@@ -123,7 +123,14 @@ func (c *daemonCommand) run(*kingpin.ParseContext) error {
|
||||
Privileged: append(config.Runner.Privileged, compiler.Privileged...),
|
||||
Networks: config.Runner.Networks,
|
||||
Volumes: config.Runner.Volumes,
|
||||
// Resources: nil,
|
||||
Resources: compiler.Resources{
|
||||
Memory: config.Resources.Memory,
|
||||
MemorySwap: config.Resources.MemorySwap,
|
||||
CPUQuota: config.Resources.CPUQuota,
|
||||
CPUPeriod: config.Resources.CPUPeriod,
|
||||
CPUShares: config.Resources.CPUShares,
|
||||
CPUSet: config.Resources.CPUSet,
|
||||
},
|
||||
Registry: registry.Combine(
|
||||
registry.File(
|
||||
config.Docker.Config,
|
||||
|
||||
Reference in New Issue
Block a user