Documentation ¶
Index ¶
- Constants
- func AddInventoryIDAnnotation(obj *unstructured.Unstructured, inv Info)
- func CanApply(inv Info, obj *unstructured.Unstructured, policy Policy) (bool, error)
- func CanPrune(inv Info, obj *unstructured.Unstructured, policy Policy) (bool, error)
- func FindInventoryObj(objs object.UnstructuredSet) *unstructured.Unstructured
- func InvInfoToConfigMap(inv Info) *unstructured.Unstructured
- func IsInventoryObject(obj *unstructured.Unstructured) bool
- func ObjMetadataFromObjectReference(ref actuation.ObjectReference) object.ObjMetadata
- func ObjectReferenceFromObjMetadata(id object.ObjMetadata) actuation.ObjectReference
- func SplitUnstructureds(objs object.UnstructuredSet) (*unstructured.Unstructured, object.UnstructuredSet, error)
- func ValidateNoInventory(objs object.UnstructuredSet) error
- type Client
- type ClientFactory
- type ClusterClient
- func (cic *ClusterClient) ApplyInventoryNamespace(obj *unstructured.Unstructured, dryRun common.DryRunStrategy) error
- func (cic *ClusterClient) DeleteInventoryObj(localInv Info, dryRun common.DryRunStrategy) error
- func (cic *ClusterClient) GetClusterInventoryInfo(inv Info) (*unstructured.Unstructured, error)
- func (cic *ClusterClient) GetClusterInventoryObjs(inv Info) (object.UnstructuredSet, error)
- func (cic *ClusterClient) GetClusterObjs(localInv Info) (object.ObjMetadataSet, error)
- func (cic *ClusterClient) Merge(localInv Info, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) (object.ObjMetadataSet, error)
- func (cic *ClusterClient) Replace(localInv Info, objs object.ObjMetadataSet, status []actuation.ObjectStatus, ...) error
- type ClusterClientFactory
- type ConfigMap
- func (icm *ConfigMap) Apply(dc dynamic.Interface, mapper meta.RESTMapper, _ StatusPolicy) error
- func (icm *ConfigMap) ApplyWithPrune(dc dynamic.Interface, mapper meta.RESTMapper, _ StatusPolicy, ...) error
- func (icm *ConfigMap) GetObject() (*unstructured.Unstructured, error)
- func (icm *ConfigMap) ID() string
- func (icm *ConfigMap) Load() (object.ObjMetadataSet, error)
- func (icm *ConfigMap) Name() string
- func (icm *ConfigMap) Namespace() string
- func (icm *ConfigMap) Store(objMetas object.ObjMetadataSet, status []actuation.ObjectStatus) error
- func (icm *ConfigMap) Strategy() Strategy
- func (icm *ConfigMap) UnstructuredInventory() *unstructured.Unstructured
- type FakeBuilder
- type FakeClient
- func (fic *FakeClient) ApplyInventoryNamespace(*unstructured.Unstructured, common.DryRunStrategy) error
- func (fic *FakeClient) ClearError()
- func (fic *FakeClient) DeleteInventoryObj(Info, common.DryRunStrategy) error
- func (fic *FakeClient) GetClusterInventoryInfo(Info) (*unstructured.Unstructured, error)
- func (fic *FakeClient) GetClusterInventoryObjs(_ Info) (object.UnstructuredSet, error)
- func (fic *FakeClient) GetClusterObjs(Info) (object.ObjMetadataSet, error)
- func (fic *FakeClient) Merge(_ Info, objs object.ObjMetadataSet, _ common.DryRunStrategy) (object.ObjMetadataSet, error)
- func (fic *FakeClient) Replace(_ Info, objs object.ObjMetadataSet, status []actuation.ObjectStatus, ...) error
- func (fic *FakeClient) SetError(err error)
- type FakeClientFactory
- type IDMatchStatus
- type Info
- type Manager
- func (tc *Manager) AddFailedApply(id object.ObjMetadata)
- func (tc *Manager) AddFailedDelete(id object.ObjMetadata)
- func (tc *Manager) AddPendingApply(id object.ObjMetadata)
- func (tc *Manager) AddPendingDelete(id object.ObjMetadata)
- func (tc *Manager) AddSkippedApply(id object.ObjMetadata)
- func (tc *Manager) AddSkippedDelete(id object.ObjMetadata)
- func (tc *Manager) AddSuccessfulApply(id object.ObjMetadata, uid types.UID, gen int64)
- func (tc *Manager) AddSuccessfulDelete(id object.ObjMetadata, uid types.UID)
- func (tc *Manager) AppliedGeneration(id object.ObjMetadata) (int64, bool)
- func (tc *Manager) AppliedResourceUID(id object.ObjMetadata) (types.UID, bool)
- func (tc *Manager) AppliedResourceUIDs() sets.String
- func (tc *Manager) FailedApplies() object.ObjMetadataSet
- func (tc *Manager) FailedDeletes() object.ObjMetadataSet
- func (tc *Manager) FailedReconciles() object.ObjMetadataSet
- func (tc *Manager) Inventory() *actuation.Inventory
- func (tc *Manager) IsFailedApply(id object.ObjMetadata) bool
- func (tc *Manager) IsFailedDelete(id object.ObjMetadata) bool
- func (tc *Manager) IsFailedReconcile(id object.ObjMetadata) bool
- func (tc *Manager) IsPendingApply(id object.ObjMetadata) bool
- func (tc *Manager) IsPendingDelete(id object.ObjMetadata) bool
- func (tc *Manager) IsPendingReconcile(id object.ObjMetadata) bool
- func (tc *Manager) IsSkippedApply(id object.ObjMetadata) bool
- func (tc *Manager) IsSkippedDelete(id object.ObjMetadata) bool
- func (tc *Manager) IsSkippedReconcile(id object.ObjMetadata) bool
- func (tc *Manager) IsSuccessfulApply(id object.ObjMetadata) bool
- func (tc *Manager) IsSuccessfulDelete(id object.ObjMetadata) bool
- func (tc *Manager) IsSuccessfulReconcile(id object.ObjMetadata) bool
- func (tc *Manager) IsTimeoutReconcile(id object.ObjMetadata) bool
- func (tc *Manager) ObjectStatus(id object.ObjMetadata) (*actuation.ObjectStatus, bool)
- func (tc *Manager) ObjectsWithActuationStatus(strategy actuation.ActuationStrategy, status actuation.ActuationStatus) object.ObjMetadataSet
- func (tc *Manager) ObjectsWithReconcileStatus(status actuation.ReconcileStatus) object.ObjMetadataSet
- func (tc *Manager) PendingApplies() object.ObjMetadataSet
- func (tc *Manager) PendingDeletes() object.ObjMetadataSet
- func (tc *Manager) PendingReconciles() object.ObjMetadataSet
- func (tc *Manager) SetFailedReconcile(id object.ObjMetadata) error
- func (tc *Manager) SetObjectStatus(newObjStatus actuation.ObjectStatus)
- func (tc *Manager) SetPendingReconcile(id object.ObjMetadata) error
- func (tc *Manager) SetSkippedReconcile(id object.ObjMetadata) error
- func (tc *Manager) SetSuccessfulReconcile(id object.ObjMetadata) error
- func (tc *Manager) SetTimeoutReconcile(id object.ObjMetadata) error
- func (tc *Manager) SkippedApplies() object.ObjMetadataSet
- func (tc *Manager) SkippedDeletes() object.ObjMetadataSet
- func (tc *Manager) SkippedReconciles() object.ObjMetadataSet
- func (tc *Manager) SuccessfulApplies() object.ObjMetadataSet
- func (tc *Manager) SuccessfulDeletes() object.ObjMetadataSet
- func (tc *Manager) SuccessfulReconciles() object.ObjMetadataSet
- func (tc *Manager) TimeoutReconciles() object.ObjMetadataSet
- type MultipleInventoryObjError
- type NoInventoryObjError
- type Policy
- type PolicyPreventedActuationError
- type StatusPolicy
- type Storage
- type StorageFactoryFunc
- type Strategy
- type ToUnstructuredFunc
Constants ¶
const OwningInventoryKey = "config.k8s.io/owning-inventory"
OwningInventoryKey is the annotation key indicating the inventory owning an object.
Variables ¶
This section is empty.
Functions ¶
func AddInventoryIDAnnotation ¶ added in v0.22.2
func AddInventoryIDAnnotation(obj *unstructured.Unstructured, inv Info)
func CanApply ¶ added in v0.22.2
func CanApply(inv Info, obj *unstructured.Unstructured, policy Policy) (bool, error)
func CanPrune ¶ added in v0.22.2
func CanPrune(inv Info, obj *unstructured.Unstructured, policy Policy) (bool, error)
func FindInventoryObj ¶
func FindInventoryObj(objs object.UnstructuredSet) *unstructured.Unstructured
FindInventoryObj returns the "Inventory" object (ConfigMap with inventory label) if it exists, or nil if it does not exist.
func InvInfoToConfigMap ¶ added in v0.22.0
func InvInfoToConfigMap(inv Info) *unstructured.Unstructured
func IsInventoryObject ¶
func IsInventoryObject(obj *unstructured.Unstructured) bool
IsInventoryObject returns true if the passed object has the inventory label.
func ObjMetadataFromObjectReference ¶ added in v0.28.0
func ObjMetadataFromObjectReference(ref actuation.ObjectReference) object.ObjMetadata
ObjMetadataFromObjectReference converts an ObjectReference to a ObjMetadata
func ObjectReferenceFromObjMetadata ¶ added in v0.28.0
func ObjectReferenceFromObjMetadata(id object.ObjMetadata) actuation.ObjectReference
ObjectReferenceFromObjMetadata converts an ObjMetadata to a ObjectReference
func SplitUnstructureds ¶ added in v0.21.0
func SplitUnstructureds(objs object.UnstructuredSet) (*unstructured.Unstructured, object.UnstructuredSet, error)
splitUnstructureds takes a set of unstructured.Unstructured objects and splits it into one set that contains the inventory object templates and another one that contains the remaining resources. If there is no inventory object the first return value is nil. Returns an error if there are more than one inventory objects.
func ValidateNoInventory ¶ added in v0.21.1
func ValidateNoInventory(objs object.UnstructuredSet) error
ValidateNoInventory takes a set of unstructured.Unstructured objects and validates that no inventory object is in the input slice.
Types ¶
type Client ¶ added in v0.28.0
type Client interface { // GetClusterObjs returns the set of previously applied objects as ObjMetadata, // or an error if one occurred. This set of previously applied object references // is stored in the inventory objects living in the cluster. GetClusterObjs(inv Info) (object.ObjMetadataSet, error) // Merge applies the union of the passed objects with the currently // stored objects in the inventory object. Returns the set of // objects which are not in the passed objects (objects to be pruned). // Otherwise, returns an error if one happened. Merge(inv Info, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) (object.ObjMetadataSet, error) // Replace replaces the set of objects stored in the inventory // object with the passed set of objects, or an error if one occurs. Replace(inv Info, objs object.ObjMetadataSet, status []actuation.ObjectStatus, dryRun common.DryRunStrategy) error // DeleteInventoryObj deletes the passed inventory object from the APIServer. DeleteInventoryObj(inv Info, dryRun common.DryRunStrategy) error // ApplyInventoryNamespace applies the Namespace that the inventory object should be in. ApplyInventoryNamespace(invNamespace *unstructured.Unstructured, dryRun common.DryRunStrategy) error // GetClusterInventoryInfo returns the cluster inventory object. GetClusterInventoryInfo(inv Info) (*unstructured.Unstructured, error) // GetClusterInventoryObjs looks up the inventory objects from the cluster. GetClusterInventoryObjs(inv Info) (object.UnstructuredSet, error) }
Client expresses an interface for interacting with objects which store references to objects (inventory objects).
type ClientFactory ¶ added in v0.28.0
ClientFactory is a factory that constructs new Client instances.
type ClusterClient ¶ added in v0.28.0
type ClusterClient struct { InventoryFactoryFunc StorageFactoryFunc // contains filtered or unexported fields }
ClusterClient is a concrete implementation of the Client interface.
func NewClient ¶ added in v0.28.0
func NewClient(factory cmdutil.Factory, invFunc StorageFactoryFunc, invToUnstructuredFunc ToUnstructuredFunc, statusPolicy StatusPolicy, ) (*ClusterClient, error)
NewClient returns a concrete implementation of the Client interface or an error.
func (*ClusterClient) ApplyInventoryNamespace ¶ added in v0.28.0
func (cic *ClusterClient) ApplyInventoryNamespace(obj *unstructured.Unstructured, dryRun common.DryRunStrategy) error
ApplyInventoryNamespace creates the passed namespace if it does not already exist, or returns an error if one happened. NOTE: No error if already exists.
func (*ClusterClient) DeleteInventoryObj ¶ added in v0.28.0
func (cic *ClusterClient) DeleteInventoryObj(localInv Info, dryRun common.DryRunStrategy) error
DeleteInventoryObj deletes the inventory object from the cluster.
func (*ClusterClient) GetClusterInventoryInfo ¶ added in v0.28.0
func (cic *ClusterClient) GetClusterInventoryInfo(inv Info) (*unstructured.Unstructured, error)
getClusterInventoryObj returns a pointer to the cluster inventory object, or an error if one occurred. Returns the cached cluster inventory object if it has been previously retrieved. Uses the ResourceBuilder to retrieve the inventory object in the cluster, using the namespace, group resource, and inventory label. Merges multiple inventory objects into one if it retrieves more than one (this should be very rare).
TODO(seans3): Remove the special case code to merge multiple cluster inventory objects once we've determined that this case is no longer possible.
func (*ClusterClient) GetClusterInventoryObjs ¶ added in v0.28.0
func (cic *ClusterClient) GetClusterInventoryObjs(inv Info) (object.UnstructuredSet, error)
func (*ClusterClient) GetClusterObjs ¶ added in v0.28.0
func (cic *ClusterClient) GetClusterObjs(localInv Info) (object.ObjMetadataSet, error)
GetClusterObjs returns the objects stored in the cluster inventory object, or an error if one occurred.
func (*ClusterClient) Merge ¶ added in v0.28.0
func (cic *ClusterClient) Merge(localInv Info, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) (object.ObjMetadataSet, error)
Merge stores the union of the passed objects with the objects currently stored in the cluster inventory object. Retrieves and caches the cluster inventory object. Returns the set differrence of the cluster inventory objects and the currently applied objects. This is the set of objects to prune. Creates the initial cluster inventory object storing the passed objects if an inventory object does not exist. Returns an error if one occurred.
func (*ClusterClient) Replace ¶ added in v0.28.0
func (cic *ClusterClient) Replace(localInv Info, objs object.ObjMetadataSet, status []actuation.ObjectStatus, dryRun common.DryRunStrategy) error
Replace stores the passed objects in the cluster inventory object, or an error if one occurred.
type ClusterClientFactory ¶ added in v0.28.0
type ClusterClientFactory struct {
StatusPolicy StatusPolicy
}
ClusterClientFactory is a factory that creates instances of ClusterClient inventory client.
type ConfigMap ¶ added in v0.28.0
type ConfigMap struct {
// contains filtered or unexported fields
}
ConfigMap wraps a ConfigMap resource and implements the Inventory interface. This wrapper loads and stores the object metadata (inventory) to and from the wrapped ConfigMap.
func (*ConfigMap) Apply ¶ added in v0.32.0
func (icm *ConfigMap) Apply(dc dynamic.Interface, mapper meta.RESTMapper, _ StatusPolicy) error
Apply is an Storage interface function implemented to apply the inventory object. StatusPolicy is not needed since ConfigMaps do not have a status subresource.
func (*ConfigMap) ApplyWithPrune ¶ added in v0.32.0
func (icm *ConfigMap) ApplyWithPrune(dc dynamic.Interface, mapper meta.RESTMapper, _ StatusPolicy, _ object.ObjMetadataSet) error
ApplyWithPrune is a Storage interface function implemented to apply the inventory object with a list of objects to be pruned. StatusPolicy is not needed since ConfigMaps do not have a status subresource.
func (*ConfigMap) GetObject ¶ added in v0.28.0
func (icm *ConfigMap) GetObject() (*unstructured.Unstructured, error)
GetObject returns the wrapped object (ConfigMap) as a resource.Info or an error if one occurs.
func (*ConfigMap) Load ¶ added in v0.28.0
func (icm *ConfigMap) Load() (object.ObjMetadataSet, error)
Load is an Inventory interface function returning the set of object metadata from the wrapped ConfigMap, or an error.
func (*ConfigMap) Store ¶ added in v0.28.0
func (icm *ConfigMap) Store(objMetas object.ObjMetadataSet, status []actuation.ObjectStatus) error
Store is an Inventory interface function implemented to store the object metadata in the wrapped ConfigMap. Actual storing happens in "GetObject".
func (*ConfigMap) UnstructuredInventory ¶ added in v0.28.0
func (icm *ConfigMap) UnstructuredInventory() *unstructured.Unstructured
type FakeBuilder ¶ added in v0.18.0
type FakeBuilder struct {
// contains filtered or unexported fields
}
FakeBuilder encapsulates a resource Builder which will hard-code the return of an inventory object with the encoded past invObjs.
func (*FakeBuilder) GetBuilder ¶ added in v0.18.0
func (fb *FakeBuilder) GetBuilder() func() *resource.Builder
Returns the fake resource Builder with the fake client, test restmapper, and the fake category expander.
func (*FakeBuilder) SetInventoryObjs ¶ added in v0.18.0
func (fb *FakeBuilder) SetInventoryObjs(objs object.ObjMetadataSet)
SetInventoryObjs sets the objects which will be encoded in an inventory object to be returned when queried for the cluster inventory object.
type FakeClient ¶ added in v0.28.0
type FakeClient struct { Objs object.ObjMetadataSet Status []actuation.ObjectStatus Err error }
FakeClient is a testing implementation of the Client interface.
func NewFakeClient ¶ added in v0.28.0
func NewFakeClient(initObjs object.ObjMetadataSet) *FakeClient
NewFakeClient returns a FakeClient.
func (*FakeClient) ApplyInventoryNamespace ¶ added in v0.28.0
func (fic *FakeClient) ApplyInventoryNamespace(*unstructured.Unstructured, common.DryRunStrategy) error
func (*FakeClient) ClearError ¶ added in v0.28.0
func (fic *FakeClient) ClearError()
ClearError clears the force error
func (*FakeClient) DeleteInventoryObj ¶ added in v0.28.0
func (fic *FakeClient) DeleteInventoryObj(Info, common.DryRunStrategy) error
DeleteInventoryObj returns an error if one is forced; does nothing otherwise.
func (*FakeClient) GetClusterInventoryInfo ¶ added in v0.28.0
func (fic *FakeClient) GetClusterInventoryInfo(Info) (*unstructured.Unstructured, error)
func (*FakeClient) GetClusterInventoryObjs ¶ added in v0.28.0
func (fic *FakeClient) GetClusterInventoryObjs(_ Info) (object.UnstructuredSet, error)
func (*FakeClient) GetClusterObjs ¶ added in v0.28.0
func (fic *FakeClient) GetClusterObjs(Info) (object.ObjMetadataSet, error)
GetClusterObjs returns currently stored set of objects.
func (*FakeClient) Merge ¶ added in v0.28.0
func (fic *FakeClient) Merge(_ Info, objs object.ObjMetadataSet, _ common.DryRunStrategy) (object.ObjMetadataSet, error)
Merge stores the passed objects with the current stored cluster inventory objects. Returns the set difference of the current set of objects minus the passed set of objects, or an error if one is set up.
func (*FakeClient) Replace ¶ added in v0.28.0
func (fic *FakeClient) Replace(_ Info, objs object.ObjMetadataSet, status []actuation.ObjectStatus, _ common.DryRunStrategy) error
Replace the stored cluster inventory objs with the passed obj, or an error if one is set up.
func (*FakeClient) SetError ¶ added in v0.28.0
func (fic *FakeClient) SetError(err error)
SetError forces an error on the subsequent client call if it returns an error.
type FakeClientFactory ¶ added in v0.28.0
type FakeClientFactory object.ObjMetadataSet
type IDMatchStatus ¶ added in v0.28.0
type IDMatchStatus int
IDMatchStatus represents the result of comparing the id from current inventory info and the inventory-id from a live object.
const ( Empty IDMatchStatus = iota Match NoMatch )
func IDMatch ¶ added in v0.28.0
func IDMatch(inv Info, obj *unstructured.Unstructured) IDMatchStatus
func (IDMatchStatus) String ¶ added in v0.28.0
func (i IDMatchStatus) String() string
type Info ¶ added in v0.28.0
type Info interface { // Namespace of the inventory object. // It should be the value of the field .metadata.namespace. Namespace() string // Name of the inventory object. // It should be the value of the field .metadata.name. Name() string // ID of the inventory object. It is optional. // The Provider contained in the applier should know // if the Id is necessary and how to use it for pruning objects. ID() string Strategy() Strategy }
Info provides the minimal information for the applier to create, look up and update an inventory. The inventory object can be any type, the Provider in the applier needs to know how to create, look up and update it based on the Info.
func WrapInventoryInfoObj ¶ added in v0.22.0
func WrapInventoryInfoObj(inv *unstructured.Unstructured) Info
WrapInventoryInfoObj takes a passed ConfigMap (as a resource.Info), wraps it with the ConfigMap and upcasts the wrapper as an the Info interface.
type Manager ¶ added in v0.28.0
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps an Inventory with convenience methods that use ObjMetadata.
func NewManager ¶ added in v0.28.0
func NewManager() *Manager
NewManager returns a new manager instance.
func (*Manager) AddFailedApply ¶ added in v0.28.0
func (tc *Manager) AddFailedApply(id object.ObjMetadata)
AddFailedApply registers that the object failed to apply
func (*Manager) AddFailedDelete ¶ added in v0.28.0
func (tc *Manager) AddFailedDelete(id object.ObjMetadata)
AddFailedDelete registers that the object failed to delete
func (*Manager) AddPendingApply ¶ added in v0.29.0
func (tc *Manager) AddPendingApply(id object.ObjMetadata)
AddPendingApply registers that the object is pending apply
func (*Manager) AddPendingDelete ¶ added in v0.29.0
func (tc *Manager) AddPendingDelete(id object.ObjMetadata)
AddPendingDelete registers that the object is pending delete
func (*Manager) AddSkippedApply ¶ added in v0.28.0
func (tc *Manager) AddSkippedApply(id object.ObjMetadata)
AddSkippedApply registers that the object apply was skipped
func (*Manager) AddSkippedDelete ¶ added in v0.28.0
func (tc *Manager) AddSkippedDelete(id object.ObjMetadata)
AddSkippedDelete registers that the object delete was skipped
func (*Manager) AddSuccessfulApply ¶ added in v0.28.0
AddSuccessfulApply updates the context with information about the resource identified by the provided id. Currently, we keep information about the generation of the resource after the apply operation completed.
func (*Manager) AddSuccessfulDelete ¶ added in v0.28.0
func (tc *Manager) AddSuccessfulDelete(id object.ObjMetadata, uid types.UID)
AddSuccessfulDelete updates the context with information about the resource identified by the provided id. Currently, we only track the uid, because the DELETE call doesn't always return the generation, namely if the object was scheduled to be deleted asynchronously, which might cause further updates by finalizers. The UID will change if the object is re-created.
func (*Manager) AppliedGeneration ¶ added in v0.28.0
func (tc *Manager) AppliedGeneration(id object.ObjMetadata) (int64, bool)
AppliedGeneration looks up the generation of the given resource after it was applied.
func (*Manager) AppliedResourceUID ¶ added in v0.28.0
AppliedResourceUID looks up the UID of a successfully applied resource
func (*Manager) AppliedResourceUIDs ¶ added in v0.28.0
AppliedResourceUIDs returns a set with the UIDs of all the successfully applied resources.
func (*Manager) FailedApplies ¶ added in v0.28.0
func (tc *Manager) FailedApplies() object.ObjMetadataSet
FailedApplies returns all the objects that failed to apply
func (*Manager) FailedDeletes ¶ added in v0.28.0
func (tc *Manager) FailedDeletes() object.ObjMetadataSet
FailedDeletes returns all the objects that failed to delete
func (*Manager) FailedReconciles ¶ added in v0.28.0
func (tc *Manager) FailedReconciles() object.ObjMetadataSet
FailedReconciles returns all the objects that failed to reconcile
func (*Manager) Inventory ¶ added in v0.28.0
Inventory returns the in-memory version of the managed inventory.
func (*Manager) IsFailedApply ¶ added in v0.28.0
func (tc *Manager) IsFailedApply(id object.ObjMetadata) bool
IsFailedApply returns true if the object failed to apply
func (*Manager) IsFailedDelete ¶ added in v0.28.0
func (tc *Manager) IsFailedDelete(id object.ObjMetadata) bool
IsFailedDelete returns true if the object failed to delete
func (*Manager) IsFailedReconcile ¶ added in v0.28.0
func (tc *Manager) IsFailedReconcile(id object.ObjMetadata) bool
IsFailedReconcile returns true if the object failed to reconcile
func (*Manager) IsPendingApply ¶ added in v0.29.0
func (tc *Manager) IsPendingApply(id object.ObjMetadata) bool
IsPendingApply returns true if the object pending apply
func (*Manager) IsPendingDelete ¶ added in v0.29.0
func (tc *Manager) IsPendingDelete(id object.ObjMetadata) bool
IsPendingDelete returns true if the object pending delete
func (*Manager) IsPendingReconcile ¶ added in v0.28.0
func (tc *Manager) IsPendingReconcile(id object.ObjMetadata) bool
IsPendingReconcile returns true if the object reconcile is pending
func (*Manager) IsSkippedApply ¶ added in v0.28.0
func (tc *Manager) IsSkippedApply(id object.ObjMetadata) bool
IsSkippedApply returns true if the object apply was skipped
func (*Manager) IsSkippedDelete ¶ added in v0.28.0
func (tc *Manager) IsSkippedDelete(id object.ObjMetadata) bool
IsSkippedDelete returns true if the object delete was skipped
func (*Manager) IsSkippedReconcile ¶ added in v0.28.0
func (tc *Manager) IsSkippedReconcile(id object.ObjMetadata) bool
IsSkippedReconcile returns true if the object reconcile was skipped
func (*Manager) IsSuccessfulApply ¶ added in v0.28.0
func (tc *Manager) IsSuccessfulApply(id object.ObjMetadata) bool
IsSuccessfulApply returns true if the object apply was successful
func (*Manager) IsSuccessfulDelete ¶ added in v0.28.0
func (tc *Manager) IsSuccessfulDelete(id object.ObjMetadata) bool
IsSuccessfulDelete returns true if the object delete was successful
func (*Manager) IsSuccessfulReconcile ¶ added in v0.28.0
func (tc *Manager) IsSuccessfulReconcile(id object.ObjMetadata) bool
IsSuccessfulReconcile returns true if the object is reconciled
func (*Manager) IsTimeoutReconcile ¶ added in v0.28.0
func (tc *Manager) IsTimeoutReconcile(id object.ObjMetadata) bool
IsTimeoutReconcile returns true if the object reconcile was skipped
func (*Manager) ObjectStatus ¶ added in v0.28.0
func (tc *Manager) ObjectStatus(id object.ObjMetadata) (*actuation.ObjectStatus, bool)
ObjectStatus retrieves the status of an object with the specified ID. The returned status is a pointer and can be updated in-place for efficiency.
func (*Manager) ObjectsWithActuationStatus ¶ added in v0.28.0
func (tc *Manager) ObjectsWithActuationStatus(strategy actuation.ActuationStrategy, status actuation.ActuationStatus) object.ObjMetadataSet
ObjectsWithActuationStatus retrieves the set of objects with the specified actuation strategy and status.
func (*Manager) ObjectsWithReconcileStatus ¶ added in v0.28.0
func (tc *Manager) ObjectsWithReconcileStatus(status actuation.ReconcileStatus) object.ObjMetadataSet
ObjectsWithActuationStatus retrieves the set of objects with the specified reconcile status, regardless of actuation strategy.
func (*Manager) PendingApplies ¶ added in v0.29.0
func (tc *Manager) PendingApplies() object.ObjMetadataSet
PendingApplies returns all the objects that are pending apply
func (*Manager) PendingDeletes ¶ added in v0.29.0
func (tc *Manager) PendingDeletes() object.ObjMetadataSet
PendingDeletes returns all the objects that are pending delete
func (*Manager) PendingReconciles ¶ added in v0.28.0
func (tc *Manager) PendingReconciles() object.ObjMetadataSet
PendingReconciles returns all the objects where reconcile is pending
func (*Manager) SetFailedReconcile ¶ added in v0.28.0
func (tc *Manager) SetFailedReconcile(id object.ObjMetadata) error
SetFailedReconcile registers that the object failed to reconcile
func (*Manager) SetObjectStatus ¶ added in v0.28.0
func (tc *Manager) SetObjectStatus(newObjStatus actuation.ObjectStatus)
SetObjectStatus updates or adds an ObjectStatus record to the inventory.
func (*Manager) SetPendingReconcile ¶ added in v0.28.0
func (tc *Manager) SetPendingReconcile(id object.ObjMetadata) error
SetPendingReconcile registers that the object reconcile is pending
func (*Manager) SetSkippedReconcile ¶ added in v0.28.0
func (tc *Manager) SetSkippedReconcile(id object.ObjMetadata) error
SetSkippedReconcile registers that the object reconcile was skipped
func (*Manager) SetSuccessfulReconcile ¶ added in v0.28.0
func (tc *Manager) SetSuccessfulReconcile(id object.ObjMetadata) error
SetSuccessfulReconcile registers that the object is reconciled
func (*Manager) SetTimeoutReconcile ¶ added in v0.28.0
func (tc *Manager) SetTimeoutReconcile(id object.ObjMetadata) error
SetTimeoutReconcile registers that the object reconcile was skipped
func (*Manager) SkippedApplies ¶ added in v0.28.0
func (tc *Manager) SkippedApplies() object.ObjMetadataSet
SkippedApplies returns all the objects where apply was skipped
func (*Manager) SkippedDeletes ¶ added in v0.28.0
func (tc *Manager) SkippedDeletes() object.ObjMetadataSet
SkippedDeletes returns all the objects where deletion was skipped
func (*Manager) SkippedReconciles ¶ added in v0.28.0
func (tc *Manager) SkippedReconciles() object.ObjMetadataSet
SkippedReconciles returns all the objects where reconcile was skipped
func (*Manager) SuccessfulApplies ¶ added in v0.28.0
func (tc *Manager) SuccessfulApplies() object.ObjMetadataSet
SuccessfulApplies returns all the objects (as ObjMetadata) that were added as applied resources to the Manager.
func (*Manager) SuccessfulDeletes ¶ added in v0.28.0
func (tc *Manager) SuccessfulDeletes() object.ObjMetadataSet
SuccessfulDeletes returns all the objects (as ObjMetadata) that were successfully deleted.
func (*Manager) SuccessfulReconciles ¶ added in v0.28.0
func (tc *Manager) SuccessfulReconciles() object.ObjMetadataSet
SuccessfulReconciles returns all the reconciled objects
func (*Manager) TimeoutReconciles ¶ added in v0.28.0
func (tc *Manager) TimeoutReconciles() object.ObjMetadataSet
TimeoutReconciles returns all the objects where reconcile was skipped
type MultipleInventoryObjError ¶
type MultipleInventoryObjError struct {
InventoryObjectTemplates object.UnstructuredSet
}
func (*MultipleInventoryObjError) Error ¶
func (e *MultipleInventoryObjError) Error() string
func (*MultipleInventoryObjError) Is ¶ added in v0.30.0
func (e *MultipleInventoryObjError) Is(err error) bool
Is returns true if the specified error is equal to this error. Use errors.Is(error) to recursively check if an error wraps this error.
type NoInventoryObjError ¶
type NoInventoryObjError struct{}
func (*NoInventoryObjError) Error ¶
func (e *NoInventoryObjError) Error() string
func (*NoInventoryObjError) Is ¶ added in v0.30.0
func (e *NoInventoryObjError) Is(err error) bool
Is returns true if the specified error is equal to this error. Use errors.Is(error) to recursively check if an error wraps this error.
type Policy ¶ added in v0.28.0
type Policy int
Policy defines if an inventory object can take over objects that belong to another inventory object or don't belong to any inventory object. This is done by determining if the apply/prune operation can go through for a resource based on the comparison the inventory-id value in the package and the owning-inventory annotation in the live object.
const ( // PolicyMustMatch: This policy enforces that the resources being applied can not // have any overlap with objects in other inventories or objects that already exist // in the cluster but don't belong to an inventory. // // The apply operation can go through when // - A new resources in the package doesn't exist in the cluster // - An existing resource in the package doesn't exist in the cluster // - An existing resource exist in the cluster. The owning-inventory annotation in the live object // matches with that in the package. // // The prune operation can go through when // - The owning-inventory annotation in the live object match with that // in the package. PolicyMustMatch Policy = iota // MustMatch // PolicyAdoptIfNoInventory: This policy enforces that resources being applied // can not have any overlap with objects in other inventories, but are // permitted to take ownership of objects that don't belong to any inventories. // // The apply operation can go through when // - New resource in the package doesn't exist in the cluster // - If a new resource exist in the cluster, its owning-inventory annotation is empty // - Existing resource in the package doesn't exist in the cluster // - If existing resource exist in the cluster, its owning-inventory annotation in the live object // is empty // - An existing resource exist in the cluster. The owning-inventory annotation in the live object // matches with that in the package. // // The prune operation can go through when // - The owning-inventory annotation in the live object match with that // in the package. // - The live object doesn't have the owning-inventory annotation. PolicyAdoptIfNoInventory // AdoptIfNoInventory // PolicyAdoptAll: This policy will let the current inventory take ownership of any objects. // // The apply operation can go through for any resource in the package even if the // live object has an unmatched owning-inventory annotation. // // The prune operation can go through when // - The owning-inventory annotation in the live object match or doesn't match with that // in the package. // - The live object doesn't have the owning-inventory annotation. PolicyAdoptAll // AdoptAll )
type PolicyPreventedActuationError ¶ added in v0.30.0
type PolicyPreventedActuationError struct { Strategy actuation.ActuationStrategy Policy Policy Status IDMatchStatus }
func (*PolicyPreventedActuationError) Error ¶ added in v0.30.0
func (e *PolicyPreventedActuationError) Error() string
func (*PolicyPreventedActuationError) Is ¶ added in v0.30.0
func (e *PolicyPreventedActuationError) Is(err error) bool
Is returns true if the specified error is equal to this error. Use errors.Is(error) to recursively check if an error wraps this error.
type StatusPolicy ¶ added in v0.29.3
type StatusPolicy int
StatusPolicy specifies whether the inventory client should apply status to the inventory object. The status contains the actuation and reconcile stauts of each object in the inventory.
const ( // StatusPolicyNone disables inventory status updates. StatusPolicyNone StatusPolicy = iota // None // StatusPolicyAll fully enables inventory status updates. StatusPolicyAll // All )
func (StatusPolicy) String ¶ added in v0.29.3
func (i StatusPolicy) String() string
type Storage ¶ added in v0.28.0
type Storage interface { // Load retrieves the set of object metadata from the inventory object Load() (object.ObjMetadataSet, error) // Store the set of object metadata in the inventory object. This will // replace the metadata, spec and status. Store(objs object.ObjMetadataSet, status []actuation.ObjectStatus) error // GetObject returns the object that stores the inventory GetObject() (*unstructured.Unstructured, error) // Apply applies the inventory object. This utility function is used // in InventoryClient.Merge and merges the metadata, spec and status. Apply(dynamic.Interface, meta.RESTMapper, StatusPolicy) error // ApplyWithPrune applies the inventory object with a set of pruneIDs of // objects to be pruned (object.ObjMetadataSet). This function is used in // InventoryClient.Replace. pruneIDs are required for enabling custom logic // handling of multiple ResourceGroup inventories. ApplyWithPrune(dynamic.Interface, meta.RESTMapper, StatusPolicy, object.ObjMetadataSet) error }
Storage describes methods necessary for an object which can persist the object metadata for pruning and other group operations.
func WrapInventoryObj ¶
func WrapInventoryObj(inv *unstructured.Unstructured) Storage
WrapInventoryObj takes a passed ConfigMap (as a resource.Info), wraps it with the ConfigMap and upcasts the wrapper as an the Inventory interface.
type StorageFactoryFunc ¶ added in v0.28.0
type StorageFactoryFunc func(*unstructured.Unstructured) Storage
StorageFactoryFunc creates the object which implements the Inventory interface from the passed info object.
type ToUnstructuredFunc ¶ added in v0.28.0
type ToUnstructuredFunc func(Info) *unstructured.Unstructured
ToUnstructuredFunc returns the unstructured object for the given Info.