Documentation ¶
Overview ¶
Package find provides methods for searching through Bundles the contained components and configuration.
Index ¶
- type AllImages
- type AllImagesFlattened
- type ComponentFinder
- func (f *ComponentFinder) Component(ref core.ComponentKey) *bundle.ComponentPackage
- func (f *ComponentFinder) ComponentsFromName(name string) []*bundle.ComponentPackage
- func (f *ComponentFinder) Objects(cref core.ComponentKey, ref core.ObjectRef) []*unstructured.Unstructured
- func (f *ComponentFinder) ObjectsFromUniqueComponent(name string, ref core.ObjectRef) []*unstructured.Unstructured
- func (f *ComponentFinder) UniqueComponentFromName(name string) *bundle.ComponentPackage
- type ContainerImage
- type ImageFinder
- func (b *ImageFinder) AllContainerImages() []*ContainerImage
- func (b *ImageFinder) AllImages() *AllImages
- func (b *ImageFinder) ContainerImages(key core.ComponentKey, st *unstructured.Unstructured) []*ContainerImage
- func (b *ImageFinder) WalkAllContainerImages(fn func(key core.ClusterObjectKey, img string) string)
- func (b *ImageFinder) WalkAllImages(fn func(key core.ClusterObjectKey, img string) string)
- func (b *ImageFinder) WalkContainerImages(st *unstructured.Unstructured, fn func(img string) string)
- type ObjectFinder
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"`
}
ImagesFlattened 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.ComponentPackage) *ComponentFinder
NewComponentFinder creates a new ComponentFinder or returns an error.
func (*ComponentFinder) Component ¶
func (f *ComponentFinder) Component(ref core.ComponentKey) *bundle.ComponentPackage
ComponentPackage returns the component package that matches a reference, returning nil if no match is found.
func (*ComponentFinder) ComponentsFromName ¶ added in v0.5.0
func (f *ComponentFinder) ComponentsFromName(name string) []*bundle.ComponentPackage
ComponentsFromName returns thes components that matches a string-name.
func (*ComponentFinder) Objects ¶ added in v0.5.0
func (f *ComponentFinder) Objects(cref core.ComponentKey, ref core.ObjectRef) []*unstructured.Unstructured
Objects returns ComponentPackage'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
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.ComponentPackage
ComponentPackage returns the single component package that matches a string-name. If no component is found, nil is returne. If there are two components that match the name, the method panics.
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 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.ComponentPackage) *ImageFinder
NewImageFinder creates a new ImageFinder.
func (*ImageFinder) AllContainerImages ¶
func (b *ImageFinder) AllContainerImages() []*ContainerImage
ContainerImages returns all the images from the cluster components in a set of components.
func (*ImageFinder) AllImages ¶
func (b *ImageFinder) AllImages() *AllImages
FindAllImages finds both container and node images.
func (*ImageFinder) ContainerImages ¶
func (b *ImageFinder) ContainerImages(key core.ComponentKey, st *unstructured.Unstructured) []*ContainerImage
ContainerImages returns all the images from a single Kubernetes object.
func (*ImageFinder) WalkAllContainerImages ¶
func (b *ImageFinder) WalkAllContainerImages(fn 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, fn 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.ComponentPackage) *ObjectFinder
NewObjectFinder returns an ObjectFinder instance.
func (*ObjectFinder) Objects ¶ added in v0.5.0
func (c *ObjectFinder) Objects(ref core.ObjectRef) []*unstructured.Unstructured
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.