1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

ignore stats if no rule is applied

This commit is contained in:
shivkumar dudhani 2019-09-03 18:18:21 -07:00
parent cd6b1d0990
commit 9d81e61002

View file

@ -67,6 +67,12 @@ func (psa *PolicyStatusAggregator) aggregate(ps PolicyStat) {
glog.V(4).Infof("write Unlock update policy %s", ps.PolicyName)
psa.mux.Unlock()
}()
if len(ps.Stats.Rules) == 0 {
glog.V(4).Infof("ignoring stats, as no rule was applied")
return
}
info, ok := psa.policyData[ps.PolicyName]
if !ok {
psa.policyData[ps.PolicyName] = ps.Stats
@ -105,6 +111,7 @@ func (psa *PolicyStatusAggregator) aggregate(ps PolicyStat) {
}
func aggregateRules(old []RuleStatinfo, update []RuleStatinfo) []RuleStatinfo {
glog.V(4).Info(update)
var zeroDuration time.Duration
searchRule := func(list []RuleStatinfo, key string) *RuleStatinfo {
for _, v := range list {