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:
parent
4a84054576
commit
6346ccc79c
1 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,7 @@ import (
|
|||
policy2 "github.com/kyverno/kyverno/pkg/policy"
|
||||
"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"
|
||||
yaml "sigs.k8s.io/yaml"
|
||||
|
@ -104,6 +104,7 @@ func Command() *cobra.Command {
|
|||
|
||||
invalidPolicyFound := false
|
||||
for _, policy := range policies {
|
||||
fmt.Println("----------------------------------------------------------------------")
|
||||
err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController)
|
||||
if err != nil {
|
||||
fmt.Printf("Policy %s is invalid.\n", policy.Name)
|
||||
|
@ -137,7 +138,7 @@ func Command() *cobra.Command {
|
|||
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")
|
||||
return cmd
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue