Commit eb22c8c1 authored by James DeFelice's avatar James DeFelice

handle nil *api.Node in procurement and added TODO for a better long term fix

parent ee54afc9
......@@ -99,6 +99,9 @@ func New(
// "backs off" when it can't find an offer that matches up with a pod.
// The backoff period for a pod can terminate sooner if an offer becomes
// available that matches up.
// TODO(jdef) this will never match for a pod that uses a node selector,
// since we're passing a nil *api.Node here.
return !task.Has(podtask.Launched) && ps.Fit(task, offer, nil)
default:
// no point in continuing to check for matching offers
......
......@@ -61,6 +61,8 @@ func NewDefaultProcurement(prototype *mesos.ExecutorInfo, eir executorinfo.Regis
//
// In contrast T.Spec is meant not to be filled by the procurement chain
// but rather by a final scheduler instance.
//
// api.Node is an optional (possibly nil) param.
type Procurement interface {
Procure(*T, *api.Node, *ProcureState) error
}
......@@ -129,7 +131,8 @@ func NewNodeProcurement() Procurement {
// check the NodeSelector
if len(t.Pod.Spec.NodeSelector) > 0 {
if n.Labels == nil {
// *api.Node is optional for procurement
if n == nil || n.Labels == nil {
return fmt.Errorf(
"NodeSelector %v does not match empty labels of pod %s/%s",
t.Pod.Spec.NodeSelector, t.Pod.Namespace, t.Pod.Name,
......
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