Skip to content

Commit

Permalink
Merge pull request #20936 from mesosphere/jdef_fix_panic_in_procurement
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Feb 10, 2016
2 parents 41a98b4 + eb22c8c commit 8084479
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions contrib/mesos/pkg/scheduler/components/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion contrib/mesos/pkg/scheduler/podtask/procurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
Expand Down

1 comment on commit 8084479

@k8s-teamcity-mesosphere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity OSS :: Kubernetes Mesos :: 4 - Smoke Tests Build 15200 outcome was SUCCESS
Summary: Tests passed: 1, ignored: 223 Build time: 00:03:32

Please sign in to comment.