scan

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Scheme = runtime.NewScheme()

Scheme is used globally to ensure the runtime helpers produce and consume RNodes with type metadata (kind and apiVersion) and Go typing. In general, there isn't a convenient way to parameterize the Read/Write calls (i.e. no Context), thus the global variable. By default, the scheme is loaded with the known Kubernetes API types and the types from this project (e.g Experiments).

Functions

This section is empty.

Types

type FilterOptions

type FilterOptions struct {
	DefaultReader     io.Reader
	KubectlExecutor   func(cmd *exec.Cmd) ([]byte, error)
	KustomizeExecutor func(cmd *exec.Cmd) ([]byte, error)
}

FilterOptions allow the behavior of the Konjure filter to be customized.

func (*FilterOptions) NewFilter

func (o *FilterOptions) NewFilter(workingDirectory string) *konjure.Filter

NewFilter creates a new filter with the supplied working directory.

type GenericSelector

type GenericSelector filters.ResourceMetaFilter

GenericSelector can be used to implement the "Select" part of the Selector interface. The "*Selector" fields are treated as Kubernetes selectors, all other fields are regular expressions for matching metadata.

func (*GenericSelector) Select

func (g *GenericSelector) Select(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Select reduces the supplied resource node slice by only returning those nodes which match this selector.

type ObjectList

type ObjectList corev1.List

ObjectList allows a generic list type to be used as a KYAML writer to provide interoperability between the YAML streaming and runtime objects.

func (*ObjectList) Write

func (o *ObjectList) Write(nodes []*yaml.RNode) error

Write converts the resource nodes into runtime objects.

type ObjectSlice

type ObjectSlice []runtime.Object

ObjectSlices allows a slice of object instances to be read as resource nodes.

func (ObjectSlice) Read

func (os ObjectSlice) Read() ([]*yaml.RNode, error)

Read converts the objects to JSON and then to YAML RNodes.

type Scanner

type Scanner struct {
	// The list of selectors that produce intermediate representations.
	Selectors []Selector
	// The mapper that produces resource nodes from the intermediate representations.
	Transformer Transformer
}

Scanner is used to map resource nodes to an intermediate type and back to (a likely different collection of) resource nodes. For example, a scanner could be used to "select" all the "name" labels from a slice of resource nodes, the "transform" those names back into a ConfigMap resource node that contains all of the discovered values.

func (*Scanner) Filter

func (s *Scanner) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter performs the "selection" and "transformation" of resource nodes to intermediate representations and back to resource nodes.

type Selector

type Selector interface {
	Select([]*yaml.RNode) ([]*yaml.RNode, error)
	Map(node *yaml.RNode, meta yaml.ResourceMeta) ([]interface{}, error)
}

Selector is used to filter (reduce) a list of resource nodes and then map them into something that can be consumed by a transformer.

type Transformer

type Transformer interface {
	Transform(nodes []*yaml.RNode, selected []interface{}) ([]*yaml.RNode, error)
}

Transformer consumes the aggregated outputs from the selectors and turns them back into resource nodes. The original resource nodes used to generate the inputs are also made available.

Jump to

Keyboard shortcuts

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