Documentation ¶
Overview ¶
inventory package contains structures and functions for generating an "inventory" of resource managed by the tool. This inventory can keep track of what has been deployed before and what is not deployed anymore to do a smart pruning of old objects to keep the remote server in sync with the local manifests.
Index ¶
- type Manager
- func (m *Manager) DeleteRemoteInventoryIfPossible(ctx context.Context, dryRun bool) error
- func (m *Manager) IsFailedApply(obj *unstructured.Unstructured) bool
- func (m *Manager) IsSkipped(obj *unstructured.Unstructured) bool
- func (m *Manager) SaveCurrentInventoryState(ctx context.Context, dryRun bool) error
- func (m *Manager) SetFailedApply(obj *unstructured.Unstructured)
- func (m *Manager) SetFailedDelete(obj *unstructured.Unstructured)
- func (m *Manager) SetSkipped(obj *unstructured.Unstructured)
- func (m *Manager) SetSuccessfullApply(obj *unstructured.Unstructured)
- func (m *Manager) SetSuccessfullDelete(obj *unstructured.Unstructured)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct { Inventory Store // contains filtered or unexported fields }
Manager will save and manage the current state of objects for
func NewManager ¶
func NewManager(inventory Store, startingObjects []*unstructured.Unstructured) *Manager
NewManager create a new instace of a manger for the given inventory Store
func (*Manager) DeleteRemoteInventoryIfPossible ¶
DeleteRemoteInventoryIfPossible calling this method will remove the remote invetory storage if possible. If any object has been marked as failed to delete for any reason, we cannot remove
func (*Manager) IsFailedApply ¶ added in v0.3.0
func (m *Manager) IsFailedApply(obj *unstructured.Unstructured) bool
IsFailedApply return if the passed in object has been marked as failed to apply from the manager
func (*Manager) IsSkipped ¶ added in v0.3.0
func (m *Manager) IsSkipped(obj *unstructured.Unstructured) bool
IsSkipped return if the passed in object has been marked as skipped from the manager
func (*Manager) SaveCurrentInventoryState ¶
SaveCurrentInventoryState will use the current tracked objects statuses for creating a new inventory status and persist it to the remote server
func (*Manager) SetFailedApply ¶
func (m *Manager) SetFailedApply(obj *unstructured.Unstructured)
SetFailedApply keep track of the passed objs as failed to apply
func (*Manager) SetFailedDelete ¶
func (m *Manager) SetFailedDelete(obj *unstructured.Unstructured)
SetFailedDelete keep track of the passed objs as failed to delete
func (*Manager) SetSkipped ¶ added in v0.3.0
func (m *Manager) SetSkipped(obj *unstructured.Unstructured)
SetSkipped keep track of the passed objs as skipped
func (*Manager) SetSuccessfullApply ¶
func (m *Manager) SetSuccessfullApply(obj *unstructured.Unstructured)
SetSuccessfullApply keep track of the passed objs as successfully applied
func (*Manager) SetSuccessfullDelete ¶
func (m *Manager) SetSuccessfullDelete(obj *unstructured.Unstructured)
SetSuccessfullDelete keep track of the passed objs as successfully deleted
type Store ¶
type Store interface { // Load will read the inventory data from the remote storage of the inventory Load(ctx context.Context) (sets.Set[resource.ObjectMetadata], error) // Save will persist the underling in memory inventory data for access on subsequent interaction Save(ctx context.Context, dryRun bool) error // Delete will remove remote storage of the inventory Delete(ctx context.Context, dryRun bool) error // SetObjects will replace the current in memory objects inventory data SetObjects(objects sets.Set[*unstructured.Unstructured]) }
Store define an interface for working with an inventory of deployed resources, without knowning the underling technology that is used for persisting the data
func NewConfigMapStore ¶
func NewConfigMapStore(factory util.ClientFactory, name, namespace, fieldManager string) (Store, error)
NewConfigMapStore return a new Store instance configured with the provided factory that will persist data via a ConfigMap resource. The namespace is where the backing ConfigMap will be read and saved.