Skip to content

Commit 48b26e2

Browse files
committed
fix pod scheduling retry logic
1 parent 078bc36 commit 48b26e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

plugin/pkg/scheduler/factory/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
183183
go func() {
184184
defer util.HandleCrash()
185185
podID := pod.Name
186+
podNamespace := pod.Namespace
186187
backoff.wait(podID)
187188
// Get the pod again; it may have changed/been scheduled already.
188189
pod = &api.Pod{}
189-
ctx := api.WithNamespace(api.NewContext(), pod.Namespace)
190-
err := factory.Client.Get().Namespace(api.Namespace(ctx)).Path("pods").Path(podID).Do().Into(pod)
190+
err := factory.Client.Get().Namespace(podNamespace).Path("pods").Path(podID).Do().Into(pod)
191191
if err != nil {
192192
glog.Errorf("Error getting pod %v for retry: %v; abandoning", podID, err)
193193
return

plugin/pkg/scheduler/factory/factory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func TestPollMinions(t *testing.T) {
183183
}
184184

185185
func TestDefaultErrorFunc(t *testing.T) {
186-
testPod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
186+
testPod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"}}
187187
handler := util.FakeHandler{
188188
StatusCode: 200,
189189
ResponseBody: runtime.EncodeOrDie(latest.Codec, testPod),
@@ -212,7 +212,7 @@ func TestDefaultErrorFunc(t *testing.T) {
212212
if !exists {
213213
continue
214214
}
215-
handler.ValidateRequest(t, "/api/"+testapi.Version()+"/pods/foo", "GET", nil)
215+
handler.ValidateRequest(t, "/api/"+testapi.Version()+"/pods/foo?namespace=bar", "GET", nil)
216216
if e, a := testPod, got; !reflect.DeepEqual(e, a) {
217217
t.Errorf("Expected %v, got %v", e, a)
218218
}

0 commit comments

Comments
 (0)