Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkg/operator/v1helpers/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ type KubeInformersForNamespaces interface {

var _ KubeInformersForNamespaces = kubeInformersForNamespaces{}

func NewKubeInformersForNamespaces(kubeClient kubernetes.Interface, namespaces ...string) KubeInformersForNamespaces {
func NewKubeInformersForNamespacesWithResyncPeriod(kubeClient kubernetes.Interface, resyncInterval time.Duration, namespaces ...string) KubeInformersForNamespaces {
ret := kubeInformersForNamespaces{}
for _, namespace := range namespaces {
if len(namespace) == 0 {
ret[""] = informers.NewSharedInformerFactory(kubeClient, 10*time.Minute)
ret[""] = informers.NewSharedInformerFactory(kubeClient, resyncInterval)
continue
}
ret[namespace] = informers.NewSharedInformerFactoryWithOptions(kubeClient, 10*time.Minute, informers.WithNamespace(namespace))
ret[namespace] = informers.NewSharedInformerFactoryWithOptions(kubeClient, resyncInterval, informers.WithNamespace(namespace))
}

return ret
}

func NewKubeInformersForNamespaces(kubeClient kubernetes.Interface, namespaces ...string) KubeInformersForNamespaces {
return NewKubeInformersForNamespacesWithResyncPeriod(kubeClient, 10*time.Minute, namespaces...)
}

type kubeInformersForNamespaces map[string]informers.SharedInformerFactory

// WaitForCacheSync waits for all started informers' cache were synced.
Expand Down