Commit 08fbe2bc authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #13789 from socaa/resource-consumer-memory

Auto commit by PR queue bot
parents 6a5049f0 9e640b35
......@@ -104,8 +104,7 @@ func (handler ResourceConsumerHandler) handleConsumeMem(w http.ResponseWriter, q
http.Error(w, incorrectFunctionArgument, http.StatusBadRequest)
return
}
ConsumeMem(megabytes, durationSec)
fmt.Fprintln(w, "Warning: not implemented!")
go ConsumeMem(megabytes, durationSec)
fmt.Fprintln(w, consumeMemAddress[1:])
fmt.Fprintln(w, megabytes, megabytesQuery)
fmt.Fprintln(w, durationSec, durationSecQuery)
......
......@@ -20,9 +20,13 @@ import (
"fmt"
"log"
"os/exec"
"strconv"
)
const consumeCPUBinary = "./consume-cpu/consume-cpu"
const (
consumeCPUBinary = "./consume-cpu/consume-cpu"
consumeMemBinary = "stress"
)
func ConsumeCPU(millicores int, durationSec int) {
log.Printf("ConsumeCPU millicores: %v, durationSec: %v", millicores, durationSec)
......@@ -35,7 +39,11 @@ func ConsumeCPU(millicores int, durationSec int) {
func ConsumeMem(megabytes int, durationSec int) {
log.Printf("ConsumeMem megabytes: %v, durationSec: %v", megabytes, durationSec)
// not implemented
megabytesString := strconv.Itoa(megabytes) + "M"
durationSecString := strconv.Itoa(durationSec)
// creating new consume memory process
consumeMem := exec.Command(consumeMemBinary, "-m", "1", "--vm-bytes", megabytesString, "--vm-hang", "0", "-t", durationSecString)
consumeMem.Start()
}
func GetCurrentStatus() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment