inventory

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongInventoryKey occurs when a stored object has been read,
	// which doesn't follow the expected format.
	// This can only happen through an incompatible change, like editing the inventory directly.
	ErrWrongInventoryKey     = errors.New("Inventory key is incorrect")
	ErrManifestFieldNotFound = errors.New("Manifest field not found")
)

Functions

This section is empty.

Types

type HelmReleaseItem

type HelmReleaseItem struct {
	Name      string
	Namespace string
	ID        string
}

HelmReleaseItem is a small inventory representation of a Release. Release is a running instance of a Chart. When a chart is installed, the ChartReconciler creates a release to track that installation.

func (*HelmReleaseItem) GetID

func (hr *HelmReleaseItem) GetID() string

GetID returns the string representation of the release. This is used as an identifier in the inventory.

func (*HelmReleaseItem) GetName

func (hr *HelmReleaseItem) GetName() string

func (*HelmReleaseItem) GetNamespace

func (hr *HelmReleaseItem) GetNamespace() string

type Item

type Item interface {
	GetName() string
	GetNamespace() string
	// GetID returns a unique identifier.
	GetID() string
}

Item is a small representation of a stored object.

type Manager

type Manager struct {
	Log  logr.Logger
	Path string
}

Manager is responsible for maintaining the current cluster state. It can store, delete and read items from the inventory.

func (Manager) DeleteItem

func (manager Manager) DeleteItem(item Item) error

DeleteItem removes the item from the inventory. Declcd will not be tracking its current state anymore.

func (Manager) GetItem

func (manager Manager) GetItem(item Item) (io.ReadCloser, error)

GetItem opens the item file for reading. If there is an error, it will be of type *PathError.

func (*Manager) Load

func (manager *Manager) Load() (*Storage, error)

Load reads the current inventory and returns all the stored components.

func (Manager) StoreItem

func (manager Manager) StoreItem(item Item, contentReader io.Reader) error

StoreItem persists given item with optional content in the inventory.

type ManifestItem

type ManifestItem struct {
	TypeMeta  v1.TypeMeta
	Name      string
	Namespace string
	ID        string
}

ManifestItem a small inventory representation of a ManifestItem. ManifestItem is a Kubernetes object.

func (*ManifestItem) GetID

func (manifest *ManifestItem) GetID() string

GetID returns the string representation of the manifest. This is used as an identifier in the inventory.

func (*ManifestItem) GetName

func (manifest *ManifestItem) GetName() string

func (*ManifestItem) GetNamespace

func (manifest *ManifestItem) GetNamespace() string

type Storage

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

Storage represents all stored Declcd items. It is effectively the current cluster state.

func (Storage) HasItem

func (inv Storage) HasItem(item Item) bool

HasItem evaluates whether an item is part of the current cluster state.

func (Storage) Items

func (inv Storage) Items() map[string]Item

Items returns all stored Declcd items.

Jump to

Keyboard shortcuts

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