Documentation ¶
Index ¶
- Variables
- func ConditionsToJSONObject(conditions []*kyverno.AnyAllConditions) ([]map[string]interface{}, error)
- func DefaultVariableResolver(ctx context.EvalInterface, variable string) (interface{}, error)
- func DocumentToUntyped(doc interface{}) (interface{}, error)
- func Evaluate(log logr.Logger, ctx context.EvalInterface, condition kyverno.Condition) bool
- func EvaluateAnyAllConditions(log logr.Logger, ctx context.EvalInterface, ...) bool
- func EvaluateConditions(log logr.Logger, ctx context.EvalInterface, conditions interface{}) bool
- func FindAndShiftReferences(log logr.Logger, value, shift, pivot string) string
- func IsReference(value string) bool
- func IsVariable(value string) bool
- func JSONObjectToConditions(data interface{}) ([]*kyverno.AnyAllConditions, error)
- func ReplaceAllVars(src string, repl func(string) string) string
- func SubstituteAll(log logr.Logger, ctx context.EvalInterface, document interface{}) (_ interface{}, err error)
- func SubstituteAllForceMutate(log logr.Logger, ctx *context.Context, typedRule kyverno.Rule) (_ kyverno.Rule, err error)
- func SubstituteAllInConditions(log logr.Logger, ctx context.EvalInterface, ...) ([]*kyverno.AnyAllConditions, error)
- func SubstituteAllInPreconditions(log logr.Logger, ctx context.EvalInterface, document interface{}) (_ interface{}, err error)
- func SubstituteAllInRule(log logr.Logger, ctx context.EvalInterface, typedRule kyverno.Rule) (_ kyverno.Rule, err error)
- func UntypedToRule(untyped interface{}) (kyverno.Rule, error)
- func ValidateElementInForEach(log logr.Logger, rule interface{}) (interface{}, error)
- type NotResolvedReferenceErr
- type VariableResolver
Constants ¶
This section is empty.
Variables ¶
var RegexEscpReferences = regexp.MustCompile(`\\\$\(.[^\ ]*\)`)
RegexEscpReferences is the Regex for '\$(...)'
var RegexEscpVariables = regexp.MustCompile(`\\\{\{(\{[^{}]*\}|[^{}])*\}\}`)
var RegexReferences = regexp.MustCompile(`^\$\(.[^\ ]*\)|[^\\]\$\(.[^\ ]*\)`)
RegexReferences is the Regex for '$(...)' at the beginning of the string, and 'x$(...)' where 'x' is not '\'
var RegexVariables = regexp.MustCompile(`^\{\{(\{[^{}]*\}|[^{}])*\}\}|[^\\]\{\{(\{[^{}]*\}|[^{}])*\}\}`)
Functions ¶
func ConditionsToJSONObject ¶ added in v1.5.0
func ConditionsToJSONObject(conditions []*kyverno.AnyAllConditions) ([]map[string]interface{}, error)
func DefaultVariableResolver ¶ added in v1.4.2
func DefaultVariableResolver(ctx context.EvalInterface, variable string) (interface{}, error)
DefaultVariableResolver is used in all variable substitutions except preconditions
func DocumentToUntyped ¶ added in v1.6.0
func DocumentToUntyped(doc interface{}) (interface{}, error)
func EvaluateAnyAllConditions ¶ added in v1.5.0
func EvaluateAnyAllConditions(log logr.Logger, ctx context.EvalInterface, conditions []*kyverno.AnyAllConditions) bool
func EvaluateConditions ¶
func EvaluateConditions(log logr.Logger, ctx context.EvalInterface, conditions interface{}) bool
EvaluateConditions evaluates all the conditions present in a slice, in a backwards compatible way
func FindAndShiftReferences ¶ added in v1.3.5
func IsReference ¶ added in v1.3.5
IsReference returns true if the element contains a 'valid' reference $()
func IsVariable ¶ added in v1.2.0
IsVariable returns true if the element contains a 'valid' variable {{}}
func JSONObjectToConditions ¶ added in v1.5.0
func JSONObjectToConditions(data interface{}) ([]*kyverno.AnyAllConditions, error)
func ReplaceAllVars ¶ added in v1.3.5
ReplaceAllVars replaces all variables with the value defined in the replacement function This is used to avoid validation errors
func SubstituteAll ¶ added in v1.3.5
func SubstituteAll(log logr.Logger, ctx context.EvalInterface, document interface{}) (_ interface{}, err error)
SubstituteAll substitutes variables and references in the document. The document must be JSON data i.e. string, []interface{}, map[string]interface{}
func SubstituteAllForceMutate ¶ added in v1.3.5
func SubstituteAllInConditions ¶ added in v1.5.0
func SubstituteAllInConditions(log logr.Logger, ctx context.EvalInterface, conditions []*kyverno.AnyAllConditions) ([]*kyverno.AnyAllConditions, error)
func SubstituteAllInPreconditions ¶ added in v1.4.2
func SubstituteAllInPreconditions(log logr.Logger, ctx context.EvalInterface, document interface{}) (_ interface{}, err error)
func SubstituteAllInRule ¶ added in v1.3.5
func UntypedToRule ¶ added in v1.3.5
func ValidateElementInForEach ¶ added in v1.5.0
Types ¶
type NotResolvedReferenceErr ¶ added in v1.3.5
type NotResolvedReferenceErr struct {
// contains filtered or unexported fields
}
NotResolvedReferenceErr is returned when it is impossible to resolve the variable
func (NotResolvedReferenceErr) Error ¶ added in v1.3.5
func (n NotResolvedReferenceErr) Error() string
type VariableResolver ¶ added in v1.4.2
type VariableResolver = func(ctx context.EvalInterface, variable string) (interface{}, error)
VariableResolver defines the handler function for variable substitution