Documentation ¶
Index ¶
- Variables
- func InstallResourceGroupCRD(factory cmdutil.Factory) error
- func InvToUnstructuredFunc(inv inventory.InventoryInfo) *unstructured.Unstructured
- func IsResourceGroupInventory(obj *unstructured.Unstructured) (bool, error)
- func Load(f util.Factory, path string, stdIn io.Reader) ([]*unstructured.Unstructured, kptfilev1alpha2.Inventory, error)
- func ResourceGroupCRDApplied(factory cmdutil.Factory) bool
- func ToInventoryInfo(inventory kptfilev1alpha2.Inventory) (inventory.InventoryInfo, error)
- func WrapInventoryInfoObj(obj *unstructured.Unstructured) inventory.InventoryInfo
- func WrapInventoryObj(obj *unstructured.Unstructured) inventory.Inventory
- type ApplyCRDTask
- type FakeResourceGroupProvider
- type InventoryFilter
- type InventoryResourceGroup
- func (icm *InventoryResourceGroup) GetObject() (*unstructured.Unstructured, error)
- func (icm *InventoryResourceGroup) ID() string
- func (icm *InventoryResourceGroup) Load() ([]object.ObjMetadata, error)
- func (icm *InventoryResourceGroup) Name() string
- func (icm *InventoryResourceGroup) Namespace() string
- func (icm *InventoryResourceGroup) Store(objMetas []object.ObjMetadata) error
- func (icm *InventoryResourceGroup) Strategy() inventory.InventoryStrategy
- type ResourceGroupPathManifestReader
- type ResourceGroupProvider
- type ResourceGroupStreamManifestReader
Constants ¶
This section is empty.
Variables ¶
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.
Functions ¶
func InstallResourceGroupCRD ¶
InstallResourceGroupCRD applies the custom resource definition for the ResourceGroup by creating and running a TaskQueue of Tasks necessary. The Tasks are 1) Apply CRD task, 2) Wait Task (for CRD to become established), and 3) Reset RESTMapper task. Returns an error if a non-"AlreadyExists" error is returned on the event channel. Runs the CRD installation in a separate goroutine (timeout ensures no hanging).
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 Load ¶
func Load(f util.Factory, path string, stdIn io.Reader) ([]*unstructured.Unstructured, kptfilev1alpha2.Inventory, error)
Load reads resources either from disk or from an input stream. It filters out resources that should be ignored and defaults the namespace for namespace-scoped resources that doesn't have the namespace set. It also looks for inventory information inside Kptfile resources. It returns the resources in unstructured format and the inventory information. If no inventory information is found, that is not considered an error here.
func ResourceGroupCRDApplied ¶
ResourceGroupCRDApplied returns true if the inventory ResourceGroup CRD is available from the current RESTMapper, or false otherwise.
func ToInventoryInfo ¶
func ToInventoryInfo(inventory kptfilev1alpha2.Inventory) (inventory.InventoryInfo, error)
ToInventoryInfo takes the information in the provided inventory object and return an InventoryResourceGroup implementation of the InventoryInfo interface.
func WrapInventoryInfoObj ¶
func WrapInventoryInfoObj(obj *unstructured.Unstructured) inventory.InventoryInfo
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 ApplyCRDTask ¶
type ApplyCRDTask struct {
// contains filtered or unexported fields
}
ApplyCRDTask encapsulates information necessary to apply a Custom Resource Definition (CRD) as a task within a task queue. Implements the Task interface.
func NewApplyCRDTask ¶
func NewApplyCRDTask(factory cmdutil.Factory, crd *unstructured.Unstructured) *ApplyCRDTask
NewApplyCRDTask returns a pointer to an ApplyCRDTask struct, containing fields to run the task.
func (*ApplyCRDTask) Action ¶
func (a *ApplyCRDTask) Action() event.ResourceAction
func (*ApplyCRDTask) ClearTimeout ¶
func (a *ApplyCRDTask) ClearTimeout()
func (*ApplyCRDTask) Identifiers ¶
func (a *ApplyCRDTask) Identifiers() []object.ObjMetadata
func (*ApplyCRDTask) Name ¶
func (a *ApplyCRDTask) Name() string
func (*ApplyCRDTask) Start ¶
func (a *ApplyCRDTask) Start(taskContext *taskrunner.TaskContext)
Start function is called to start the task running.
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)
type InventoryFilter ¶
type InventoryFilter struct {
Inventories []*kptfilev1alpha2.Inventory
}
InventoryFilter is an implementation of the yaml.Filter interface that extracts inventory information from Kptfile resources.
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 (*InventoryResourceGroup) GetObject ¶
func (icm *InventoryResourceGroup) GetObject() (*unstructured.Unstructured, error)
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 ¶
func (icm *InventoryResourceGroup) Load() ([]object.ObjMetadata, error)
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
func (icm *InventoryResourceGroup) Strategy() inventory.InventoryStrategy
type ResourceGroupPathManifestReader ¶
type ResourceGroupPathManifestReader struct { PkgPath string manifestreader.ReaderOptions }
ResourceGroupPathManifestReader encapsulates the default path manifest reader.
func (*ResourceGroupPathManifestReader) Read ¶
func (r *ResourceGroupPathManifestReader) Read() ([]*unstructured.Unstructured, error)
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.
type ResourceGroupStreamManifestReader ¶
type ResourceGroupStreamManifestReader struct { ReaderName string Reader io.Reader manifestreader.ReaderOptions }
ResourceGroupStreamManifestReader encapsulates the default stream manifest reader.
func (*ResourceGroupStreamManifestReader) Read ¶
func (p *ResourceGroupStreamManifestReader) Read() ([]*unstructured.Unstructured, error)
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.