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 ResourceGroupCRDMatchedWithContext(ctx context.Context, 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
- func WrapInventoryObjWithContext(ctx context.Context) func(*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 ¶
func InvToUnstructuredFunc(inv inventory.Info) *unstructured.Unstructured
func IsResourceGroupInventory ¶
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 the cluster CRD using Background().
func ResourceGroupCRDMatchedWithContext ¶
ResourceGroupCRDMatchedWithContext checks the cluster CRD using ctx. Nil ctx is normalized to Background().
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 wraps inventory and uses Background() for API calls.
func WrapInventoryObjWithContext ¶
func WrapInventoryObjWithContext(ctx context.Context) func(*unstructured.Unstructured) inventory.Storage
WrapInventoryObjWithContext returns a WrapObjFunc that stores ctx. Nil ctx is normalized to Background().
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
Ctx context.Context
}
ClusterClientFactory is a factory that creates instances of ClusterClient inventory client.
Ctx, if set, is plumbed into the InventoryResourceGroup wrapper so Apply / ApplyWithPrune honor caller cancellation (Ctrl-C, timeouts). The upstream inventory.ClientFactory interface's NewClient signature does not accept a context, so we carry one on the factory instead; construct via NewClusterClientFactoryWithContext when you have one.
func NewClusterClientFactory ¶
func NewClusterClientFactory() *ClusterClientFactory
NewClusterClientFactory returns a ClusterClientFactory that will build inventory clients with no context propagation (cluster API calls use context.Background()). Prefer NewClusterClientFactoryWithContext.
func NewClusterClientFactoryWithContext ¶
func NewClusterClientFactoryWithContext(ctx context.Context) *ClusterClientFactory
NewClusterClientFactoryWithContext returns a ClusterClientFactory that threads ctx into every inventory client it produces.
A nil ctx is normalized to context.Background() so the docstring's promise ("threads ctx into every inventory client") holds for every input: there is no hidden code path that silently drops propagation.
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 inventory and carries a caller context for API calls.
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 ¶
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 ¶
func (icm *InventoryResourceGroup) Name() string
Name(), Namespace(), and ID() are InventoryResourceGroup functions to implement the InventoryInfo interface.
func (*InventoryResourceGroup) Namespace ¶
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 ¶
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.