diff --git a/plugins/resource/resource.go b/plugins/resource/resource.go index f782c52a2..90c286d50 100644 --- a/plugins/resource/resource.go +++ b/plugins/resource/resource.go @@ -1,12 +1,11 @@ package resource +// A collection of resource constraints for apps type Resource struct { - Cpu string `json:"cpu"` + CPU string `json:"cpu"` Memory string `json:"memory"` MemorySwap string `json:"memory-swap"` Network string `json:"network"` NetworkIngress string `json:"network-ingress"` NetworkEgress string `json:"network-egress"` } - -const PluginName = "resource" diff --git a/plugins/resource/src/subcommands/limit/limit.go b/plugins/resource/src/subcommands/limit/limit.go index f8256d709..7046b637a 100644 --- a/plugins/resource/src/subcommands/limit/limit.go +++ b/plugins/resource/src/subcommands/limit/limit.go @@ -20,7 +20,7 @@ func main() { args.Parse(os.Args[2:]) resources := resource.Resource{ - Cpu: *cpu, + CPU: *cpu, Memory: *memory, MemorySwap: *memorySwap, Network: *network, diff --git a/plugins/resource/src/subcommands/reserve/reserve.go b/plugins/resource/src/subcommands/reserve/reserve.go index f76167b39..579abd5ca 100644 --- a/plugins/resource/src/subcommands/reserve/reserve.go +++ b/plugins/resource/src/subcommands/reserve/reserve.go @@ -20,7 +20,7 @@ func main() { args.Parse(os.Args[2:]) resources := resource.Resource{ - Cpu: *cpu, + CPU: *cpu, Memory: *memory, MemorySwap: *memorySwap, Network: *network, diff --git a/plugins/resource/subcommands.go b/plugins/resource/subcommands.go index 8c5612b96..b53cc95b9 100644 --- a/plugins/resource/subcommands.go +++ b/plugins/resource/subcommands.go @@ -32,7 +32,7 @@ func setRequestType(args []string, processType string, r Resource, requestType s } resources := map[string]string{ - "cpu": r.Cpu, + "cpu": r.CPU, "memory": r.Memory, "memory-swap": r.MemorySwap, "network": r.Network, @@ -63,7 +63,7 @@ func setRequestType(args []string, processType string, r Resource, requestType s } property := fmt.Sprintf("%v.%v.%v", processType, requestType, key) - err = common.PropertyWrite(PluginName, appName, property, value) + err = common.PropertyWrite("resource", appName, property, value) if err != nil { return }