Skip to content

Commit 1435077

Browse files
committed
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 d2iq-archive/kubernetes-mesos#437
1 parent ae7830b commit 1435077

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

cluster/mesos/docker/docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ scheduler:
145145
--mesos-master=mesosmaster1:5050
146146
--cluster-dns=10.10.10.10
147147
--cluster-domain=cluster.local
148+
--mesos-executor-cpus=1.0
148149
--v=4
149150
environment:
150151
- MESOS_DOCKER_ETCD_TIMEOUT

contrib/mesos/pkg/executor/executor.go

+1
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ func nodeInfo(si *mesos.SlaveInfo, ei *mesos.ExecutorInfo) NodeInfo {
979979
case "cpus":
980980
// We intentionally take the floor of executorCPU because cores are integers
981981
// and we would loose a complete cpu here if the value is <1.
982+
// TODO(sttts): switch to float64 when "Machine Allocables" are implemented
982983
ni.Cores = int(r.GetScalar().GetValue() - float64(int(executorCPU)))
983984
case "mem":
984985
ni.Mem = int64(r.GetScalar().GetValue()-executorMem) * 1024 * 1024

0 commit comments

Comments
 (0)