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

527 minor fixes

This commit is contained in:
shravan 2020-02-25 23:57:16 +05:30
parent 7df58b8a4f
commit d0217a3faf
3 changed files with 15 additions and 2 deletions

View file

@ -37,6 +37,7 @@ func NewSync(c *versioned.Clientset, sc <-chan struct{}, pms *policystore.Policy
stop: sc,
client: c,
policyStore: pms,
listener: make(chan statusUpdater),
}
}

View file

@ -16,7 +16,13 @@ func (s *Sync) UpdatePolicyStatusWithGeneratedResourceCount(generateRequest v1.G
func (vc *generatedResourceCount) updateStatus() {
vc.sync.cache.mutex.Lock()
status := vc.sync.cache.data[vc.generateRequest.Spec.Policy]
status, exist := vc.sync.cache.data[vc.generateRequest.Spec.Policy]
if !exist {
policy, _ := vc.sync.policyStore.Get(vc.generateRequest.Spec.Policy)
if policy != nil {
status = policy.Status
}
}
status.ResourcesGeneratedCount += len(vc.generateRequest.Status.GeneratedResources)

View file

@ -18,7 +18,13 @@ func (s *Sync) UpdatePolicyStatusWithViolationCount(policyName string, violatedR
func (vc *violationCount) updateStatus() {
vc.sync.cache.mutex.Lock()
status := vc.sync.cache.data[vc.policyName]
status, exist := vc.sync.cache.data[vc.policyName]
if !exist {
policy, _ := vc.sync.policyStore.Get(vc.policyName)
if policy != nil {
status = policy.Status
}
}
var ruleNameToViolations = make(map[string]int)
for _, rule := range vc.violatedRules {