diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index f07e271e35f..a498955e6ab 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -624,7 +624,7 @@ func (l assignedPodNamespaceLister) Get(name string) (*v1.Pod, error) { if len(pod.Spec.NodeName) > 0 { return pod, nil } - return nil, errors.NewNotFound(schema.GroupResource{Resource: "pods"}, name) + return nil, errors.NewNotFound(schema.GroupResource{Resource: string(v1.ResourcePods)}, name) } type podInformer struct { @@ -642,7 +642,7 @@ func (i *podInformer) Lister() corelisters.PodLister { // NewPodInformer creates a shared index informer that returns only non-terminal pods. func NewPodInformer(client clientset.Interface, resyncPeriod time.Duration) coreinformers.PodInformer { selector := fields.ParseSelectorOrDie("status.phase!=" + string(v1.PodSucceeded) + ",status.phase!=" + string(v1.PodFailed)) - lw := cache.NewListWatchFromClient(client.Core().RESTClient(), "pods", metav1.NamespaceAll, selector) + lw := cache.NewListWatchFromClient(client.Core().RESTClient(), string(v1.ResourcePods), metav1.NamespaceAll, selector) return &podInformer{ informer: cache.NewSharedIndexInformer(lw, &v1.Pod{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}), } diff --git a/plugin/pkg/scheduler/factory/factory_test.go b/plugin/pkg/scheduler/factory/factory_test.go index 73ef315d70c..31758e6afd0 100644 --- a/plugin/pkg/scheduler/factory/factory_test.go +++ b/plugin/pkg/scheduler/factory/factory_test.go @@ -249,7 +249,7 @@ func TestDefaultErrorFunc(t *testing.T) { mux := http.NewServeMux() // FakeHandler musn't be sent requests other than the one you want to test. - mux.Handle(util.Test.ResourcePath("pods", "bar", "foo"), &handler) + mux.Handle(util.Test.ResourcePath(string(v1.ResourcePods), "bar", "foo"), &handler) server := httptest.NewServer(mux) defer server.Close() client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &api.Registry.GroupOrDie(v1.GroupName).GroupVersion}}) @@ -281,7 +281,7 @@ func TestDefaultErrorFunc(t *testing.T) { if !exists { continue } - handler.ValidateRequest(t, util.Test.ResourcePath("pods", "bar", "foo"), "GET", nil) + handler.ValidateRequest(t, util.Test.ResourcePath(string(v1.ResourcePods), "bar", "foo"), "GET", nil) if e, a := testPod, got; !reflect.DeepEqual(e, a) { t.Errorf("Expected %v, got %v", e, a) } @@ -345,7 +345,7 @@ func TestBind(t *testing.T) { } expectedBody := runtime.EncodeOrDie(util.Test.Codec(), item.binding) handler.ValidateRequest(t, - util.Test.SubResourcePath("pods", metav1.NamespaceDefault, "foo", "binding"), + util.Test.SubResourcePath(string(v1.ResourcePods), metav1.NamespaceDefault, "foo", "binding"), "POST", &expectedBody) } } diff --git a/plugin/pkg/scheduler/scheduler_test.go b/plugin/pkg/scheduler/scheduler_test.go index e5195440d94..4fce050317c 100644 --- a/plugin/pkg/scheduler/scheduler_test.go +++ b/plugin/pkg/scheduler/scheduler_test.go @@ -55,7 +55,7 @@ func (fc fakePodConditionUpdater) Update(pod *v1.Pod, podCondition *v1.PodCondit func podWithID(id, desiredHost string) *v1.Pod { return &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{Name: id, SelfLink: util.Test.SelfLink("pods", id)}, + ObjectMeta: metav1.ObjectMeta{Name: id, SelfLink: util.Test.SelfLink(string(v1.ResourcePods), id)}, Spec: v1.PodSpec{ NodeName: desiredHost, }, @@ -65,7 +65,7 @@ func podWithID(id, desiredHost string) *v1.Pod { func deletingPod(id string) *v1.Pod { deletionTimestamp := metav1.Now() return &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{Name: id, SelfLink: util.Test.SelfLink("pods", id), DeletionTimestamp: &deletionTimestamp}, + ObjectMeta: metav1.ObjectMeta{Name: id, SelfLink: util.Test.SelfLink(string(v1.ResourcePods), id), DeletionTimestamp: &deletionTimestamp}, Spec: v1.PodSpec{ NodeName: "", },