inventory

package
v0.28.10 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomResourceDefinition = "CustomResourceDefinition"
	Namespace                = "Namespace"
)

Variables

This section is empty.

Functions

func AddStaticResourceScope

func AddStaticResourceScope(gk schema.GroupKind, namespaced bool)

func CreateObjectsInventory

func CreateObjectsInventory(namespace, name string, objects []runtime.Object) (*core.ConfigMap, error)

func GetObjectsFromInventory

func GetObjectsFromInventory(inventory core.ConfigMap) (objects []runtime.Object)

Types

type Inventory

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

A generalized structure to enable us to attach additional inventory management around the native reconcile loop and adds the capability to store state between reconcile phases (see operator-tool's NativeReconciler)

func NewDiscoveryInventory

func NewDiscoveryInventory(client client.Client, log logr.Logger, discovery discovery.DiscoveryInterface) *Inventory

func NewInventory

func NewInventory(client client.Client, log logr.Logger, clusterResources map[string]struct{}) (*Inventory, error)

func (*Inventory) Append

func (i *Inventory) Append(namespace, component string, parent reconciler.ResourceOwner, resourceBuilders []reconciler.ResourceBuilder) ([]reconciler.ResourceBuilder, error)

func (*Inventory) IsClusterScoped

func (c *Inventory) IsClusterScoped(obj runtime.Object) (bool, error)

IsClusterScoped returns true of the type if the specified resource is of cluster scope. It returns false for namespace scoped resources.

func (*Inventory) PrepareDeletableObjects

func (c *Inventory) PrepareDeletableObjects() error

Collect `missing` resources from desired state

func (*Inventory) PrepareDesiredObjects

func (c *Inventory) PrepareDesiredObjects(ns, componentName string, parent reconciler.ResourceOwner, resourceBuilders []reconciler.ResourceBuilder) (*core.ConfigMap, error)

Fetch list of resources made by the previous reconcile loop and store into an attached context Return a new list of resources which will be reconciled among with the other resources we listed here

func (*Inventory) TypesToPurge

func (c *Inventory) TypesToPurge() []schema.GroupVersionKind

Hand over a GVK list to the native reconcile loop's purge method

type InventoryData

type InventoryData struct {
	ObjectsToDelete []runtime.Object
	CurrentObjects  []runtime.Object
	DesiredObjects  []runtime.Object
}

State holder between reconcile phases

Jump to

Keyboard shortcuts

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