Documentation ¶
Index ¶
- Constants
- Variables
- func Flatten(in []*unstructured.Unstructured) ([]*unstructured.Unstructured, error)
- func GroupVersionKindForObject(object *yaml.RNode) schema.GroupVersionKind
- func InvToUnstructuredFunc(inv inventory.Info) *unstructured.Unstructured
- func IsResourceGroupInventory(obj *unstructured.Unstructured) (bool, error)
- func Load(f util.Factory, path string, stdIn io.Reader) ([]*unstructured.Unstructured, kptfilev1.Inventory, error)
- func ResourceGroupCRDApplied(factory cmdutil.Factory) bool
- func ResourceGroupCRDMatched(factory cmdutil.Factory) bool
- func ToInventoryInfo(inventory kptfilev1.Inventory) (inventory.Info, error)
- func WrapInventoryInfoObj(obj *unstructured.Unstructured) inventory.Info
- func WrapInventoryObj(obj *unstructured.Unstructured) inventory.Storage
- type ApplyCRDTask
- func (a *ApplyCRDTask) Action() event.ResourceAction
- func (a *ApplyCRDTask) Cancel(_ *taskrunner.TaskContext)
- func (a *ApplyCRDTask) Identifiers() object.ObjMetadataSet
- func (a *ApplyCRDTask) Name() string
- func (a *ApplyCRDTask) Start(taskContext *taskrunner.TaskContext)
- func (a *ApplyCRDTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)
- type ClusterClientFactory
- type InventoryFilter
- type InventoryInfoValidationError
- type InventoryResourceGroup
- func (icm *InventoryResourceGroup) Apply(dc dynamic.Interface, mapper meta.RESTMapper, ...) error
- func (icm *InventoryResourceGroup) ApplyWithPrune(dc dynamic.Interface, mapper meta.RESTMapper, ...) error
- func (icm *InventoryResourceGroup) GetObject() (*unstructured.Unstructured, error)
- func (icm *InventoryResourceGroup) ID() string
- func (icm *InventoryResourceGroup) Load() (object.ObjMetadataSet, error)
- func (icm *InventoryResourceGroup) Name() string
- func (icm *InventoryResourceGroup) Namespace() string
- func (icm *InventoryResourceGroup) Store(objMetas object.ObjMetadataSet, status []actuation.ObjectStatus) error
- func (icm *InventoryResourceGroup) Strategy() inventory.Strategy
- type RGFilter
- type ResourceGroupInstaller
- type ResourceGroupPathManifestReader
- type ResourceGroupStreamManifestReader
Constants ¶
const NoLocalConfigAnnoVal = "false"
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 Flatten ¶
func Flatten(in []*unstructured.Unstructured) ([]*unstructured.Unstructured, error)
Flatten returns a list containing 'in' objects with objects of kind List replaced by their members.
func GroupVersionKindForObject ¶
func GroupVersionKindForObject(object *yaml.RNode) schema.GroupVersionKind
GroupVersionKindForObject extracts the group/version/kind from an RNode holding a kubernetes object.
func InvToUnstructuredFunc ¶ added in v0.38.0
func InvToUnstructuredFunc(inv inventory.Info) *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, kptfilev1.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 or resourcegroup 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 ResourceGroupCRDMatched ¶
ResourceGroupCRDMatched checks if the ResourceGroup CRD in the cluster matches the CRD in the kpt binary.
func ToInventoryInfo ¶
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.Info
func WrapInventoryObj ¶
func WrapInventoryObj(obj *unstructured.Unstructured) inventory.Storage
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) Cancel ¶
func (a *ApplyCRDTask) Cancel(_ *taskrunner.TaskContext)
func (*ApplyCRDTask) Identifiers ¶
func (a *ApplyCRDTask) Identifiers() object.ObjMetadataSet
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.
func (*ApplyCRDTask) StatusUpdate ¶
func (a *ApplyCRDTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata)
type ClusterClientFactory ¶
type ClusterClientFactory struct {
StatusPolicy inventory.StatusPolicy
}
ClusterClientFactory is a factory that creates instances of ClusterClient inventory client.
func NewClusterClientFactory ¶
func NewClusterClientFactory() *ClusterClientFactory
type InventoryFilter ¶
InventoryFilter is an implementation of the yaml.Filter interface that extracts inventory information from Kptfile resources.
type InventoryInfoValidationError ¶
type InventoryInfoValidationError struct {
errors.ValidationError
}
InventoryInfoValidationError is the error returned if validation of the inventory information fails.
func (*InventoryInfoValidationError) Error ¶
func (e *InventoryInfoValidationError) Error() string
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) Apply ¶
func (icm *InventoryResourceGroup) Apply(dc dynamic.Interface, mapper meta.RESTMapper, statusPolicy inventory.StatusPolicy) error
Apply is a Storage interface function implemented to apply the inventory object.
func (*InventoryResourceGroup) ApplyWithPrune ¶
func (icm *InventoryResourceGroup) ApplyWithPrune(dc dynamic.Interface, mapper meta.RESTMapper, statusPolicy inventory.StatusPolicy, _ object.ObjMetadataSet) error
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.ObjMetadataSet, 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.ObjMetadataSet, status []actuation.ObjectStatus) 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.Strategy
type RGFilter ¶
type RGFilter struct {
Inventories []*rgfilev1alpha1.ResourceGroup
}
RGFilter is an implementation of the yaml.Filter interface that extracts inventory information from resourcegroup objects.
type ResourceGroupInstaller ¶
ResourceGroupInstaller can install the ResourceGroup CRD into a cluster.
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 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.