Documentation ¶
Overview ¶
Package inventory contains utilities for keeping a record of Kubernetes objects applied on a cluster.
Index ¶
- type Entry
- type Inventory
- func (inv *Inventory) AddObjects(objects []*unstructured.Unstructured) error
- func (inv *Inventory) Diff(target *Inventory) ([]*unstructured.Unstructured, error)
- func (inv *Inventory) ListMeta() (object.ObjMetadataSet, error)
- func (inv *Inventory) ListObjects() ([]*unstructured.Unstructured, error)
- func (inv *Inventory) SetSource(url, revision string)
- func (inv *Inventory) VersionOf(objMetadata object.ObjMetadata) string
- type InventoryStorage
- func (m *InventoryStorage) ApplyInventory(ctx context.Context, i *Inventory) error
- func (m *InventoryStorage) DeleteInventory(ctx context.Context, i *Inventory) error
- func (m *InventoryStorage) GetInventory(ctx context.Context, i *Inventory) error
- func (m *InventoryStorage) GetInventoryStaleObjects(ctx context.Context, i *Inventory) ([]*unstructured.Unstructured, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { // ObjectID is the string representation of object.ObjMetadata, // in the format '<namespace>_<name>_<group>_<kind>'. ObjectID string `json:"id"` // ObjectVersion is the API version of this entry kind. ObjectVersion string `json:"ver"` }
Entry contains the information necessary to locate the resource within a cluster.
type Inventory ¶
type Inventory struct { // Name of the inventory configmap. Name string `json:"name"` // Namespace of the inventory configmap. Namespace string `json:"namespace"` // Source is the URL of the source code. Source string `json:"source,omitempty"` // Revision is the Source control revision identifier. Revision string `json:"revision,omitempty"` // Entries of Kubernetes objects metadata. Entries []Entry `json:"entries"` }
Inventory is a record of objects that are applied on a cluster stored as a configmap.
func NewInventory ¶
func (*Inventory) AddObjects ¶
func (inv *Inventory) AddObjects(objects []*unstructured.Unstructured) error
AddObjects extracts the metadata from the given objects and adds it to the inventory.
func (*Inventory) Diff ¶
func (inv *Inventory) Diff(target *Inventory) ([]*unstructured.Unstructured, error)
Diff returns the slice of objects that do not exist in the target inventory.
func (*Inventory) ListMeta ¶
func (inv *Inventory) ListMeta() (object.ObjMetadataSet, error)
ListMeta returns the inventory entries as object.ObjMetadata objects.
func (*Inventory) ListObjects ¶
func (inv *Inventory) ListObjects() ([]*unstructured.Unstructured, error)
ListObjects returns the inventory entries as unstructured.Unstructured objects.
type InventoryStorage ¶ added in v1.1.2
type InventoryStorage struct { Manager *ssa.ResourceManager Owner ssa.Owner }
InventoryStorage manages the Inventory ConfigMap storage.
func (*InventoryStorage) ApplyInventory ¶ added in v1.1.2
func (m *InventoryStorage) ApplyInventory(ctx context.Context, i *Inventory) error
ApplyInventory creates or updates the ConfigMap object for the given inventory.
func (*InventoryStorage) DeleteInventory ¶ added in v1.1.2
func (m *InventoryStorage) DeleteInventory(ctx context.Context, i *Inventory) error
DeleteInventory removes the ConfigMap for the given inventory name and namespace.
func (*InventoryStorage) GetInventory ¶ added in v1.1.2
func (m *InventoryStorage) GetInventory(ctx context.Context, i *Inventory) error
GetInventory retrieves the entries from the ConfigMap for the given inventory name and namespace.
func (*InventoryStorage) GetInventoryStaleObjects ¶ added in v1.1.2
func (m *InventoryStorage) GetInventoryStaleObjects(ctx context.Context, i *Inventory) ([]*unstructured.Unstructured, error)
GetInventoryStaleObjects returns the list of objects metadata subject to pruning.