Skip to content

Commit

Permalink
Only listen for secrets changes in Operator namespace
Browse files Browse the repository at this point in the history
Signed-off-by: pjuarezd <[email protected]>
  • Loading branch information
pjuarezd committed May 24, 2024
1 parent fbefa26 commit 0860450
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func StartOperator(kubeconfig string) {
klog.Infof("Watching only namespaces: %s", strings.Join(namespaces.ToSlice(), ","))
}

// kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Second*30, kubeinformers.WithNamespace(v2.GetNSFromFile()))
kubeInformerFactoryInOperatorNamespace := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, time.Hour*1, kubeinformers.WithNamespace(v2.GetNSFromFile()))
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30)
minioInformerFactory := informers.NewSharedInformerFactory(controllerClient, time.Second*30)
podName := os.Getenv(HostnameEnv)
Expand All @@ -170,10 +170,12 @@ func StartOperator(kubeconfig string) {
minioInformerFactory.Minio().V2().Tenants(),
minioInformerFactory.Sts().V1beta1().PolicyBindings(),
minioInformerFactory.Job().V1alpha1().MinIOJobs(),
kubeInformerFactoryInOperatorNamespace,
)

go kubeInformerFactory.Start(stopCh)
go minioInformerFactory.Start(stopCh)
go kubeInformerFactoryInOperatorNamespace.Start(stopCh)

if err = mainController.Start(2, stopCh); err != nil {
klog.Fatalf("Error running mainController: %s", err.Error())
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ func NewController(
tenantInformer informers.TenantInformer,
policyBindingInformer stsInformers.PolicyBindingInformer,
minioJobInformer jobinformers.MinIOJobInformer,
kubeInformerFactoryInOperatorNamespace kubeinformers.SharedInformerFactory,
) *Controller {
statefulSetInformer := kubeInformerFactory.Apps().V1().StatefulSets()
deploymentInformer := kubeInformerFactory.Apps().V1().Deployments()
podInformer := kubeInformerFactory.Core().V1().Pods()
serviceInformer := kubeInformerFactory.Core().V1().Services()
jobInformer := kubeInformerFactory.Batch().V1().Jobs()
secretInformer := kubeInformerFactory.Core().V1().Secrets()
secretInformer := kubeInformerFactoryInOperatorNamespace.Core().V1().Secrets()

// Create event broadcaster
// Add minio-controller types to the default Kubernetes Scheme so Events can be
Expand Down

0 comments on commit 0860450

Please sign in to comment.