1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
This commit is contained in:
shivkumar dudhani 2020-02-14 12:25:13 -08:00
parent 3fbfa251ad
commit eec0decae7
2 changed files with 1 additions and 4 deletions

View file

@ -80,17 +80,14 @@ func subVal(ctx context.EvalInterface, valuePattern interface{}, path string, er
// default or operator.Equal
// equal + string value
// object variable
valuePattern = value
return value
}
// operator + string variable
switch value.(type) {
case string:
valuePattern = string(operatorVariable) + value.(string)
return string(operatorVariable) + value.(string)
default:
glog.Infof("cannot use operator with object variables. operator used %s in pattern %v", string(operatorVariable), valuePattern)
valuePattern = emptyInterface
return emptyInterface
}

View file

@ -51,7 +51,7 @@ func ContainsUserInfo(policy kyverno.ClusterPolicy) error {
return fmt.Errorf("userInfo variable used at spec/rules[%d]/validate/pattern", idx)
}
for idx2, pattern := range rule.Validation.AnyPattern {
if pattern, err = variables.SubstituteVars(ctx, pattern); err != nil {
if rule.Validation.AnyPattern[idx2], err = variables.SubstituteVars(ctx, pattern); err != nil {
return fmt.Errorf("userInfo variable used at spec/rules[%d]/validate/anyPattern[%d]", idx, idx2)
}
}