mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* initial commit * variable substitution * update tests * update test * refactor engine packages for validate & generate * update vendor * update toml * support variable substitution in overlay mutation * missing update * fix indentation in logs * store context values as single JSON document using merge patches. * remove duplicate functions * fix message string * Handle processing of policies in background (#569) * remove condition check while generating mutation patch as conditions are verified in the first iteration * initial commit * background policy validation * correct message * skip non-background policy process for add/update * fix order to correct policy registration * update comment Co-authored-by: shuting <shutting06@gmail.com> * refactor Co-authored-by: shuting <shutting06@gmail.com>
51 lines
1,009 B
Go
51 lines
1,009 B
Go
package operator
|
|
|
|
// Operator is string alias that represents selection operators enum
|
|
type Operator string
|
|
|
|
const (
|
|
// Equal stands for ==
|
|
Equal Operator = ""
|
|
// MoreEqual stands for >=
|
|
MoreEqual Operator = ">="
|
|
// LessEqual stands for <=
|
|
LessEqual Operator = "<="
|
|
// NotEqual stands for !
|
|
NotEqual Operator = "!"
|
|
// More stands for >
|
|
More Operator = ">"
|
|
// Less stands for <
|
|
Less Operator = "<"
|
|
)
|
|
|
|
const relativePrefix Operator = "./"
|
|
const ReferenceSign Operator = "$()"
|
|
|
|
// getOperatorFromStringPattern parses opeartor from pattern
|
|
func GetOperatorFromStringPattern(pattern string) Operator {
|
|
if len(pattern) < 2 {
|
|
return Equal
|
|
}
|
|
|
|
if pattern[:len(MoreEqual)] == string(MoreEqual) {
|
|
return MoreEqual
|
|
}
|
|
|
|
if pattern[:len(LessEqual)] == string(LessEqual) {
|
|
return LessEqual
|
|
}
|
|
|
|
if pattern[:len(More)] == string(More) {
|
|
return More
|
|
}
|
|
|
|
if pattern[:len(Less)] == string(Less) {
|
|
return Less
|
|
}
|
|
|
|
if pattern[:len(NotEqual)] == string(NotEqual) {
|
|
return NotEqual
|
|
}
|
|
|
|
return Equal
|
|
}
|