diff --git a/contrib/mesos/pkg/scheduler/mesos_scheduler.go b/contrib/mesos/pkg/scheduler/mesos_scheduler.go index 73354d0625b..864ea3f061a 100644 --- a/contrib/mesos/pkg/scheduler/mesos_scheduler.go +++ b/contrib/mesos/pkg/scheduler/mesos_scheduler.go @@ -922,7 +922,8 @@ func (ks *MesosScheduler) recoverTasks() error { // Create creates a scheduler plugin and all supporting background functions. func (k *MesosScheduler) NewDefaultPluginConfig(terminate <-chan struct{}, mux *http.ServeMux) *PluginConfig { // use ListWatch watching pods using the client by default - return k.NewPluginConfig(terminate, mux, createAllPodsLW(k.client)) + lw := cache.NewListWatchFromClient(k.client, "pods", api.NamespaceAll, parseSelectorOrDie("")) + return k.NewPluginConfig(terminate, mux, lw) } func (k *MesosScheduler) NewPluginConfig(terminate <-chan struct{}, mux *http.ServeMux, diff --git a/contrib/mesos/pkg/scheduler/plugin.go b/contrib/mesos/pkg/scheduler/plugin.go index 6289068b68e..046a31c5cfc 100644 --- a/contrib/mesos/pkg/scheduler/plugin.go +++ b/contrib/mesos/pkg/scheduler/plugin.go @@ -354,9 +354,3 @@ func parseSelectorOrDie(s string) fields.Selector { } return selector } - -// createAllPodsLW returns a listWatch that finds all pods -func createAllPodsLW(cl *client.Client) *cache.ListWatch { - return cache.NewListWatchFromClient(cl, "pods", api.NamespaceAll, parseSelectorOrDie("")) -} -