Commit 14350778 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

Set executor cpu resources to an integer to avoid rounding errors

This avoid that we either waste cpu resources due to rounding or that we report to much to the kubelet such that the e2e tests think they can schedule more than resources are available. This fixes https://github.com/mesosphere/kubernetes-mesos/issues/437
parent ae7830b4
...@@ -145,6 +145,7 @@ scheduler: ...@@ -145,6 +145,7 @@ scheduler:
--mesos-master=mesosmaster1:5050 --mesos-master=mesosmaster1:5050
--cluster-dns=10.10.10.10 --cluster-dns=10.10.10.10
--cluster-domain=cluster.local --cluster-domain=cluster.local
--mesos-executor-cpus=1.0
--v=4 --v=4
environment: environment:
- MESOS_DOCKER_ETCD_TIMEOUT - MESOS_DOCKER_ETCD_TIMEOUT
......
...@@ -979,6 +979,7 @@ func nodeInfo(si *mesos.SlaveInfo, ei *mesos.ExecutorInfo) NodeInfo { ...@@ -979,6 +979,7 @@ func nodeInfo(si *mesos.SlaveInfo, ei *mesos.ExecutorInfo) NodeInfo {
case "cpus": case "cpus":
// We intentionally take the floor of executorCPU because cores are integers // We intentionally take the floor of executorCPU because cores are integers
// and we would loose a complete cpu here if the value is <1. // and we would loose a complete cpu here if the value is <1.
// TODO(sttts): switch to float64 when "Machine Allocables" are implemented
ni.Cores = int(r.GetScalar().GetValue() - float64(int(executorCPU))) ni.Cores = int(r.GetScalar().GetValue() - float64(int(executorCPU)))
case "mem": case "mem":
ni.Mem = int64(r.GetScalar().GetValue()-executorMem) * 1024 * 1024 ni.Mem = int64(r.GetScalar().GetValue()-executorMem) * 1024 * 1024
......
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