refactor: drop global resource limits

Global limits make it harder to reason about the inheritance in the system. Rather than support global limits, Dokku should provide primitives to automatically set them on an app at provision time, or explicitly set them for an app. Both of these are likely best suited for a higher-level provisioner, or a community plugin.
This commit is contained in:
Jose Diaz-Gonzalez
2019-03-18 16:01:19 -04:00
parent 278a80cc25
commit c9bbddcfcb
7 changed files with 52 additions and 57 deletions

View File

@@ -19,8 +19,11 @@ Manages resource settings for an app
Additional commands:`
helpContent = `
resource:limit [--global] [--process-type process-type] [RESOURCE_OPTS...] <app>, Limit resources for a given app/process-type combination
resource:reserve [--global] [--process-type process-type] [RESOURCE_OPTS...] <app>, Reserve resources for a given app/process-type combination
resource:limit [--process-type <process-type>] [RESOURCE_OPTS...] <app>, Limit resources for a given app/process-type combination
resource:limit-clear [--process-type <process-type>] <app>, Limit resources for a given app/process-type combination
resource:report [<app>] [<flag>], Displays a resource report for one or more apps
resource:reserve [--process-type <process-type>] [RESOURCE_OPTS...] <app>, Reserve resources for a given app/process-type combination
resource:reserve-clear [--process-type <process-type>] <app>, Reserve resources for a given app/process-type combination
`
)

View File

@@ -11,10 +11,9 @@ import (
func main() {
args := flag.NewFlagSet("resource:limit-clear", flag.ExitOnError)
processType := args.String("process-type", "", "process-type: A process type to clear")
global := args.Bool("global", false, "global: Whether to clear global settings or not")
args.Parse(os.Args[2:])
err := resource.CommandLimitClear(args.Args(), *processType, *global)
err := resource.CommandLimitClear(args.Args(), *processType)
if err != nil {
common.LogFail(err.Error())
}

View File

@@ -11,7 +11,6 @@ import (
func main() {
args := flag.NewFlagSet("resource:limit", flag.ExitOnError)
processType := args.String("process-type", "", "process-type: A process type to manage")
global := args.Bool("global", false, "global: Whether to clear global settings or not")
cpu := args.String("cpu", "", "cpu: The amount of cpu to limit processes by")
memory := args.String("memory", "", "memory: The amount of memory to limit processes by")
memorySwap := args.String("memory-swap", "", "memory-swap: The amount of swap memory to limit processes by")
@@ -29,7 +28,7 @@ func main() {
NetworkEgress: *networkEgress,
}
err := resource.CommandLimit(args.Args(), *processType, resources, *global)
err := resource.CommandLimit(args.Args(), *processType, resources)
if err != nil {
common.LogFail(err.Error())
}

View File

@@ -11,10 +11,9 @@ import (
func main() {
args := flag.NewFlagSet("resource:reserve-clear", flag.ExitOnError)
processType := args.String("process-type", "", "process-type: A process type to clear")
global := args.Bool("global", false, "global: Whether to clear global settings or not")
args.Parse(os.Args[2:])
err := resource.CommandReserveClear(args.Args(), *processType, *global)
err := resource.CommandReserveClear(args.Args(), *processType)
if err != nil {
common.LogFail(err.Error())
}

View File

@@ -11,7 +11,6 @@ import (
func main() {
args := flag.NewFlagSet("resource:reserve", flag.ExitOnError)
processType := args.String("process-type", "", "process-type: A process type to manage")
global := args.Bool("global", false, "global: Whether to clear global settings or not")
cpu := args.String("cpu", "", "cpu: The amount of cpu to reserve for processes")
memory := args.String("memory", "", "memory: The amount of memory to reserve for processes")
memorySwap := args.String("memory-swap", "", "memory-swap: The amount of swap memory to reserve for processes")
@@ -29,7 +28,7 @@ func main() {
NetworkEgress: *networkEgress,
}
err := resource.CommandReserve(args.Args(), *processType, resources, *global)
err := resource.CommandReserve(args.Args(), *processType, resources)
if err != nil {
common.LogFail(err.Error())
}