Documentation
¶
Index ¶
- Constants
- func InitSchemaFinder() error
- func K8sCELEnvOpts() []cel.EnvOption
- func RegisterFunctions(rp *k8skit.K8sResourceProviderType, fh handler.FunctionRegistry)
- func VetValidatingAdmissionPolicy(rp yamlkit.ResourceProvider, options *api.FunctionOptions, ...) (gaby.Container, any, error)
- type ResourceQuantityComparison
- type SchemaFinder
- type SchemaInfo
Constants ¶
const AttributeNameAnnotationValue = api.AttributeNameAnnotationValue
const AttributeNameLabelValue = api.AttributeNameLabelValue
const AttributeNameMetadataName = api.AttributeName("metadata-name")
const AttributeNameNamespaceNameReference = api.AttributeName("namespace-name-reference")
const (
AttributeNameWorkloadLabels = k8skit.AttributeNameWorkloadLabels
)
The attributes carrying pod labels are declared in k8skit, beside the specs that say where they live. workload-labels is the group standing for both.
const PolicyOtherDataKey = api.OtherDataSource("policy")
PolicyOtherDataKey is the key of the OtherData vet-validating-admission-policy reads its ValidatingAdmissionPolicies from.
Variables ¶
This section is empty.
Functions ¶
func InitSchemaFinder ¶
func InitSchemaFinder() error
func K8sCELEnvOpts ¶ added in v0.2.8
K8sCELEnvOpts returns the additional CEL environment options that provide Kubernetes-specific CEL libraries matching the admission policy environment. This includes quantity(), url(), ip(), cidr(), regex(), and format() functions.
It is exported so that callers evaluating CEL against Kubernetes configuration outside the function executor -- such as a server-side View column read from stored JSON -- get the same environment the get-cel function provides.
func RegisterFunctions ¶
func RegisterFunctions(rp *k8skit.K8sResourceProviderType, fh handler.FunctionRegistry)
RegisterFunctions registers all Kubernetes functions onto the provided FunctionHandler using the given registrar's resource provider.
func VetValidatingAdmissionPolicy ¶ added in v0.11.0
func VetValidatingAdmissionPolicy(rp yamlkit.ResourceProvider, options *api.FunctionOptions, parsedData, policyData gaby.Container) (gaby.Container, any, error)
VetValidatingAdmissionPolicy evaluates the ValidatingAdmissionPolicies policyData holds, the data of the Unit passed as OtherData policy, against each resource of parsedData.
Types ¶
type ResourceQuantityComparison ¶
type ResourceQuantityComparison struct {
// contains filtered or unexported fields
}
ResourceQuantityComparison implements CustomStringComparator for Kubernetes resource quantities
func NewResourceQuantityComparison ¶
func NewResourceQuantityComparison() *ResourceQuantityComparison
NewResourceQuantityComparison creates a new ResourceQuantityComparison instance
func (*ResourceQuantityComparison) Evaluate ¶
func (r *ResourceQuantityComparison) Evaluate(expr *api.RelationalExpression, value string) (bool, error)
Evaluate implements CustomStringComparator.Evaluate
func (*ResourceQuantityComparison) MatchesPath ¶
func (r *ResourceQuantityComparison) MatchesPath(path string) bool
MatchesPath implements CustomStringComparator.MatchesPath
type SchemaFinder ¶
type SchemaFinder struct {
// contains filtered or unexported fields
}
func NewSchemaFinder ¶
func NewSchemaFinder() (*SchemaFinder, error)
func (*SchemaFinder) LookupPath ¶
func (e *SchemaFinder) LookupPath(gvkString, fieldPath string) (*SchemaInfo, error)
type SchemaInfo ¶
type SchemaInfo struct {
Description string
}
func LookupPath ¶
func LookupPath(gvkString, fieldPath string) (*SchemaInfo, error)