From 1435077820c4c3c3bd19f42f8274aa6136bc49f3 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 15 Sep 2015 17:30:00 +0200 Subject: [PATCH] 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 --- cluster/mesos/docker/docker-compose.yml | 1 + contrib/mesos/pkg/executor/executor.go | 1 + 2 files changed, 2 insertions(+) diff --git a/cluster/mesos/docker/docker-compose.yml b/cluster/mesos/docker/docker-compose.yml index ef441f82ce1..82ab753d953 100644 --- a/cluster/mesos/docker/docker-compose.yml +++ b/cluster/mesos/docker/docker-compose.yml @@ -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 diff --git a/contrib/mesos/pkg/executor/executor.go b/contrib/mesos/pkg/executor/executor.go index 6e02d715718..bfc014d6cad 100644 --- a/contrib/mesos/pkg/executor/executor.go +++ b/contrib/mesos/pkg/executor/executor.go @@ -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