1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fixed error log

This commit is contained in:
NoSkillGirl 2020-11-04 12:17:18 +05:30
parent 4a84054576
commit 6346ccc79c

View file

@ -17,7 +17,7 @@ import (
policy2 "github.com/kyverno/kyverno/pkg/policy" policy2 "github.com/kyverno/kyverno/pkg/policy"
"github.com/spf13/cobra" "github.com/spf13/cobra"
_ "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation" //_ "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation"
log "sigs.k8s.io/controller-runtime/pkg/log" log "sigs.k8s.io/controller-runtime/pkg/log"
yaml "sigs.k8s.io/yaml" yaml "sigs.k8s.io/yaml"
@ -104,6 +104,7 @@ func Command() *cobra.Command {
invalidPolicyFound := false invalidPolicyFound := false
for _, policy := range policies { for _, policy := range policies {
fmt.Println("----------------------------------------------------------------------")
err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController) err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController)
if err != nil { if err != nil {
fmt.Printf("Policy %s is invalid.\n", policy.Name) fmt.Printf("Policy %s is invalid.\n", policy.Name)
@ -137,7 +138,7 @@ func Command() *cobra.Command {
return nil return nil
}, },
} }
cmd.Flags().StringVarP(&outputType, "output", "o", "", "Prints the mutated policy") cmd.Flags().StringVarP(&outputType, "output", "o", "", "Prints the mutated policy in yaml or json format")
cmd.Flags().StringArrayVarP(&crdPaths, "crd", "c", []string{}, "Path to CRD files") cmd.Flags().StringArrayVarP(&crdPaths, "crd", "c", []string{}, "Path to CRD files")
return cmd return cmd
} }