1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-29 10:55:05 +00:00

- fix test; - improve logging

This commit is contained in:
Shuting Zhao 2019-11-13 18:44:18 -08:00
parent a1ce6e4297
commit 79a7bde4ab
6 changed files with 4 additions and 12 deletions

View file

@ -195,7 +195,7 @@ func (pvc *PolicyViolationController) syncPolicyViolation(key string) error {
startTime := time.Now()
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
defer func() {
glog.V(4).Infof("Finished syncing policy violation %q (%v)", key, time.Since(startTime))
glog.V(4).Infof("Finished syncing cluster policy violation %q (%v)", key, time.Since(startTime))
}()
policyViolation, err := pvc.pvLister.Get(key)
if errors.IsNotFound(err) {

View file

@ -149,7 +149,7 @@ func (gen *Generator) handleErr(err error, key interface{}) {
// retires requests if there is error
if gen.queue.NumRequeues(key) < workQueueRetryLimit {
glog.Warningf("Error syncing policy violation %v: %v", key, err)
glog.V(4).Infof("Error syncing policy violation %v: %v", key, err)
// Re-enqueue the key rate limited. Based on the rate limiter on the
// queue and the re-enqueue history, the key will be processed later again.
gen.queue.AddRateLimited(key)

View file

@ -77,7 +77,7 @@ func createNamespacedPV(dclient *dclient.Client, pvLister kyvernolister.Namespac
glog.V(4).Infof("creating new namespaced policy violation for policy %s & resource %s", newPv.Spec.Policy, newPv.Spec.ResourceSpec.ToKey())
if err := retryGetResource(dclient, newPv.Spec.ResourceSpec); err != nil {
return fmt.Errorf("failed to get resource for policy violation '%s': %v", curPv.Name, err)
return fmt.Errorf("failed to get resource for policy violation on resource '%s': %v", newPv.Spec.ResourceSpec.ToKey(), err)
}
if _, err := pvInterface.NamespacedPolicyViolations(newPv.Spec.ResourceSpec.Namespace).Create(&newPv); err != nil {

View file

@ -187,7 +187,7 @@ func (pvc *NamespacedPolicyViolationController) syncPolicyViolation(key string)
startTime := time.Now()
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
defer func() {
glog.V(4).Infof("Finished syncing policy violation %q (%v)", key, time.Since(startTime))
glog.V(4).Infof("Finished syncing namespaced policy violation %q (%v)", key, time.Since(startTime))
}()
// tags: NAMESPACE/NAME

View file

@ -14,10 +14,6 @@ expected:
name: pod-with-emptydir
rules:
- name: annotate-empty-dir
type: Mutation
success: true
message: "successfully processed overlay"
- name: annotate-host-path
type: Mutation
success: true
message: "successfully processed overlay"

View file

@ -14,10 +14,6 @@ expected:
name: pod-with-hostpath
rules:
- name: annotate-empty-dir
type: Mutation
success: true
message: "successfully processed overlay"
- name: annotate-host-path
type: Mutation
success: true
message: "successfully processed overlay"