From c5dbb572c2e6aee0c3f0cc3f98866cc2f184a703 Mon Sep 17 00:00:00 2001 From: Mariam Fahmy Date: Tue, 17 Oct 2023 19:08:44 +0300 Subject: [PATCH] remove duplicated log messages (#8673) Signed-off-by: Mariam Fahmy --- pkg/engine/jmespath/functions_test.go | 2 +- pkg/utils/image/infos.go | 21 +-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/pkg/engine/jmespath/functions_test.go b/pkg/engine/jmespath/functions_test.go index 22408814f8..6e83391943 100644 --- a/pkg/engine/jmespath/functions_test.go +++ b/pkg/engine/jmespath/functions_test.go @@ -1665,7 +1665,7 @@ func Test_ImageNormalize(t *testing.T) { assert.NilError(t, err) result, err := jp.Search("") if tc.wantErr { - assert.Error(t, err, "JMESPath function 'image_normalize': bad image: docker.io/: invalid reference format") + assert.Error(t, err, "JMESPath function 'image_normalize': bad image: docker.io/, defaultRegistry: docker.io, enableDefaultRegistryMutation: true: invalid reference format") } else { assert.NilError(t, err) res, ok := result.(string) diff --git a/pkg/utils/image/infos.go b/pkg/utils/image/infos.go index f1ad8780c2..b872bab258 100644 --- a/pkg/utils/image/infos.go +++ b/pkg/utils/image/infos.go @@ -6,11 +6,8 @@ import ( "github.com/distribution/distribution/reference" "github.com/kyverno/kyverno/pkg/config" - "github.com/kyverno/kyverno/pkg/logging" ) -var logger = logging.WithName("image") - type ImageInfo struct { // Registry is the URL address of the image registry e.g. `docker.io` Registry string `json:"registry,omitempty"` @@ -51,17 +48,11 @@ func (i *ImageInfo) ReferenceWithTag() string { } func GetImageInfo(image string, cfg config.Configuration) (*ImageInfo, error) { - logger.V(3).Info( - "getting the image info", - "image", image, - "defaultRegistry", config.Configuration.GetDefaultRegistry(cfg), - "enableDefaultRegistryMutation", config.Configuration.GetEnableDefaultRegistryMutation(cfg), - ) // adding the default domain in order to properly parse image info fullImageName := addDefaultRegistry(image, cfg) ref, err := reference.Parse(fullImageName) if err != nil { - return nil, fmt.Errorf("bad image: %s: %w", fullImageName, err) + return nil, fmt.Errorf("bad image: %s, defaultRegistry: %s, enableDefaultRegistryMutation: %t: %w", fullImageName, config.Configuration.GetDefaultRegistry(cfg), config.Configuration.GetEnableDefaultRegistryMutation(cfg), err) } var registry, path, name, tag, digest string @@ -86,16 +77,6 @@ func GetImageInfo(image string, cfg config.Configuration) (*ImageInfo, error) { registry = "" } - logger.V(3).Info( - "getting the image info", - "image", image, - "registry", registry, - "name", name, - "path", path, - "tag", tag, - "digest", digest, - ) - return &ImageInfo{ Registry: registry, Name: name,