mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 10:55:05 +00:00
I have applied notes from review
This commit is contained in:
parent
a6bb4b8564
commit
12c5274718
1 changed files with 14 additions and 2 deletions
|
@ -73,7 +73,13 @@ func Validate(policy kubepolicy.Policy, rawResource []byte, gvk metav1.GroupVers
|
|||
}
|
||||
|
||||
func validateMap(resourcePart, patternPart interface{}) bool {
|
||||
pattern := patternPart.(map[string]interface{})
|
||||
pattern, ok := patternPart.(map[string]interface{})
|
||||
|
||||
if !ok {
|
||||
fmt.Printf("Validating error: expected Map, found %T\n", patternPart)
|
||||
return false
|
||||
}
|
||||
|
||||
resource, ok := resourcePart.(map[string]interface{})
|
||||
|
||||
if !ok {
|
||||
|
@ -95,7 +101,13 @@ func validateMap(resourcePart, patternPart interface{}) bool {
|
|||
}
|
||||
|
||||
func validateArray(resourcePart, patternPart interface{}) bool {
|
||||
patternArray := patternPart.([]interface{})
|
||||
patternArray, ok := patternPart.([]interface{})
|
||||
|
||||
if !ok {
|
||||
fmt.Printf("Validating error: expected array, found %T\n", patternPart)
|
||||
return false
|
||||
}
|
||||
|
||||
resourceArray, ok := resourcePart.([]interface{})
|
||||
|
||||
if !ok {
|
||||
|
|
Loading…
Add table
Reference in a new issue