inventory

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Annotation that contains the inventory content.
	ContentAnnotation = "kustomize.config.k8s.io/Inventory"

	// Annotation for inventory content hash.
	HashAnnotation = "kustomize.config.k8s.io/InventoryHash"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Inventory

type Inventory struct {
	Current  Refs `json:"current,omitempty"`
	Previous Refs `json:"previous,omitempty"`
}

An Inventory allows the Prune method to work.

func NewInventory

func NewInventory() *Inventory

NewInventory returns an Inventory object

func (*Inventory) LoadFromAnnotation

func (a *Inventory) LoadFromAnnotation(annot map[string]string) error

LoadFromAnnotation loads the Inventory date from the annotation map

func (*Inventory) Prune

func (a *Inventory) Prune() []resid.ResId

Prune computes the diff of Current refs and Previous refs and returns a list of Items that can be pruned. An item that can be pruned shows up only in Previous refs. Prune also updates the Previous refs with those items removed

func (*Inventory) UpdateAnnotations

func (a *Inventory) UpdateAnnotations(annot map[string]string) error

UpdateAnnotations update the annotation map

func (*Inventory) UpdateCurrent

func (a *Inventory) UpdateCurrent(curref Refs) *Inventory

UpdateCurrent updates the Inventory given a new current Refs The existing Current refs is merged into the Previous refs

type Refs

type Refs map[resid.ResId][]resid.ResId

References are important in inventory management because one may not delete an object before all objects referencing it have been removed.

func NewRefs

func NewRefs() Refs

func (Refs) Merge

func (rf Refs) Merge(b Refs) Refs

Merge merges a Refs into an existing Refs

func (Refs) RemoveIfContains

func (rf Refs) RemoveIfContains(a, b resid.ResId)

removeIfContains removes the reference relationship

a --> b

from the Refs if it exists

Jump to

Keyboard shortcuts

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