mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-10 09:56:55 +00:00
22 lines
427 B
Go
22 lines
427 B
Go
|
package variables
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func NeedsVariable(variable string) bool {
|
||
|
return !strings.Contains(variable, "request.object") &&
|
||
|
!strings.Contains(variable, "request.operation") &&
|
||
|
!strings.Contains(variable, "element") &&
|
||
|
variable != "elementIndex"
|
||
|
}
|
||
|
|
||
|
func NeedsVariables(variables ...string) bool {
|
||
|
for _, variable := range variables {
|
||
|
if NeedsVariable(variable) {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|