mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 10:04:25 +00:00
fix principal and role variables are not substituted (#5000)
This commit is contained in:
parent
ea1b64ab08
commit
f3e40efcd7
1 changed files with 11 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
||||
"github.com/kyverno/kyverno/pkg/autogen"
|
||||
|
@ -51,6 +54,14 @@ func checkForRBACInfo(rule kyvernov1.Rule) bool {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if bytes, err := json.Marshal(rule); err != nil {
|
||||
return false
|
||||
} else {
|
||||
if strings.Contains(string(bytes), "request.roles") || strings.Contains(string(bytes), "request.clusterRoles") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue