Commit 47f0e738 authored by Marcin Wielgus's avatar Marcin Wielgus

Move periodic backoff gc to federation utils

parent e72f26a3
......@@ -228,17 +228,7 @@ func (fdc *DeploymentController) Run(workers int, stopCh <-chan struct{}) {
go wait.Until(fdc.worker, time.Second, stopCh)
}
go func() {
for {
// Perform backof registry cleanup from time to time.
select {
case <-time.After(time.Minute):
fdc.deploymentBackoff.GC()
case <-stopCh:
return
}
}
}()
fedutil.StartBackoffGC(fdc.deploymentBackoff, stopCh)
<-stopCh
glog.Infof("Shutting down DeploymentController")
......
......@@ -317,17 +317,9 @@ func (ic *IngressController) Run(stopChan <-chan struct{}) {
}
ic.reconcileConfigMapForCluster(clusterName)
})
go func() {
select {
case <-time.After(time.Minute):
glog.V(4).Infof("Ingress controller is garbage collecting")
ic.ingressBackoff.GC()
ic.configMapBackoff.GC()
glog.V(4).Infof("Ingress controller garbage collection complete")
case <-stopChan:
return
}
}()
util.StartBackoffGC(ic.ingressBackoff, stopChan)
util.StartBackoffGC(ic.configMapBackoff, stopChan)
}
func (ic *IngressController) deliverIngressObj(obj interface{}, delay time.Duration, failed bool) {
......
......@@ -180,14 +180,7 @@ func (nc *NamespaceController) Run(stopChan <-chan struct{}) {
nc.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) {
nc.reconcileNamespacesOnClusterChange()
})
go func() {
select {
case <-time.After(time.Minute):
nc.namespaceBackoff.GC()
case <-stopChan:
return
}
}()
util.StartBackoffGC(nc.namespaceBackoff, stopChan)
}
func (nc *NamespaceController) deliverNamespaceObj(obj interface{}, delay time.Duration, failed bool) {
......
......@@ -228,14 +228,7 @@ func (frsc *ReplicaSetController) Run(workers int, stopCh <-chan struct{}) {
go wait.Until(frsc.worker, time.Second, stopCh)
}
go func() {
select {
case <-time.After(time.Minute):
frsc.replicaSetBackoff.GC()
case <-stopCh:
return
}
}()
fedutil.StartBackoffGC(frsc.replicaSetBackoff, stopCh)
<-stopCh
glog.Infof("Shutting down ReplicaSetController")
......
......@@ -179,14 +179,7 @@ func (secretcontroller *SecretController) Run(stopChan <-chan struct{}) {
secretcontroller.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) {
secretcontroller.reconcileSecretsOnClusterChange()
})
go func() {
select {
case <-time.After(time.Minute):
secretcontroller.secretBackoff.GC()
case <-stopChan:
return
}
}()
util.StartBackoffGC(secretcontroller.secretBackoff, stopChan)
}
func getSecretKey(namespace, name string) string {
......
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package util
import (
"time"
"k8s.io/kubernetes/pkg/util/flowcontrol"
)
func StartBackoffGC(backoff *flowcontrol.Backoff, stopCh <-chan struct{}) {
go func() {
for {
select {
case <-time.After(time.Minute):
backoff.GC()
case <-stopCh:
return
}
}
}()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment