live

package
v0.0.0-...-c7d747a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const NoLocalConfigAnnoVal = "false"

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.

Functions

func Flatten

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

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

func ResourceGroupCRDApplied(factory cmdutil.Factory) bool

ResourceGroupCRDApplied returns true if the inventory ResourceGroup CRD is available from the current RESTMapper, or false otherwise.

func ResourceGroupCRDMatched

func ResourceGroupCRDMatched(factory cmdutil.Factory) bool

ResourceGroupCRDMatched checks if the ResourceGroup CRD in the cluster matches the CRD in the kpt binary.

func ToInventoryInfo

func ToInventoryInfo(inventory kptfilev1.Inventory) (inventory.Info, 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.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

func (*ClusterClientFactory) NewClient

func (ccf *ClusterClientFactory) NewClient(factory cmdutil.Factory) (inventory.Client, error)

type InventoryFilter

type InventoryFilter struct {
	Inventories []*kptfilev1.Inventory
}

InventoryFilter is an implementation of the yaml.Filter interface that extracts inventory information from Kptfile resources.

func (*InventoryFilter) Filter

func (i *InventoryFilter) Filter(object *yaml.RNode) (*yaml.RNode, error)

type InventoryInfoValidationError

type InventoryInfoValidationError struct {
	errors.ValidationError
}

InventoryInfoValidationError is the error returned if validation of the inventory information fails.

func (*InventoryInfoValidationError) 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 (*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

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

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

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.

func (*RGFilter) Filter

func (r *RGFilter) Filter(object *yaml.RNode) (*yaml.RNode, error)

type ResourceGroupInstaller

type ResourceGroupInstaller struct {
	Factory cmdutil.Factory
}

ResourceGroupInstaller can install the ResourceGroup CRD into a cluster.

func (*ResourceGroupInstaller) InstallRG

func (rgi *ResourceGroupInstaller) InstallRG(ctx context.Context) error

type ResourceGroupPathManifestReader

type ResourceGroupPathManifestReader struct {
	PkgPath string

	manifestreader.ReaderOptions
}

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 ResourceGroupStreamManifestReader

type ResourceGroupStreamManifestReader struct {
	ReaderName string
	Reader     io.Reader

	manifestreader.ReaderOptions
}

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