mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 10:04:25 +00:00
fixed context variable
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
parent
62d2df8b63
commit
2dc1f1dc3c
1 changed files with 1 additions and 1 deletions
|
@ -779,7 +779,7 @@ func validateRuleContext(rule kyverno.Rule) error {
|
|||
ruleBytes, _ := json.Marshal(rule)
|
||||
ruleString := strings.ReplaceAll(string(ruleBytes), " ", "")
|
||||
for _, contextName := range contextNames {
|
||||
if !strings.Contains(ruleString, fmt.Sprintf("{{"+contextName)) {
|
||||
if !strings.Contains(ruleString, fmt.Sprintf("{{"+contextName)) && !strings.Contains(ruleString, fmt.Sprintf("{{\\\""+contextName)) {
|
||||
return fmt.Errorf("context variable `%s` is not used in the policy", contextName)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue