diff --git a/pkg/engine/validate/utils.go b/pkg/engine/validate/utils.go index cd53eaa58d..1edde4a8d5 100644 --- a/pkg/engine/validate/utils.go +++ b/pkg/engine/validate/utils.go @@ -2,7 +2,6 @@ package validate import ( "container/list" - "fmt" commonAnchors "github.com/kyverno/kyverno/pkg/engine/anchor/common" ) @@ -11,7 +10,6 @@ import ( func hasNestedAnchors(pattern interface{}) bool { switch typed := pattern.(type) { case map[string]interface{}: - fmt.Println("map[string]interface{}......") if anchors := getAnchorsFromMap(typed); len(anchors) > 0 { return true } @@ -22,7 +20,6 @@ func hasNestedAnchors(pattern interface{}) bool { } return false case []interface{}: - fmt.Println("[]interface{}......") for _, value := range typed { if hasNestedAnchors(value) { return true @@ -30,7 +27,6 @@ func hasNestedAnchors(pattern interface{}) bool { } return false default: - fmt.Println("default......") return false } } @@ -38,20 +34,15 @@ func hasNestedAnchors(pattern interface{}) bool { // getSortedNestedAnchorResource - sorts anchors key func getSortedNestedAnchorResource(resources map[string]interface{}) *list.List { sortedResourceKeys := list.New() - fmt.Println("\n-----------getSortedNestedAnchorResource------------") - fmt.Println("resources: ", resources) for k, v := range resources { - fmt.Println("k: ", k, " v:", v) if commonAnchors.IsGlobalAnchor(k) { sortedResourceKeys.PushFront(k) continue } if hasNestedAnchors(v) { sortedResourceKeys.PushFront(k) - fmt.Println("PushFront") } else { sortedResourceKeys.PushBack(k) - fmt.Println("PushBack") } } return sortedResourceKeys diff --git a/pkg/engine/validate/validate.go b/pkg/engine/validate/validate.go index 31317b6b8e..979aaf55bb 100644 --- a/pkg/engine/validate/validate.go +++ b/pkg/engine/validate/validate.go @@ -36,11 +36,6 @@ func ValidateResourceWithPattern(logger logr.Logger, resource, pattern interface // and calls corresponding handler // Pattern tree and resource tree can have different structure. In this case validation fails func validateResourceElement(log logr.Logger, resourceElement, patternElement, originPattern interface{}, path string, ac *common.AnchorKey) (string, error) { - fmt.Println("\n---------------validateResourceElement--------------") - fmt.Println("resourceElement: ", resourceElement) - fmt.Println("patternElement: ", patternElement) - fmt.Println("originPattern: ", originPattern) - fmt.Println("path: ", path) switch typedPatternElement := patternElement.(type) { // map case map[string]interface{}: @@ -88,11 +83,6 @@ func validateResourceElement(log logr.Logger, resourceElement, patternElement, o // If validateResourceElement detects map element inside resource and pattern trees, it goes to validateMap // For each element of the map we must detect the type again, so we pass these elements to validateResourceElement func validateMap(log logr.Logger, resourceMap, patternMap map[string]interface{}, origPattern interface{}, path string, ac *common.AnchorKey) (string, error) { - fmt.Println("\n-------------validateMap----------------") - fmt.Println("resourceMap: ", resourceMap) - fmt.Println("patternMap: ", patternMap) - fmt.Println("origPattern: ", origPattern) - fmt.Println("path: ", path) patternMap = wildcards.ExpandInMetadata(patternMap, resourceMap) // check if there is anchor in pattern // Phase 1 : Evaluate all the anchors @@ -121,7 +111,6 @@ func validateMap(log logr.Logger, resourceMap, patternMap map[string]interface{} sortedResourceKeys := getSortedNestedAnchorResource(resources) for e := sortedResourceKeys.Front(); e != nil; e = e.Next() { key := e.Value.(string) - fmt.Println("key picked: ", key) handler := anchor.CreateElementHandler(key, resources[key], path) handlerPath, err := handler.Handle(validateResourceElement, resourceMap, origPattern, ac) if err != nil {