live

package
v0.39.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 20 Imported by: 14

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 ApplyResourceGroupCRD added in v0.38.0

func ApplyResourceGroupCRD(factory cmdutil.Factory) error

ApplyResourceGroupCRD applies the custom resource definition for the ResourceGroup. The apiextensions version applied is based on the RESTMapping returned by the RESTMapper. Returns an error if one occurs, including an "Already Exists" error.

func InvToUnstructuredFunc added in v0.38.0

func InvToUnstructuredFunc(inv inventory.InventoryInfo) *unstructured.Unstructured

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 ResourceGroupUnstructured added in v0.38.0

func ResourceGroupUnstructured(name, namespace, id string) *unstructured.Unstructured

func WrapInventoryObj

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

WrapInventoryObj takes a passed ResourceGroup (as an unstructured), 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 DualDelegatingManifestReader added in v0.38.0

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

DualDelegatingManifestReader read manifests that either uses ConfigMap or the ResourceGroup as the inventory object.

func NewDualDelegatingManifestReader added in v0.38.0

func NewDualDelegatingManifestReader(f util.Factory) *DualDelegatingManifestReader

func (*DualDelegatingManifestReader) InventoryInfo added in v0.38.0

InventoryInfo returns the InventoryInfo from a list of Unstructured objects. It can return a NoInventoryError or MultipleInventoryError.

func (*DualDelegatingManifestReader) ManifestReader added in v0.38.0

func (cp *DualDelegatingManifestReader) ManifestReader(reader io.Reader, path 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.

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().

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 and InventoryInfo interface. This wrapper loads and stores the object metadata (inventory) to and from the wrapped ResourceGroup.

func WrapInventoryResourceGroup added in v0.38.0

func WrapInventoryResourceGroup(obj *unstructured.Unstructured) *InventoryResourceGroup

WrapInventoryResourceGroup takes a passed ResourceGroup (as an unstructured), wraps it with the InventoryResourceGroup.

func (*InventoryResourceGroup) GetObject

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

func (*InventoryResourceGroup) ID added in v0.38.0

func (icm *InventoryResourceGroup) ID() string

func (*InventoryResourceGroup) Load

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

func (*InventoryResourceGroup) Name added in v0.38.0

func (icm *InventoryResourceGroup) Name() string

Name(), Namespace(), and ID() are InventoryResourceGroup functions to implement the InventoryInfo interface.

func (*InventoryResourceGroup) Namespace added in v0.38.0

func (icm *InventoryResourceGroup) Namespace() string

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

func (*InventoryResourceGroup) Strategy added in v0.39.2

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 ResourceGroupManifestLoader added in v0.38.0

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

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

func NewResourceGroupManifestLoader added in v0.38.0

func NewResourceGroupManifestLoader(f util.Factory) *ResourceGroupManifestLoader

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

func (*ResourceGroupManifestLoader) InventoryInfo added in v0.38.0

Factory returns the kubectl factory.

func (*ResourceGroupManifestLoader) ManifestReader added in v0.38.0

func (f *ResourceGroupManifestLoader) ManifestReader(reader io.Reader, path string) (manifestreader.ManifestReader, error)

ManifestReader returns the ResourceGroup inventory object version of the ManifestReader.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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