1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

add warning message; remove existence anchor check in mutation

This commit is contained in:
Shuting Zhao 2019-11-04 19:23:48 -08:00
parent 86c00a8f30
commit d9335a5f8c
2 changed files with 3 additions and 2 deletions

View file

@ -42,6 +42,7 @@ func checkConditions(resource, overlay interface{}, path string) (string, error)
default:
// anchor on non map/array is invalid:
// - anchor defined on values
glog.Warningln("Found invalid conditional anchor: anchor defined on values")
return "", nil
}
}

View file

@ -210,12 +210,12 @@ func ParseNamespaceFromObject(bytes []byte) string {
return ""
}
// Validation
// getAnchorsFromMap gets the conditional anchor map
func getAnchorsFromMap(anchorsMap map[string]interface{}) map[string]interface{} {
result := make(map[string]interface{})
for key, value := range anchorsMap {
if anchor.IsConditionAnchor(key) || anchor.IsExistanceAnchor(key) {
if anchor.IsConditionAnchor(key) {
result[key] = value
}
}