Documentation ¶
Index ¶
Constants ¶
const OLMConstraintType = "olm.constraint"
OLMConstraintType is the schema "type" key for all constraints known to OLM (except for legacy types).
const PropertiesKey = "properties"
PropertiesKey is the key for bundle properties map (input data for CEL evaluation)
Variables ¶
var ErrMaxConstraintSizeExceeded = fmt.Errorf("olm.constraint value is greater than max constraint size %d bytes", maxConstraintSize)
ErrMaxConstraintSizeExceeded is returned when a constraint's size > maxConstraintSize.
Functions ¶
This section is empty.
Types ¶
type Cel ¶
type Cel struct { // The CEL expression Rule string `json:"rule" yaml:"rule"` }
Cel is a struct representing CEL expression information
type CelEnvironment ¶
type CelEnvironment struct {
// contains filtered or unexported fields
}
CelEnvironment is a struct that encapsulates CEL custom program enviroment
func NewCelEnvironment ¶
func NewCelEnvironment() *CelEnvironment
NewCelEnvironment returns a CEL environment which can be used to evaluate CEL expression and an error if occurs
func (*CelEnvironment) Validate ¶
func (e *CelEnvironment) Validate(rule string) (CelProgram, error)
Validate to validate the CEL expression string by compiling it into CEL program
type CelProgram ¶
type CelProgram struct {
// contains filtered or unexported fields
}
CelProgram is a struct that encapsulates compiled CEL program
type CompoundConstraint ¶
type CompoundConstraint struct {
Constraints []Constraint `json:"constraints" yaml:"constraints"`
}
CompoundConstraint holds a list of potentially nested constraints over which a boolean operation is applied.
type Constraint ¶
type Constraint struct { // Constraint failure message that surfaces in resolution // This field is optional FailureMessage string `json:"failureMessage,omitempty" yaml:"failureMessage,omitempty"` // The cel struct that contraints CEL expression Cel *Cel `json:"cel,omitempty" yaml:"cel,omitempty"` // Package defines a constraint for a package within a version range. Package *PackageConstraint `json:"package,omitempty" yaml:"package,omitempty"` // GVK defines a constraint for a GVK. GVK *GVKConstraint `json:"gvk,omitempty" yaml:"gvk,omitempty"` // All, Any, and Not are compound constraints. See this enhancement for details: // https://github.com/operator-framework/enhancements/blob/master/enhancements/compound-bundle-constraints.md All *CompoundConstraint `json:"all,omitempty" yaml:"all,omitempty"` Any *CompoundConstraint `json:"any,omitempty" yaml:"any,omitempty"` // A note on Not: this constraint isn't particularly useful by itself. // It should be used within an All constraint alongside some other constraint type // since saying "do not use any of these GVKs/packages/etc." without an alternative // doesn't make sense. Not *CompoundConstraint `json:"not,omitempty" yaml:"not,omitempty"` }
Constraint holds parsed, potentially nested dependency constraints.
func Parse ¶
func Parse(v json.RawMessage) (c Constraint, err error)
Parse parses an olm.constraint property's value recursively into a Constraint. Unknown value schemas result in an error. Constraints that exceed the number of bytes defined by maxConstraintSize result results in an error.
type GVKConstraint ¶
type GVKConstraint struct { Group string `json:"group" yaml:"group"` Kind string `json:"kind" yaml:"kind"` Version string `json:"version" yaml:"version"` }
GVKConstraint defines a GVK constraint.
type PackageConstraint ¶
type PackageConstraint struct { // PackageName is the name of the package. PackageName string `json:"packageName" yaml:"packageName"` // VersionRange required for the package. VersionRange string `json:"versionRange" yaml:"versionRange"` }
PackageConstraint defines a package constraint.