Documentation
¶
Index ¶
- Constants
- func ContextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc)
- func ContextWithTrace(ctx context.Context, trace *utiltrace.Trace) context.Context
- func ResourceMatchSelectors(resource *unstructured.Unstructured, ...) bool
- func ResourceMatches(resource *unstructured.Unstructured, rs policyv1alpha1.ResourceSelector) bool
- func TraceFromContext(ctx context.Context) *utiltrace.Trace
Constants ¶
View Source
const ( // AppliedOverrides is the annotation which used to record override items an object applied. // The overrides items should be sorted alphabetically in ascending order by OverridePolicy's name. AppliedOverrides = "policy.kcloudlabs.io/applied-overrides" // AppliedClusterOverrides is the annotation which used to record override items an object applied. // The overrides items should be sorted alphabetically in ascending order by ClusterOverridePolicy's name. AppliedClusterOverrides = "policy.kcloudlabs.io/applied-cluster-overrides" )
Define annotations used by k-cloud-labs
View Source
const ( // ObjectParameterName is the object parameter name defined in cue ObjectParameterName = "object" // OldObjectParameterName is the old object parameter name defined in cue, only used with "Update" operation for validate policy OldObjectParameterName = "oldObject" // DataParameterName is a collection of cue params, including object, oldObject and extraParams. DataParameterName = "data" // OverrideOutputName is the output name defined in cue for override policy OverrideOutputName = "patches" // ValidateOutputName is the output name defined in cue for validate policy ValidateOutputName = "validate" )
Define cue parameter and output name
View Source
const (
// SpecField indicates the 'spec' field of a resource
SpecField = "spec"
)
Define resource filed
Variables ¶
This section is empty.
Functions ¶
func ContextForChannel ¶
func ContextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc)
ContextForChannel derives a child context from a parent channel.
The derived context's Done channel is closed when the returned cancel function is called or when the parent channel is closed, whichever happens first.
Note the caller must *always* call the CancelFunc, otherwise resources may be leaked.
func ContextWithTrace ¶ added in v0.4.4
ContextWithTrace return a new context with trace as value.
func ResourceMatchSelectors ¶
func ResourceMatchSelectors(resource *unstructured.Unstructured, selectors ...policyv1alpha1.ResourceSelector) bool
ResourceMatchSelectors tells if the specific resource matches the selectors.
func ResourceMatches ¶
func ResourceMatches(resource *unstructured.Unstructured, rs policyv1alpha1.ResourceSelector) bool
ResourceMatches tells if the specific resource matches the selector.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.