fix(inputs.prometheus): Add namespace option in k8s informer factory (#13063)
Co-authored-by: ivayloi2 <ivayloi2@vmware.com>
This commit is contained in:
parent
5f2142a6cc
commit
14c84a00ee
|
|
@ -135,7 +135,11 @@ func (p *Prometheus) watchPod(ctx context.Context, clientset *kubernetes.Clients
|
|||
}
|
||||
|
||||
if informerfactory == nil {
|
||||
informerfactory = informers.NewSharedInformerFactory(clientset, resyncinterval)
|
||||
var informerOptions []informers.SharedInformerOption
|
||||
if p.PodNamespace != "" {
|
||||
informerOptions = append(informerOptions, informers.WithNamespace(p.PodNamespace))
|
||||
}
|
||||
informerfactory = informers.NewSharedInformerFactoryWithOptions(clientset, resyncinterval, informerOptions...)
|
||||
}
|
||||
|
||||
p.nsStore = informerfactory.Core().V1().Namespaces().Informer().GetStore()
|
||||
|
|
|
|||
Loading…
Reference in New Issue