mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
improve eventGen logging
This commit is contained in:
parent
8e0650804f
commit
61e4088a53
3 changed files with 13 additions and 8 deletions
|
@ -2,13 +2,13 @@ package event
|
|||
|
||||
import (
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||
kyvernoinformer "github.com/kyverno/kyverno/pkg/client/informers/externalversions/kyverno/v1"
|
||||
kyvernolister "github.com/kyverno/kyverno/pkg/client/listers/kyverno/v1"
|
||||
"github.com/kyverno/kyverno/pkg/constant"
|
||||
client "github.com/kyverno/kyverno/pkg/dclient"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
errors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
@ -138,7 +138,9 @@ func (gen *Generator) handleErr(err error, key interface{}) {
|
|||
}
|
||||
|
||||
gen.queue.Forget(key)
|
||||
logger.Error(err, "failed to generate event", "key", key)
|
||||
if !errors.IsNotFound(err) {
|
||||
logger.Error(err, "failed to generate event", "key", key)
|
||||
}
|
||||
}
|
||||
|
||||
func (gen *Generator) processNextWorkItem() bool {
|
||||
|
@ -184,7 +186,9 @@ func (gen *Generator) syncHandler(key Info) error {
|
|||
default:
|
||||
robj, err = gen.client.GetResource("", key.Kind, key.Namespace, key.Name)
|
||||
if err != nil {
|
||||
logger.Error(err, "failed to get resource", "kind", key.Kind, "name", key.Name, "namespace", key.Namespace)
|
||||
if !errors.IsNotFound(err) {
|
||||
logger.Error(err, "failed to get resource", "kind", key.Kind, "name", key.Name, "namespace", key.Namespace)
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,8 @@ func (wrc *WebhookRegistrationClient) RemoveWebhookConfigurations(cleanUp chan<-
|
|||
// used to forward request to kyverno webhooks to apply policeis
|
||||
// Mutationg webhook is be used for Mutating purpose
|
||||
func (wrc *WebhookRegistrationClient) CreateResourceMutatingWebhookConfiguration() error {
|
||||
logger := wrc.log
|
||||
logger := wrc.log.WithValues("kind", MutatingWebhookConfigurationKind)
|
||||
|
||||
var caData []byte
|
||||
var config *admregapi.MutatingWebhookConfiguration
|
||||
|
||||
|
@ -121,6 +122,8 @@ func (wrc *WebhookRegistrationClient) CreateResourceMutatingWebhookConfiguration
|
|||
logger.Error(err, "failed to create resource mutating webhook configuration", "name", config.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
logger.V(2).Info("created mutating webhook", "name", config.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -152,6 +155,8 @@ func (wrc *WebhookRegistrationClient) CreateResourceValidatingWebhookConfigurati
|
|||
logger.Error(err, "failed to create resource")
|
||||
return err
|
||||
}
|
||||
|
||||
logger.V(2).Info("created validating webhook", "name", config.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,6 @@ func (rww *ResourceWebhookRegister) createMutatingWebhook() {
|
|||
rww.RegisterResourceWebhook()
|
||||
return
|
||||
}
|
||||
|
||||
rww.log.V(2).Info("created mutating webhook", "name", mutatingConfigName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,8 +101,6 @@ func (rww *ResourceWebhookRegister) createValidateWebhook() {
|
|||
rww.RegisterResourceWebhook()
|
||||
return
|
||||
}
|
||||
|
||||
rww.log.V(2).Info("created validating webhook", "name", validatingConfigName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue