mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
small issue while resolving conflicts
This commit is contained in:
parent
70b13d06dc
commit
afb6ad714c
2 changed files with 6 additions and 4 deletions
|
@ -9,9 +9,9 @@ import (
|
|||
"github.com/go-openapi/spec"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||
"github.com/googleapis/gnostic/compiler"
|
||||
yaml_v2 "gopkg.in/yaml.v2"
|
||||
//openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||
//"github.com/googleapis/gnostic/compiler"
|
||||
//yaml_v2 "gopkg.in/yaml.v2"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -278,6 +278,7 @@ func ValidatePolicyAgainstCrd(policy *v1.ClusterPolicy, path string) error {
|
|||
|
||||
openV3schema := crdDefinitionPrior.Spec.Validation.OpenAPIV3Schema
|
||||
crdName := crdDefinitionPrior.Spec.Names.Kind
|
||||
fmt.Println(crdName)
|
||||
|
||||
if openV3schema == nil {
|
||||
_ = json.Unmarshal(crdRaw, &crdDefinitionNew)
|
||||
|
@ -306,6 +307,7 @@ func ValidatePolicyAgainstCrd(policy *v1.ClusterPolicy, path string) error {
|
|||
_ = json.Unmarshal(schemaRaw, schema)
|
||||
|
||||
input := map[string]interface{}{}
|
||||
fmt.Println(input)
|
||||
|
||||
// JSON data to validate
|
||||
//inputJSON := `{"name": "Ivan","address-1": "sesame street"}`
|
||||
|
|
|
@ -58,7 +58,7 @@ func Command() *cobra.Command {
|
|||
|
||||
// if crd is passed, then validate policy against the crd
|
||||
if crdPath != "" {
|
||||
err := common.ValidatePolicyAgainstCrd(*policy, crdPath)
|
||||
err := common.ValidatePolicyAgainstCrd(policy, crdPath)
|
||||
if err != nil {
|
||||
log.Log.Error(err, "policy "+policy.Name+" is invalid")
|
||||
os.Exit(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue