Skip to content

Commit

Permalink
Removes log warning regarding indexer and may improve performance. Cl…
Browse files Browse the repository at this point in the history
…oses #1345 (#2761)
  • Loading branch information
alexec committed Nov 27, 2019
1 parent 4ea88b6 commit be93e79
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ func NewApplicationController(
if err != nil {
return nil, err
}
projInformer := v1alpha1.NewAppProjectInformer(applicationClientset, namespace, appResyncPeriod, cache.Indexers{})
indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}
projInformer := v1alpha1.NewAppProjectInformer(applicationClientset, namespace, appResyncPeriod, indexers)
metricsAddr := fmt.Sprintf("0.0.0.0:%d", metricsPort)
ctrl.metricsServer = metrics.NewMetricsServer(metricsAddr, appLister, func() error {
_, err := kubeClientset.Discovery().ServerVersion()
Expand Down
3 changes: 2 additions & 1 deletion util/argo/argo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ func TestGetAppProjectWithNoProjDefined(t *testing.T) {
appClientset := appclientset.NewSimpleClientset(testProj)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
informer := v1alpha1.NewAppProjectInformer(appClientset, namespace, 0, cache.Indexers{})
indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}
informer := v1alpha1.NewAppProjectInformer(appClientset, namespace, 0, indexers)
go informer.Run(ctx.Done())
cache.WaitForCacheSync(ctx.Done(), informer.HasSynced)
proj, err := GetAppProject(&testApp.Spec, applisters.NewAppProjectLister(informer.GetIndexer()), namespace)
Expand Down
3 changes: 2 additions & 1 deletion util/rbac/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ func (e *Enforcer) newInformer() cache.SharedIndexInformer {
cmFieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", e.configmap))
options.FieldSelector = cmFieldSelector.String()
}
return v1.NewFilteredConfigMapInformer(e.clientset, e.namespace, defaultRBACSyncPeriod, cache.Indexers{}, tweakConfigMap)
indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}
return v1.NewFilteredConfigMapInformer(e.clientset, e.namespace, defaultRBACSyncPeriod, indexers, tweakConfigMap)
}

// RunPolicyLoader runs the policy loader which watches policy updates from the configmap and reloads them
Expand Down
5 changes: 3 additions & 2 deletions util/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,9 @@ func (mgr *SettingsManager) initialize(ctx context.Context) error {
options.LabelSelector = cmLabelSelector.String()
}

cmInformer := v1.NewFilteredConfigMapInformer(mgr.clientset, mgr.namespace, 3*time.Minute, cache.Indexers{}, tweakConfigMap)
secretsInformer := v1.NewSecretInformer(mgr.clientset, mgr.namespace, 3*time.Minute, cache.Indexers{})
indexers := cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}
cmInformer := v1.NewFilteredConfigMapInformer(mgr.clientset, mgr.namespace, 3*time.Minute, indexers, tweakConfigMap)
secretsInformer := v1.NewSecretInformer(mgr.clientset, mgr.namespace, 3*time.Minute, indexers)

log.Info("Starting configmap/secret informers")
go func() {
Expand Down

0 comments on commit be93e79

Please sign in to comment.