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
This commit is contained in:
Dr. Stefan Schimanski 2015-09-15 17:30:00 +02:00
parent ae7830b4be
commit 1435077820
2 changed files with 2 additions and 0 deletions

View File

@ -145,6 +145,7 @@ scheduler:
--mesos-master=mesosmaster1:5050
--cluster-dns=10.10.10.10
--cluster-domain=cluster.local
--mesos-executor-cpus=1.0
--v=4
environment:
- MESOS_DOCKER_ETCD_TIMEOUT

View File

@ -979,6 +979,7 @@ func nodeInfo(si *mesos.SlaveInfo, ei *mesos.ExecutorInfo) NodeInfo {
case "cpus":
// We intentionally take the floor of executorCPU because cores are integers
// 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)))
case "mem":
ni.Mem = int64(r.GetScalar().GetValue()-executorMem) * 1024 * 1024