mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
- fix test; - improve logging
This commit is contained in:
parent
a1ce6e4297
commit
79a7bde4ab
6 changed files with 4 additions and 12 deletions
|
@ -195,7 +195,7 @@ func (pvc *PolicyViolationController) syncPolicyViolation(key string) error {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
|
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
|
||||||
defer func() {
|
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)
|
policyViolation, err := pvc.pvLister.Get(key)
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ func (gen *Generator) handleErr(err error, key interface{}) {
|
||||||
|
|
||||||
// retires requests if there is error
|
// retires requests if there is error
|
||||||
if gen.queue.NumRequeues(key) < workQueueRetryLimit {
|
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
|
// 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.
|
// queue and the re-enqueue history, the key will be processed later again.
|
||||||
gen.queue.AddRateLimited(key)
|
gen.queue.AddRateLimited(key)
|
||||||
|
|
|
@ -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())
|
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 {
|
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 {
|
if _, err := pvInterface.NamespacedPolicyViolations(newPv.Spec.ResourceSpec.Namespace).Create(&newPv); err != nil {
|
||||||
|
|
|
@ -187,7 +187,7 @@ func (pvc *NamespacedPolicyViolationController) syncPolicyViolation(key string)
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
|
glog.V(4).Infof("Started syncing policy violation %q (%v)", key, startTime)
|
||||||
defer func() {
|
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
|
// tags: NAMESPACE/NAME
|
||||||
|
|
|
@ -14,10 +14,6 @@ expected:
|
||||||
name: pod-with-emptydir
|
name: pod-with-emptydir
|
||||||
rules:
|
rules:
|
||||||
- name: annotate-empty-dir
|
- name: annotate-empty-dir
|
||||||
type: Mutation
|
|
||||||
success: true
|
|
||||||
message: "successfully processed overlay"
|
|
||||||
- name: annotate-host-path
|
|
||||||
type: Mutation
|
type: Mutation
|
||||||
success: true
|
success: true
|
||||||
message: "successfully processed overlay"
|
message: "successfully processed overlay"
|
|
@ -14,10 +14,6 @@ expected:
|
||||||
name: pod-with-hostpath
|
name: pod-with-hostpath
|
||||||
rules:
|
rules:
|
||||||
- name: annotate-empty-dir
|
- name: annotate-empty-dir
|
||||||
type: Mutation
|
|
||||||
success: true
|
|
||||||
message: "successfully processed overlay"
|
|
||||||
- name: annotate-host-path
|
|
||||||
type: Mutation
|
type: Mutation
|
||||||
success: true
|
success: true
|
||||||
message: "successfully processed overlay"
|
message: "successfully processed overlay"
|
Loading…
Add table
Reference in a new issue