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

substitute variable values on a copy of policy rule (#669)

This commit is contained in:
Shivkumar Dudhani 2020-02-03 11:59:34 -08:00 committed by GitHub
parent ad9d82b215
commit 2bba55e211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -266,7 +266,10 @@ func handleData(ruleName string, generateRule kyverno.Generation, client *dclien
return nil, NewViolation(ruleName, fmt.Errorf("path not present in generate data: %s", invalidPaths))
}
newData := variables.SubstituteVariables(ctx, generateRule.Data)
//work on copy
copyDataTemp := reflect.Indirect(reflect.ValueOf(generateRule.Data))
copyData := copyDataTemp.Interface()
newData := variables.SubstituteVariables(ctx, copyData)
// check if resource exists
obj, err := client.GetResource(generateRule.Kind, generateRule.Namespace, generateRule.Name)