Skip to content

Commit

Permalink
Enhance namespace restriction logic in informers
Browse files Browse the repository at this point in the history
Signed-off-by: 400Ping <[email protected]>
  • Loading branch information
400Ping committed Nov 29, 2024
1 parent e289196 commit 8e936b0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/admission/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,19 @@ type Informers struct {
func NewInformers(kubeClient client.KubeClient, namespace string) *Informers {
stopChan := make(chan struct{})

informerFactory := informers.NewSharedInformerFactoryWithOptions(kubeClient.GetClientSet(), 0, informers.WithNamespace(namespace))
informerFactory := informers.NewSharedInformerFactoryWithOptions(
kubeClient.GetClientSet(),
0,
informers.WithNamespace(namespace),
)
informerFactory.Start(stopChan)

result := &Informers{
return &Informers{
ConfigMap: informerFactory.Core().V1().ConfigMaps(),
PriorityClass: informerFactory.Scheduling().V1().PriorityClasses(),
Namespace: informerFactory.Core().V1().Namespaces(),
stopChan: stopChan,
}

return result
}

func (i *Informers) Start() {
Expand Down

0 comments on commit 8e936b0

Please sign in to comment.