mirror of https://github.com/knative/pkg.git
Extend the resync period for `configmap`. (#115)
Fixes: https://github.com/knative/pkg/issues/114
This commit is contained in:
parent
46bd3d242b
commit
1f153817b2
|
|
@ -34,14 +34,8 @@ func NewDefaultWatcher(kc kubernetes.Interface, namespace string) *InformedWatch
|
||||||
return NewInformedWatcher(kc, namespace)
|
return NewInformedWatcher(kc, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInformedWatcher watchers a Kubernetes namespace for configmap changs
|
// NewInformedWatcherFromFactory watchers a Kubernetes namespace for configmap changs
|
||||||
func NewInformedWatcher(kc kubernetes.Interface, namespace string) *InformedWatcher {
|
func NewInformedWatcherFromFactory(sif informers.SharedInformerFactory, namespace string) *InformedWatcher {
|
||||||
sif := informers.NewSharedInformerFactoryWithOptions(
|
|
||||||
kc,
|
|
||||||
5*time.Minute,
|
|
||||||
informers.WithNamespace(namespace),
|
|
||||||
)
|
|
||||||
|
|
||||||
return &InformedWatcher{
|
return &InformedWatcher{
|
||||||
sif: sif,
|
sif: sif,
|
||||||
informer: sif.Core().V1().ConfigMaps(),
|
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.
|
// InformedWatcher provides an informer-based implementation of Watcher.
|
||||||
type InformedWatcher struct {
|
type InformedWatcher struct {
|
||||||
sif informers.SharedInformerFactory
|
sif informers.SharedInformerFactory
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue