Documentation ¶
Overview ¶
Package filter contains methods for selecting and filtering lists of components and objects.
Index ¶
- func MatchesComponent(c *bundle.Component, o *Options) bool
- func MatchesObject(obj *unstructured.Unstructured, o *Options) bool
- type Filter
- func (f *Filter) FilterComponents(data []*bundle.Component, o *Options) []*bundle.Component
- func (f *Filter) FilterObjects(data []*unstructured.Unstructured, o *Options) []*unstructured.Unstructured
- func (f *Filter) PartitionComponents(data []*bundle.Component, o *Options) ([]*bundle.Component, []*bundle.Component)
- func (f *Filter) PartitionObjects(data []*unstructured.Unstructured, o *Options) ([]*unstructured.Unstructured, []*unstructured.Unstructured)
- func (f *Filter) SelectComponents(data []*bundle.Component, o *Options) []*bundle.Component
- func (f *Filter) SelectObjects(data []*unstructured.Unstructured, o *Options) []*unstructured.Unstructured
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesComponent ¶ added in v0.11.0
MatchesComponent returns true if the conditions match a Component.
func MatchesObject ¶ added in v0.11.0
func MatchesObject(obj *unstructured.Unstructured, o *Options) bool
MatchesObject returns true if the conditions match an object.
Types ¶
type Filter ¶ added in v0.6.1
type Filter struct{}
Filter filters the components and objects to produce a new set of components.
func (*Filter) FilterComponents ¶ added in v0.11.0
FilterComponents removes components based on the ObjectMeta properties of the components, returning a new cluster bundle with just filtered components. Filtering for components doesn't take into account the properties of the object-children of the components. This is the opposite matching from SelectComponents.
func (*Filter) FilterObjects ¶ added in v0.11.0
func (f *Filter) FilterObjects(data []*unstructured.Unstructured, o *Options) []*unstructured.Unstructured
FilterObjects removes objects based on the ObjectMeta properties of the objects, returning a new list with just filtered objects. This performs the opposite match from SelectObjects.
func (*Filter) PartitionComponents ¶ added in v0.11.0
func (f *Filter) PartitionComponents(data []*bundle.Component, o *Options) ([]*bundle.Component, []*bundle.Component)
PartitionComponents splits the components into matched and not matched sets. PartitionComponents ignores the InvertMatch option, since both matched and unmatched objects are returned. Thus, the options to partition are always treated as options for matching objects.
func (*Filter) PartitionObjects ¶ added in v0.9.0
func (f *Filter) PartitionObjects(data []*unstructured.Unstructured, o *Options) ([]*unstructured.Unstructured, []*unstructured.Unstructured)
PartitionObjects splits the objects into matched and not matched sets. PartitionObjects ignores the KeepOnly option, since both matched and unmatched objects are returned. Thus, the options to partition are always treated as options for matching objects.
func (*Filter) SelectComponents ¶ added in v0.11.0
SelectComponents picks components based on the ObjectMeta properties of the components, returning a new cluster bundle with just filtered components. Filtering for components doesn't take into account the properties of the object-children of the components. This performs the opposte matching from FilterComponents.
func (*Filter) SelectObjects ¶ added in v0.11.0
func (f *Filter) SelectObjects(data []*unstructured.Unstructured, o *Options) []*unstructured.Unstructured
SelectObjects picks objects based on the ObjectMeta properties of the objects, returning a new list with just filtered objects.
type Options ¶
type Options struct { // Kinds represent the Kinds to filter on. Can either be unqualified ("Deployment") // or qualified ("apps/v1beta1,Pod"). Qualified kinds are often called // GroupVersionKind in the Kubernetes Schema. Kinds []string // Names represent the names to filter on. For objects, this is the // metadata.name field. For components, this is the ComponentName. Names []string // Annotations contain key/value pairs to filter on. An empty string value matches // all annotation-values for a particular key. Annotations map[string]string // Labels contain key/value pairs to filter on. An empty string value matches // all label-values for a particular key. Labels map[string]string // Namespaces to filter on. Namespaces []string // InvertMatch indicates wether to return the opposite match. InvertMatch bool }
Options for filtering bundles. By default, if any of the options match, then the relevant component or object is removed. If InvertMatch is set, then the objects are kept instead of removed.
func OptionsFromObjectSelector ¶ added in v0.11.0
func OptionsFromObjectSelector(sel *bundle.ObjectSelector) *Options
OptionsFromObjectSelector creates an Options Object from a