diff --git a/contrib/mesos/pkg/scheduler/plugin.go b/contrib/mesos/pkg/scheduler/plugin.go index 507c04e7dea..8556d1558c3 100644 --- a/contrib/mesos/pkg/scheduler/plugin.go +++ b/contrib/mesos/pkg/scheduler/plugin.go @@ -301,7 +301,7 @@ func (k *KubernetesMesosScheduler) NewPluginConfig(terminate <-chan struct{}, mu podsWatcher *cache.ListWatch) *PluginConfig { // Watch and queue pods that need scheduling. - updates := make(chan queue.Entry, k.schedcfg.UpdatesBacklog) + updates := make(chan queue.Entry, k.schedulerConfig.UpdatesBacklog) podUpdates := &podStoreAdapter{queue.NewHistorical(updates)} reflector := cache.NewReflector(podsWatcher, &api.Pod{}, podUpdates, 0) @@ -316,7 +316,7 @@ func (k *KubernetesMesosScheduler) NewPluginConfig(terminate <-chan struct{}, mu } eh := &errorHandler{ api: kapi, - backoff: backoff.New(k.schedcfg.InitialPodBackoff.Duration, k.schedcfg.MaxPodBackoff.Duration), + backoff: backoff.New(k.schedulerConfig.InitialPodBackoff.Duration, k.schedulerConfig.MaxPodBackoff.Duration), qr: q, } startLatch := make(chan struct{}) diff --git a/contrib/mesos/pkg/scheduler/plugin_test.go b/contrib/mesos/pkg/scheduler/plugin_test.go index 9ca9f93d0c4..3ec1aa762cb 100644 --- a/contrib/mesos/pkg/scheduler/plugin_test.go +++ b/contrib/mesos/pkg/scheduler/plugin_test.go @@ -481,9 +481,9 @@ func newLifecycleTest(t *testing.T) lifecycleTest { Host: apiServer.server.URL, Version: testapi.Default.Version(), }), - PodScheduler: malgorithm.NewFCFSPodScheduler(strategy, apiServer.LookupNode), - Schedcfg: *schedcfg.CreateDefaultConfig(), - LookupNode: apiServer.LookupNode, + PodScheduler: malgorithm.NewFCFSPodScheduler(strategy, apiServer.LookupNode), + SchedulerConfig: *schedcfg.CreateDefaultConfig(), + LookupNode: apiServer.LookupNode, }) assert.NotNil(mesosScheduler.client, "client is nil") diff --git a/contrib/mesos/pkg/scheduler/scheduler.go b/contrib/mesos/pkg/scheduler/scheduler.go index 2c33793bba9..d79b8eba980 100644 --- a/contrib/mesos/pkg/scheduler/scheduler.go +++ b/contrib/mesos/pkg/scheduler/scheduler.go @@ -76,7 +76,7 @@ type KubernetesMesosScheduler struct { // Config related, write-once - schedcfg *schedcfg.Config + schedulerConfig *schedcfg.Config executor *mesos.ExecutorInfo executorGroup uint64 client *client.Client @@ -110,7 +110,7 @@ type KubernetesMesosScheduler struct { } type Config struct { - Schedcfg schedcfg.Config + SchedulerConfig schedcfg.Config Executor *mesos.ExecutorInfo PodScheduler malgorithm.PodScheduler Client *client.Client @@ -125,7 +125,7 @@ type Config struct { func New(config Config) *KubernetesMesosScheduler { var k *KubernetesMesosScheduler k = &KubernetesMesosScheduler{ - schedcfg: &config.Schedcfg, + schedulerConfig: &config.SchedulerConfig, RWMutex: new(sync.RWMutex), executor: config.Executor, executorGroup: uid.Parse(config.Executor.ExecutorId.GetValue()).Group(), @@ -165,9 +165,9 @@ func New(config Config) *KubernetesMesosScheduler { return errOnce.Send(errOuter).Err() }, // remember expired offers so that we can tell if a previously scheduler offer relies on one - LingerTTL: config.Schedcfg.OfferLingerTTL.Duration, - TTL: config.Schedcfg.OfferTTL.Duration, - ListenerDelay: config.Schedcfg.ListenerDelay.Duration, + LingerTTL: config.SchedulerConfig.OfferLingerTTL.Duration, + TTL: config.SchedulerConfig.OfferTTL.Duration, + ListenerDelay: config.SchedulerConfig.ListenerDelay.Duration, }), slaveHostNames: slave.NewRegistry(), taskRegistry: podtask.NewInMemoryRegistry(), @@ -217,7 +217,7 @@ func (k *KubernetesMesosScheduler) InstallDebugHandlers(mux *http.ServeMux) { w.WriteHeader(http.StatusServiceUnavailable) }, k.terminate) select { - case <-time.After(k.schedcfg.HttpHandlerTimeout.Duration): + case <-time.After(k.schedulerConfig.HttpHandlerTimeout.Duration): log.Warningf("timed out waiting for request to be processed") w.WriteHeader(http.StatusServiceUnavailable) return @@ -294,8 +294,8 @@ func (k *KubernetesMesosScheduler) onInitialRegistration(driver bindings.Schedul defer close(k.registration) if k.failoverTimeout > 0 { - refreshInterval := k.schedcfg.FrameworkIdRefreshInterval.Duration - if k.failoverTimeout < k.schedcfg.FrameworkIdRefreshInterval.Duration.Seconds() { + refreshInterval := k.schedulerConfig.FrameworkIdRefreshInterval.Duration + if k.failoverTimeout < k.schedulerConfig.FrameworkIdRefreshInterval.Duration.Seconds() { refreshInterval = time.Duration(math.Max(1, k.failoverTimeout/2)) * time.Second } go runtime.Until(k.storeFrameworkId, refreshInterval, k.terminate) @@ -305,13 +305,13 @@ func (k *KubernetesMesosScheduler) onInitialRegistration(driver bindings.Schedul r2 := k.makePodRegistryReconciler() k.reconciler = newReconciler(k.asRegisteredMaster, k.makeCompositeReconciler(r1, r2), - k.reconcileCooldown, k.schedcfg.ExplicitReconciliationAbortTimeout.Duration, k.terminate) + k.reconcileCooldown, k.schedulerConfig.ExplicitReconciliationAbortTimeout.Duration, k.terminate) go k.reconciler.Run(driver) if k.reconcileInterval > 0 { ri := time.Duration(k.reconcileInterval) * time.Second - time.AfterFunc(k.schedcfg.InitialImplicitReconciliationDelay.Duration, func() { runtime.Until(k.reconciler.RequestImplicit, ri, k.terminate) }) - log.Infof("will perform implicit task reconciliation at interval: %v after %v", ri, k.schedcfg.InitialImplicitReconciliationDelay.Duration) + time.AfterFunc(k.schedulerConfig.InitialImplicitReconciliationDelay.Duration, func() { runtime.Until(k.reconciler.RequestImplicit, ri, k.terminate) }) + log.Infof("will perform implicit task reconciliation at interval: %v after %v", ri, k.schedulerConfig.InitialImplicitReconciliationDelay.Duration) } } @@ -714,8 +714,8 @@ func (k *KubernetesMesosScheduler) explicitlyReconcileTasks(driver bindings.Sche for backoff := 1 * time.Second; first || remaining.Len() > 0; backoff = backoff * 2 { first = false // nothing to do here other than wait for status updates.. - if backoff > k.schedcfg.ExplicitReconciliationMaxBackoff.Duration { - backoff = k.schedcfg.ExplicitReconciliationMaxBackoff.Duration + if backoff > k.schedulerConfig.ExplicitReconciliationMaxBackoff.Duration { + backoff = k.schedulerConfig.ExplicitReconciliationMaxBackoff.Duration } select { case <-cancel: diff --git a/contrib/mesos/pkg/scheduler/service/service.go b/contrib/mesos/pkg/scheduler/service/service.go index c5de0e26510..d53db093196 100644 --- a/contrib/mesos/pkg/scheduler/service/service.go +++ b/contrib/mesos/pkg/scheduler/service/service.go @@ -719,7 +719,7 @@ func (s *SchedulerServer) bootstrap(hks hyperkube.Interface, sc *schedcfg.Config fcfs := malgorithm.NewFCFSPodScheduler(as, lookupNode) mesosPodScheduler := scheduler.New(scheduler.Config{ - Schedcfg: *sc, + SchedulerConfig: *sc, Executor: executor, PodScheduler: fcfs, Client: client,