Skip to content

Commit

Permalink
Extend the resync period for configmap. (knative#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor authored and knative-prow-robot committed Oct 7, 2018
1 parent 46bd3d2 commit 1f15381
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions configmap/informed_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
Expand Down

0 comments on commit 1f15381

Please sign in to comment.