find

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package find provides methods for searching through Bundles the contained components and configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllImages

type AllImages struct {
	ContainerImages []*ContainerImage
}

AllImages returns all images found -- both container images and OS images for nodes.

func (*AllImages) Flattened

func (a *AllImages) Flattened() *AllImagesFlattened

Flattened turns an AllImages struct with image information into a struct containing lists of strings. All duplicates are removed.

type AllImagesFlattened

type AllImagesFlattened struct {
	ContainerImages []string `json:"containerImages"`
}

AllImagesFlattened contains images found, but flattened into lists of strings.

type ComponentFinder

type ComponentFinder struct {
	// contains filtered or unexported fields
}

ComponentFinder is a wrapper which allows for efficient searching through component data. The data is intended to be readonly; if modifications are made to the data, subsequent lookups will fail.

func NewComponentFinder added in v0.5.0

func NewComponentFinder(data []*bundle.Component) *ComponentFinder

NewComponentFinder creates a new ComponentFinder or returns an error.

func (*ComponentFinder) AllComponents added in v0.11.0

func (f *ComponentFinder) AllComponents() []*bundle.Component

AllComponents return all the components known by the finder.

func (*ComponentFinder) Component

Component returns the component package that matches a reference, returning nil if no match is found.

func (*ComponentFinder) ComponentVersions added in v0.9.1

func (f *ComponentFinder) ComponentVersions(name string) []bundle.ComponentReference

ComponentVersions returns the all the component versions for a given component name. The references are not sorted.

func (*ComponentFinder) Objects added in v0.5.0

Objects returns Component's Cluster objects (given some object ref) or nil.

func (*ComponentFinder) ObjectsFromUniqueComponent added in v0.5.0

func (f *ComponentFinder) ObjectsFromUniqueComponent(name string, ref core.ObjectRef) ([]*unstructured.Unstructured, error)

ObjectsFromUniqueComponent gets the objects for a component, which has the same behavior as Objects, except that the component name is assumed to be unique (and so panics if that assumption does not hold).

func (*ComponentFinder) UniqueComponentFromName added in v0.5.0

func (f *ComponentFinder) UniqueComponentFromName(name string) (*bundle.Component, error)

UniqueComponentFromName returns the single component package that matches a string-name. If no component is found, nil is returned. If there are two components that match the name, the method returns an error.

type ContainerImage

type ContainerImage struct {
	// Key represents the key for representing the specific cluster object that
	// this is from.
	Key core.ClusterObjectKey

	// Image are the images used by the cluster object. Usually having the form
	// `<registry>/<repository>/<image>:<tag>`. For example:
	// `gcr.io/google_containers/etcd:3.1.11`
	Image string
}

ContainerImage is a helper struct for returning found container images for cluster objects.

func (*ContainerImage) String

func (c *ContainerImage) String() string

String converts the ContainerImage into a human-readable string.

type Filter added in v0.12.4

type Filter func(fieldName string, parentFieldName string, img string) bool

Filter is a function type which filters images from being emitted by the finder. A filter should return true if the image should be emitted, false otherwise.

type ImageFinder

type ImageFinder struct {
	// contains filtered or unexported fields
}

ImageFinder finds container and OS Images in components.

func NewImageFinder added in v0.5.0

func NewImageFinder(c []*bundle.Component) *ImageFinder

NewImageFinder creates a new ImageFinder.

func (*ImageFinder) AllContainerImages

func (b *ImageFinder) AllContainerImages() []*ContainerImage

AllContainerImages returns all the images from the cluster components in a list of components.

func (*ImageFinder) AllFilteredContainerImages added in v0.12.4

func (b *ImageFinder) AllFilteredContainerImages(filter Filter) []*ContainerImage

AllFilteredContainerImages returns all the images from the cluster components in a list of components.

func (*ImageFinder) AllImages

func (b *ImageFinder) AllImages() *AllImages

AllImages finds all container images.

func (*ImageFinder) ContainerImages

ContainerImages returns all the images from a single Kubernetes object.

func (*ImageFinder) FilteredContainerImages added in v0.12.4

func (b *ImageFinder) FilteredContainerImages(filter Filter, key bundle.ComponentReference, st *unstructured.Unstructured) []*ContainerImage

FilteredContainerImages returns all the images from a single Kubernetes object, filtered by the specified function.

func (*ImageFinder) WalkAllContainerImages

func (b *ImageFinder) WalkAllContainerImages(filter Filter, emit func(key core.ClusterObjectKey, img string) string)

WalkAllContainerImages works the same as WalkContainerImages, except all images are traversed. Additionally, the cluster object context is also provided. Note that objects must be inlined to be walked.

This changes the components object in-place, so if changes are intended, it is recommend that the components be cloned.

func (*ImageFinder) WalkAllImages

func (b *ImageFinder) WalkAllImages(fn func(key core.ClusterObjectKey, img string) string)

WalkAllImages walks all node and container images. Only one of nodeConfigName or key will be filled out, based on whether the image is from a node config or from a cluster object.

This changes the component objects in-place, so if changes are intended, it is recommend that the components be cloned.

func (*ImageFinder) WalkContainerImages

func (b *ImageFinder) WalkContainerImages(st *unstructured.Unstructured, filter Filter, emit func(img string) string)

WalkContainerImages provides a method for traversing through Container images in a single kubernetes object, with a function for processing each container value.

If an image value is returned from the function that is not equal to the input value, the value is replaced with the new value.

This changes the components object in-place, so if changes are intended, it is recommend that the components be cloned.

type ObjectFinder added in v0.5.0

type ObjectFinder struct {
	// contains filtered or unexported fields
}

ObjectFinder finds objects within components

func NewObjectFinder added in v0.5.0

func NewObjectFinder(component *bundle.Component) *ObjectFinder

NewObjectFinder returns an ObjectFinder instance.

func (*ObjectFinder) Objects added in v0.5.0

Objects finds cluster objects matching a certain ObjectRef key. If the ObjectRef is partially filled out, then only those fields will be used for searching and the partial matches will be returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL