diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index baff0620ee2..a243ed410ff 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -183,11 +183,11 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue go func() { defer util.HandleCrash() podID := pod.Name + podNamespace := pod.Namespace backoff.wait(podID) // Get the pod again; it may have changed/been scheduled already. pod = &api.Pod{} - ctx := api.WithNamespace(api.NewContext(), pod.Namespace) - err := factory.Client.Get().Namespace(api.Namespace(ctx)).Path("pods").Path(podID).Do().Into(pod) + err := factory.Client.Get().Namespace(podNamespace).Path("pods").Path(podID).Do().Into(pod) if err != nil { glog.Errorf("Error getting pod %v for retry: %v; abandoning", podID, err) return diff --git a/plugin/pkg/scheduler/factory/factory_test.go b/plugin/pkg/scheduler/factory/factory_test.go index 53f357f5a5b..d1bb337d6ca 100644 --- a/plugin/pkg/scheduler/factory/factory_test.go +++ b/plugin/pkg/scheduler/factory/factory_test.go @@ -183,7 +183,7 @@ func TestPollMinions(t *testing.T) { } func TestDefaultErrorFunc(t *testing.T) { - testPod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}} + testPod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"}} handler := util.FakeHandler{ StatusCode: 200, ResponseBody: runtime.EncodeOrDie(latest.Codec, testPod), @@ -212,7 +212,7 @@ func TestDefaultErrorFunc(t *testing.T) { if !exists { continue } - handler.ValidateRequest(t, "/api/"+testapi.Version()+"/pods/foo", "GET", nil) + handler.ValidateRequest(t, "/api/"+testapi.Version()+"/pods/foo?namespace=bar", "GET", nil) if e, a := testPod, got; !reflect.DeepEqual(e, a) { t.Errorf("Expected %v, got %v", e, a) }