live

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceGroupGVK = schema.GroupVersionKind{
	Group:   "kpt.dev",
	Version: "v1alpha1",
	Kind:    "ResourceGroup",
}

ResourceGroupGVK is the group/version/kind of the custom resource used to store inventory.

View Source
var ResourceSeparator = []byte("\n---\n")

Functions

func IsResourceGroupInventory added in v0.37.0

func IsResourceGroupInventory(obj *unstructured.Unstructured) (bool, error)

IsResourceGroupInventory returns true if the passed object is a ResourceGroup inventory object; false otherwise. If an error occurs, then false is returned and the error.

func WrapInventoryObj

func WrapInventoryObj(obj *unstructured.Unstructured) inventory.Inventory

WrapInventoryObj takes a passed ResourceGroup (as a resource.Info), wraps it with the InventoryResourceGroup and upcasts the wrapper as an the Inventory interface.

Types

type CachedManifestReader added in v0.37.0

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

CachedManifestReader implements ManifestReader, storing objects to return.

func (*CachedManifestReader) Read added in v0.37.0

Read simply returns the stored objects.

type DualDelegatingProvider added in v0.37.0

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

DualDelegatingProvider encapsulates another Provider to which it delegates most functions, enabling a Provider which will return values based on the inventory object found from ManifestReader() call.

func NewDualDelegatingProvider added in v0.37.0

func NewDualDelegatingProvider(f util.Factory) *DualDelegatingProvider

NewDualDelagatingProvider returns a pointer to the DualDelegatingProvider, setting default values.

func (*DualDelegatingProvider) Factory added in v0.37.0

func (cp *DualDelegatingProvider) Factory() util.Factory

Factory returns the delegate factory.

func (*DualDelegatingProvider) InventoryClient added in v0.37.0

func (cp *DualDelegatingProvider) InventoryClient() (inventory.InventoryClient, error)

InventoryClient returns an InventoryClient that is created from the stored/calculated InventoryFactoryFunction. This must be called after ManifestReader().

func (*DualDelegatingProvider) ManifestReader added in v0.37.0

func (cp *DualDelegatingProvider) ManifestReader(reader io.Reader, args []string) (manifestreader.ManifestReader, error)

ManifestReader retrieves the ManifestReader from the delegate ResourceGroup Provider, then calls Read() for this ManifestReader to retrieve the objects and to calculate the type of Inventory object is present. Returns a CachedManifestReader with the read objects, or an error. Can return a NoInventoryError or MultipleInventoryError.

func (*DualDelegatingProvider) ToRESTMapper added in v0.37.0

func (cp *DualDelegatingProvider) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper returns the value from the delegate provider; or an error.

type FakeResourceGroupProvider added in v0.37.0

type FakeResourceGroupProvider struct {
	InvClient *inventory.FakeInventoryClient
	// contains filtered or unexported fields
}

func NewFakeResourceGroupProvider added in v0.37.0

func NewFakeResourceGroupProvider(f util.Factory, objs []object.ObjMetadata) *FakeResourceGroupProvider

func (*FakeResourceGroupProvider) Factory added in v0.37.0

func (f *FakeResourceGroupProvider) Factory() util.Factory

func (*FakeResourceGroupProvider) InventoryClient added in v0.37.0

func (f *FakeResourceGroupProvider) InventoryClient() (inventory.InventoryClient, error)

func (*FakeResourceGroupProvider) ManifestReader added in v0.37.0

func (f *FakeResourceGroupProvider) ManifestReader(reader io.Reader, args []string) (manifestreader.ManifestReader, error)

func (*FakeResourceGroupProvider) ToRESTMapper added in v0.37.0

func (f *FakeResourceGroupProvider) ToRESTMapper() (meta.RESTMapper, error)

type InventoryResourceGroup

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

InventoryResourceGroup wraps a ResourceGroup resource and implements the Inventory interface. This wrapper loads and stores the object metadata (inventory) to and from the wrapped ResourceGroup.

func (*InventoryResourceGroup) GetObject

GetObject returns the wrapped object (ResourceGroup) as a resource.Info or an error if one occurs.

func (*InventoryResourceGroup) Load

Load is an Inventory interface function returning the set of object metadata from the wrapped ResourceGroup, or an error.

func (*InventoryResourceGroup) Store

func (icm *InventoryResourceGroup) Store(objMetas []object.ObjMetadata) error

Store is an Inventory interface function implemented to store the object metadata in the wrapped ResourceGroup. Actual storing happens in "GetObject".

type MultipleInventoryObjError added in v0.37.0

type MultipleInventoryObjError struct {
	InvObjs []*unstructured.Unstructured
}

MultipleInventoryObjError is thrown when more than one inventory objects is detected.

func (MultipleInventoryObjError) Error added in v0.37.0

type ResourceGroupPathManifestReader

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

ResourceGroupPathManifestReader encapsulates the default path manifest reader.

func (*ResourceGroupPathManifestReader) Read

Read reads the manifests and returns them as Info objects. Generates and adds a ResourceGroup inventory object from Kptfile data. If unable to generate the ResourceGroup inventory object from the Kptfile, it is NOT an error.

type ResourceGroupProvider

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

ResourceGroupProvider implements the Provider interface, returning ResourceGroup versions of some kpt live apply structures.

func NewResourceGroupProvider

func NewResourceGroupProvider(f util.Factory) *ResourceGroupProvider

NewResourceGroupProvider encapsulates the passed values, and returns a pointer to an ResourceGroupProvider.

func (*ResourceGroupProvider) Factory

func (f *ResourceGroupProvider) Factory() util.Factory

Factory returns the kubectl factory.

func (*ResourceGroupProvider) InventoryClient

func (f *ResourceGroupProvider) InventoryClient() (inventory.InventoryClient, error)

InventoryClient returns the InventoryClient created using the ResourceGroup inventory object wrapper function.

func (*ResourceGroupProvider) ManifestReader

func (f *ResourceGroupProvider) ManifestReader(reader io.Reader, args []string) (manifestreader.ManifestReader, error)

ManifestReader returns the ResourceGroup inventory object version of the ManifestReader.

func (*ResourceGroupProvider) ToRESTMapper

func (f *ResourceGroupProvider) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper returns the RESTMapper or an erro if one occurred.

type ResourceGroupStreamManifestReader

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

ResourceGroupStreamManifestReader encapsulates the default stream manifest reader.

func (*ResourceGroupStreamManifestReader) Read

Read reads the manifests and returns them as Info objects. Transforms the Kptfile into the ResourceGroup inventory object, and appends it to the rest of the standard StreamManifestReader generated objects. Returns an error if one occurs. If the ResourceGroup inventory object does not exist, it is NOT an error.

Jump to

Keyboard shortcuts

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