1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-30 03:15:05 +00:00

786 tested prototype

This commit is contained in:
shravan 2020-04-09 22:00:24 +05:30
parent b3b715c526
commit 49e26aface

View file

@ -30,9 +30,17 @@ func SubstituteVars(log logr.Logger, ctx context.EvalInterface, pattern interfac
func subVars(log logr.Logger, ctx context.EvalInterface, pattern interface{}, path string, errs *[]error) interface{} {
switch typedPattern := pattern.(type) {
case map[string]interface{}:
return subMap(log, ctx, typedPattern, path, errs)
mapCopy := make(map[string]interface{})
for k, v := range typedPattern {
mapCopy[k] = v
}
return subMap(log, ctx, mapCopy, path, errs)
case []interface{}:
return subArray(log, ctx, typedPattern, path, errs)
sliceCopy := make([]interface{}, len(typedPattern))
copy(sliceCopy, typedPattern)
return subArray(log, ctx, sliceCopy, path, errs)
case string:
return subValR(log, ctx, typedPattern, path, errs)
default: