Documentation ¶
Index ¶
- func FindInventoryObj(infos []*resource.Info) *resource.Info
- func IsInventoryObject(info *resource.Info) bool
- func SplitInfos(infos []*resource.Info) (*resource.Info, []*resource.Info, error)
- type ClusterInventoryClient
- func (cic *ClusterInventoryClient) ApplyInventoryNamespace(info *resource.Info) error
- func (cic *ClusterInventoryClient) DeleteInventoryObj(info *resource.Info) error
- func (cic *ClusterInventoryClient) GetClusterObjs(localInv *resource.Info) ([]object.ObjMetadata, error)
- func (cic *ClusterInventoryClient) Merge(localInv *resource.Info, objs []object.ObjMetadata) ([]object.ObjMetadata, error)
- func (cic *ClusterInventoryClient) Replace(localInv *resource.Info, objs []object.ObjMetadata) error
- func (cic *ClusterInventoryClient) SetDryRunStrategy(drs common.DryRunStrategy)
- type FakeBuilder
- type FakeInventoryClient
- func (fic *FakeInventoryClient) ApplyInventoryNamespace(info *resource.Info) error
- func (fic *FakeInventoryClient) ClearError()
- func (fic *FakeInventoryClient) DeleteInventoryObj(inv *resource.Info) error
- func (fic *FakeInventoryClient) GetClusterObjs(inv *resource.Info) ([]object.ObjMetadata, error)
- func (fic *FakeInventoryClient) Merge(inv *resource.Info, objs []object.ObjMetadata) ([]object.ObjMetadata, error)
- func (fic *FakeInventoryClient) Replace(inv *resource.Info, objs []object.ObjMetadata) error
- func (fic *FakeInventoryClient) SetDryRunStrategy(drs common.DryRunStrategy)
- func (fic *FakeInventoryClient) SetError(err error)
- type Inventory
- type InventoryClient
- type InventoryConfigMap
- type InventoryFactoryFunc
- type InventoryNamespaceInSet
- type MultipleInventoryObjError
- type NoInventoryObjError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindInventoryObj ¶
FindInventoryObj returns the "Inventory" object (ConfigMap with inventory label) if it exists, or nil if it does not exist.
func IsInventoryObject ¶
IsInventoryObject returns true if the passed object has the inventory label.
Types ¶
type ClusterInventoryClient ¶
type ClusterInventoryClient struct { InventoryFactoryFunc InventoryFactoryFunc // contains filtered or unexported fields }
ClusterInventoryClient is a concrete implementation of the InventoryClient interface.
func NewInventoryClient ¶
func NewInventoryClient(factory cmdutil.Factory, invFunc InventoryFactoryFunc) (*ClusterInventoryClient, error)
NewInventoryClient returns a concrete implementation of the InventoryClient interface or an error.
func (*ClusterInventoryClient) ApplyInventoryNamespace ¶ added in v0.20.0
func (cic *ClusterInventoryClient) ApplyInventoryNamespace(info *resource.Info) 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 (*ClusterInventoryClient) DeleteInventoryObj ¶ added in v0.18.0
func (cic *ClusterInventoryClient) DeleteInventoryObj(info *resource.Info) error
DeleteInventoryObj deletes the passed inventory object from the APIServer, or an error if one occurs.
func (*ClusterInventoryClient) GetClusterObjs ¶ added in v0.18.0
func (cic *ClusterInventoryClient) GetClusterObjs(localInv *resource.Info) ([]object.ObjMetadata, error)
GetClusterObjs returns the objects stored in the cluster inventory object, or an error if one occurred.
func (*ClusterInventoryClient) Merge ¶ added in v0.18.0
func (cic *ClusterInventoryClient) Merge(localInv *resource.Info, objs []object.ObjMetadata) ([]object.ObjMetadata, 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 (*ClusterInventoryClient) Replace ¶ added in v0.18.0
func (cic *ClusterInventoryClient) Replace(localInv *resource.Info, objs []object.ObjMetadata) error
Replace stores the passed objects in the cluster inventory object, or an error if one occurred.
func (*ClusterInventoryClient) SetDryRunStrategy ¶ added in v0.18.0
func (cic *ClusterInventoryClient) SetDryRunStrategy(drs common.DryRunStrategy)
SetDryRun sets whether the inventory client will mutate the inventory object in the cluster.
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.ObjMetadata)
SetInventoryObjs sets the objects which will be encoded in an inventory object to be returned when queried for the cluster inventory object.
type FakeInventoryClient ¶
type FakeInventoryClient struct { Objs []object.ObjMetadata Err error }
FakeInventoryClient is a testing implementation of the InventoryClient interface.
func NewFakeInventoryClient ¶
func NewFakeInventoryClient(initObjs []object.ObjMetadata) *FakeInventoryClient
NewFakeInventoryClient returns a FakeInventoryClient.
func (*FakeInventoryClient) ApplyInventoryNamespace ¶ added in v0.20.0
func (fic *FakeInventoryClient) ApplyInventoryNamespace(info *resource.Info) error
func (*FakeInventoryClient) ClearError ¶ added in v0.18.0
func (fic *FakeInventoryClient) ClearError()
ClearError clears the force error
func (*FakeInventoryClient) DeleteInventoryObj ¶ added in v0.18.0
func (fic *FakeInventoryClient) DeleteInventoryObj(inv *resource.Info) error
DeleteInventoryObj returns an error if one is forced; does nothing otherwise.
func (*FakeInventoryClient) GetClusterObjs ¶ added in v0.18.0
func (fic *FakeInventoryClient) GetClusterObjs(inv *resource.Info) ([]object.ObjMetadata, error)
GetClusterObjs returns currently stored set of objects.
func (*FakeInventoryClient) Merge ¶ added in v0.18.0
func (fic *FakeInventoryClient) Merge(inv *resource.Info, objs []object.ObjMetadata) ([]object.ObjMetadata, 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 (*FakeInventoryClient) Replace ¶ added in v0.18.0
func (fic *FakeInventoryClient) Replace(inv *resource.Info, objs []object.ObjMetadata) error
Replace the stored cluster inventory objs with the passed obj, or an error if one is set up.
func (*FakeInventoryClient) SetDryRunStrategy ¶ added in v0.18.0
func (fic *FakeInventoryClient) SetDryRunStrategy(drs common.DryRunStrategy)
func (*FakeInventoryClient) SetError ¶ added in v0.18.0
func (fic *FakeInventoryClient) SetError(err error)
SetError forces an error on the subsequent client call if it returns an error.
type Inventory ¶
type Inventory interface { // Load retrieves the set of object metadata from the inventory object Load() ([]object.ObjMetadata, error) // Store the set of object metadata in the inventory object Store(objs []object.ObjMetadata) error // GetObject returns the object that stores the inventory GetObject() (*resource.Info, error) }
Inventory describes methods necessary for an object which can persist the object metadata for pruning and other group operations.
func WrapInventoryObj ¶
WrapInventoryObj takes a passed ConfigMap (as a resource.Info), wraps it with the InventoryConfigMap and upcasts the wrapper as an the Inventory interface.
type InventoryClient ¶
type InventoryClient interface { // GetCluster 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 *resource.Info) ([]object.ObjMetadata, error) // Merge applies the union of the passed objects with the currently // stored objects in the inventory object. Returns the slice of // objects which are a set diff (objects to be pruned). Otherwise, // returns an error if one happened. Merge(inv *resource.Info, objs []object.ObjMetadata) ([]object.ObjMetadata, 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 *resource.Info, objs []object.ObjMetadata) error // DeleteInventoryObj deletes the passed inventory object from the APIServer. DeleteInventoryObj(inv *resource.Info) error // SetDryRunStrategy sets the dry run strategy on whether this we actually mutate. SetDryRunStrategy(drs common.DryRunStrategy) ApplyInventoryNamespace(invNamespace *resource.Info) error }
InventoryClient expresses an interface for interacting with objects which store references to objects (inventory objects).
type InventoryConfigMap ¶
type InventoryConfigMap struct {
// contains filtered or unexported fields
}
InventoryConfigMap 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 (*InventoryConfigMap) GetObject ¶
func (icm *InventoryConfigMap) GetObject() (*resource.Info, error)
GetObject returns the wrapped object (ConfigMap) as a resource.Info or an error if one occurs.
func (*InventoryConfigMap) Load ¶
func (icm *InventoryConfigMap) Load() ([]object.ObjMetadata, error)
Load is an Inventory interface function returning the set of object metadata from the wrapped ConfigMap, or an error.
func (*InventoryConfigMap) Store ¶
func (icm *InventoryConfigMap) Store(objMetas []object.ObjMetadata) error
Store is an Inventory interface function implemented to store the object metadata in the wrapped ConfigMap. Actual storing happens in "GetObject".
type InventoryFactoryFunc ¶ added in v0.18.0
InventoryFactoryFunc creates the object which implements the Inventory interface from the passed info object.
type InventoryNamespaceInSet ¶ added in v0.18.0
type InventoryNamespaceInSet struct {
Namespace string
}
func (InventoryNamespaceInSet) Error ¶ added in v0.18.0
func (g InventoryNamespaceInSet) Error() string
type MultipleInventoryObjError ¶
func (MultipleInventoryObjError) Error ¶
func (g MultipleInventoryObjError) Error() string
type NoInventoryObjError ¶
type NoInventoryObjError struct{}
func (NoInventoryObjError) Error ¶
func (g NoInventoryObjError) Error() string