mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Move periodic backoff gc to federation utils
This commit is contained in:
parent
e72f26a3ff
commit
47f0e738e9
@ -228,17 +228,7 @@ func (fdc *DeploymentController) Run(workers int, stopCh <-chan struct{}) {
|
|||||||
go wait.Until(fdc.worker, time.Second, stopCh)
|
go wait.Until(fdc.worker, time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
fedutil.StartBackoffGC(fdc.deploymentBackoff, stopCh)
|
||||||
for {
|
|
||||||
// Perform backof registry cleanup from time to time.
|
|
||||||
select {
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
fdc.deploymentBackoff.GC()
|
|
||||||
case <-stopCh:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
<-stopCh
|
<-stopCh
|
||||||
glog.Infof("Shutting down DeploymentController")
|
glog.Infof("Shutting down DeploymentController")
|
||||||
|
@ -317,17 +317,9 @@ func (ic *IngressController) Run(stopChan <-chan struct{}) {
|
|||||||
}
|
}
|
||||||
ic.reconcileConfigMapForCluster(clusterName)
|
ic.reconcileConfigMapForCluster(clusterName)
|
||||||
})
|
})
|
||||||
go func() {
|
|
||||||
select {
|
util.StartBackoffGC(ic.ingressBackoff, stopChan)
|
||||||
case <-time.After(time.Minute):
|
util.StartBackoffGC(ic.configMapBackoff, stopChan)
|
||||||
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
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ic *IngressController) deliverIngressObj(obj interface{}, delay time.Duration, failed bool) {
|
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.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) {
|
||||||
nc.reconcileNamespacesOnClusterChange()
|
nc.reconcileNamespacesOnClusterChange()
|
||||||
})
|
})
|
||||||
go func() {
|
util.StartBackoffGC(nc.namespaceBackoff, stopChan)
|
||||||
select {
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
nc.namespaceBackoff.GC()
|
|
||||||
case <-stopChan:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nc *NamespaceController) deliverNamespaceObj(obj interface{}, delay time.Duration, failed bool) {
|
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 wait.Until(frsc.worker, time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
fedutil.StartBackoffGC(frsc.replicaSetBackoff, stopCh)
|
||||||
select {
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
frsc.replicaSetBackoff.GC()
|
|
||||||
case <-stopCh:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
<-stopCh
|
<-stopCh
|
||||||
glog.Infof("Shutting down ReplicaSetController")
|
glog.Infof("Shutting down ReplicaSetController")
|
||||||
|
@ -179,14 +179,7 @@ func (secretcontroller *SecretController) Run(stopChan <-chan struct{}) {
|
|||||||
secretcontroller.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) {
|
secretcontroller.clusterDeliverer.StartWithHandler(func(_ *util.DelayingDelivererItem) {
|
||||||
secretcontroller.reconcileSecretsOnClusterChange()
|
secretcontroller.reconcileSecretsOnClusterChange()
|
||||||
})
|
})
|
||||||
go func() {
|
util.StartBackoffGC(secretcontroller.secretBackoff, stopChan)
|
||||||
select {
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
secretcontroller.secretBackoff.GC()
|
|
||||||
case <-stopChan:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSecretKey(namespace, name string) string {
|
func getSecretKey(namespace, name string) string {
|
||||||
|
36
federation/pkg/federation-controller/util/backoff.go
Normal file
36
federation/pkg/federation-controller/util/backoff.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user