prune

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInventoryToGroupingObj

func AddInventoryToGroupingObj(infos []*resource.Info) error

Adds the inventory of all objects (passed as infos) to the inventory object. Returns an error if a inventory object does not exist, or we are unable to successfully add the inventory to the inventory object; nil otherwise. Each object is in unstructured.Unstructured format.

func ClearInventoryObj added in v0.8.0

func ClearInventoryObj(infos []*resource.Info) error

ClearInventoryObj finds the inventory object in the list of objects, and sets an empty inventory. Returns error if the inventory object is not Unstructured, the inventory object does not exist, or if we can't set the empty inventory on the inventory object. If successful, returns nil.

func CreateInventoryObj added in v0.8.0

func CreateInventoryObj(inventoryTemplate *resource.Info,
	resources []*resource.Info) (*resource.Info, error)

CreateInventoryObj creates a grouping object based on a grouping object template and the set of resources that will be in the inventory.

func FindInventoryObj added in v0.8.0

func FindInventoryObj(infos []*resource.Info) (*resource.Info, bool)

FindInventoryObj returns the "Inventory" object (ConfigMap with inventory label) if it exists, and a boolean describing if it was found.

func IsInventoryObject added in v0.8.0

func IsInventoryObject(obj runtime.Object) bool

IsInventoryObject returns true if the passed object has the inventory label. TODO(seans3): Check type is ConfigMap.

func RetrieveInventoryFromGroupingObj

func RetrieveInventoryFromGroupingObj(infos []*resource.Info) ([]*object.ObjMetadata, error)

RetrieveInventoryFromGroupingObj returns a slice of pointers to the inventory metadata. This function finds the grouping object, then parses the stored resource metadata into Inventory structs. Returns an error if there is a problem parsing the data into Inventory structs, or if the grouping object is not in Unstructured format; nil otherwise. If a grouping object does not exist, or it does not have a "data" map, then returns an empty slice and no error.

Types

type MultipleGroupingObjError added in v0.5.0

type MultipleGroupingObjError struct {
	GroupingObjectTemplates []*resource.Info
}

func (MultipleGroupingObjError) Error added in v0.5.0

func (g MultipleGroupingObjError) Error() string

type NoGroupingObjError added in v0.1.3

type NoGroupingObjError struct{}

func (NoGroupingObjError) Error added in v0.1.3

func (g NoGroupingObjError) Error() string

type Options added in v0.8.0

type Options struct {
	// DryRun defines whether objects should actually be pruned or if
	// we should just print what would happen without actually doing it.
	DryRun bool
}

Options defines a set of parameters that can be used to tune the behavior of the pruner.

type PruneOptions

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

PruneOptions encapsulates the necessary information to implement the prune functionality.

func NewPruneOptions

func NewPruneOptions(currentUids sets.String) *PruneOptions

NewPruneOptions returns a struct (PruneOptions) encapsulating the necessary information to run the prune. Returns an error if an error occurs gathering this information.

func (*PruneOptions) Initialize

func (po *PruneOptions) Initialize(factory util.Factory) error

func (*PruneOptions) Prune

func (po *PruneOptions) Prune(currentObjects []*resource.Info, eventChannel chan<- event.Event, o Options) error

Prune deletes the set of resources which were previously applied (retrieved from previous grouping objects) but omitted in the current apply. Prune also delete all previous grouping objects. Returns an error if there was a problem.

Jump to

Keyboard shortcuts

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