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)
- func VetValidatingAdmissionPolicyWith(rp yamlkit.ResourceProvider, options *api.FunctionOptions, ...) (gaby.Container, any, error)
- type AdmissionPolicyInputs
- 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 ParamsOtherDataKey = api.OtherDataSource("params")
ParamsOtherDataKey is the key of the OtherData vet-validating-admission-policy also finds a binding's params in, after the policy Unit: a Unit of params kept apart from the policies, so that the policies can be replaced without losing what was set in them.
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, as created.
func VetValidatingAdmissionPolicyWith ¶ added in v0.11.3
func VetValidatingAdmissionPolicyWith(rp yamlkit.ResourceProvider, options *api.FunctionOptions, parsedData gaby.Container, inputs AdmissionPolicyInputs) (gaby.Container, any, error)
VetValidatingAdmissionPolicyWith evaluates the ValidatingAdmissionPolicies inputs selects against each resource of parsedData, as an update of the same resource in inputs.Released or, when that has none, as its creation.
Types ¶
type AdmissionPolicyInputs ¶ added in v0.11.3
type AdmissionPolicyInputs struct {
// Policy is the data of the Unit holding the policies and their bindings.
Policy gaby.Container
// Params is the data of a Unit holding params, which a binding's paramRef finds after any in
// Policy. Optional.
Params gaby.Container
// Released is the data of the Unit's last released revision, whose resources are the
// oldObjects of the ones being validated. Optional: without it, every resource is created.
Released gaby.Container
// Include names the policies to evaluate, all of them when empty; Exclude, those not to.
Include, Exclude []string
}
AdmissionPolicyInputs is what vet-validating-admission-policy evaluates a Unit's resources with, besides the resources themselves.
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)