Extend the resync period for `configmap`. (#115)

Fixes: https://github.com/knative/pkg/issues/114
This commit is contained in:
Matt Moore 2018-10-07 04:26:25 -07:00 committed by Knative Prow Robot
parent 46bd3d242b
commit 1f153817b2
1 changed files with 12 additions and 8 deletions

View File

@ -34,14 +34,8 @@ func NewDefaultWatcher(kc kubernetes.Interface, namespace string) *InformedWatch
return NewInformedWatcher(kc, namespace)
}
// NewInformedWatcher watchers a Kubernetes namespace for configmap changs
func NewInformedWatcher(kc kubernetes.Interface, namespace string) *InformedWatcher {
sif := informers.NewSharedInformerFactoryWithOptions(
kc,
5*time.Minute,
informers.WithNamespace(namespace),
)
// NewInformedWatcherFromFactory watchers a Kubernetes namespace for configmap changs
func NewInformedWatcherFromFactory(sif informers.SharedInformerFactory, namespace string) *InformedWatcher {
return &InformedWatcher{
sif: sif,
informer: sif.Core().V1().ConfigMaps(),
@ -51,6 +45,16 @@ func NewInformedWatcher(kc kubernetes.Interface, namespace string) *InformedWatc
}
}
// NewInformedWatcher watchers a Kubernetes namespace for configmap changs
func NewInformedWatcher(kc kubernetes.Interface, namespace string) *InformedWatcher {
return NewInformedWatcherFromFactory(informers.NewSharedInformerFactoryWithOptions(
kc,
// This is the default resync period from controller-runtime.
10*time.Hour,
informers.WithNamespace(namespace),
), namespace)
}
// InformedWatcher provides an informer-based implementation of Watcher.
type InformedWatcher struct {
sif informers.SharedInformerFactory