mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: reduce dependency to ns lister (#3509)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
This commit is contained in:
parent
04740c52fa
commit
04d094f775
1 changed files with 3 additions and 14 deletions
|
@ -152,26 +152,15 @@ func (pc *PolicyController) requeuePolicies() {
|
|||
} else {
|
||||
logger.Error(err, "unable to list ClusterPolicies")
|
||||
}
|
||||
|
||||
namespaces, err := pc.nsLister.List(labels.Everything())
|
||||
if err != nil {
|
||||
logger.Error(err, "unable to list namespaces")
|
||||
return
|
||||
}
|
||||
|
||||
for _, ns := range namespaces {
|
||||
pols, err := pc.npLister.Policies(ns.GetName()).List(labels.Everything())
|
||||
if err != nil {
|
||||
logger.Error(err, "unable to list Policies", "namespace", ns.GetName())
|
||||
continue
|
||||
}
|
||||
|
||||
if pols, err := pc.npLister.Policies(metav1.NamespaceAll).List(labels.Everything()); err == nil {
|
||||
for _, p := range pols {
|
||||
if !pc.canBackgroundProcess(p) {
|
||||
continue
|
||||
}
|
||||
pc.enqueuePolicy(p)
|
||||
}
|
||||
} else {
|
||||
logger.Error(err, "unable to list Policies")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue