find

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 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"`
}

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

type BundleFinder

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

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

func NewBundleFinder

func NewBundleFinder(b *bpb.ClusterBundle) (*BundleFinder, error)

NewBundleFinder creates a new BundleFinder or returns an error.

func (*BundleFinder) ClusterObjects

func (b *BundleFinder) ClusterObjects(compName string, ref core.ObjectRef) []*structpb.Struct

ClusterObjects returns ComponentPackage's Cluster objects (given some object ref) or nil.

func (*BundleFinder) ComponentPackage added in v0.4.0

func (b *BundleFinder) ComponentPackage(name string) *bpb.ComponentPackage

ComponentPackage returns a found cluster component or nil.

type ComponentFinder

type ComponentFinder struct {
	Component *bpb.ComponentPackage
}

ComponentFinder finds objects within components

func (*ComponentFinder) ClusterObjects

func (c *ComponentFinder) ClusterObjects(ref core.ObjectRef) []*structpb.Struct

ClusterObjects 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.

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 {
	Bundle *bpb.ClusterBundle
}

ImageFinder finds container and OS Images in Bundles.

func (*ImageFinder) AllContainerImages

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

ContainerImages returns all the images from the cluster components in a Bundle.

func (*ImageFinder) AllImages

func (b *ImageFinder) AllImages() *AllImages

FindAllImages finds both container and node images.

func (*ImageFinder) ContainerImages

func (b *ImageFinder) ContainerImages(key core.ClusterObjectKey, st *structpb.Struct) []*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 Bundle object in-place, so if changes are intended, it is recommend that the Bundle 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 Bundle object in-place, so if changes are intended, it is recommend that the Bundle be cloned.

func (*ImageFinder) WalkContainerImages

func (b *ImageFinder) WalkContainerImages(st *structpb.Struct, 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 Bundle object in-place, so if changes are intended, it is recommend that the Bundle be cloned.

Jump to

Keyboard shortcuts

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