Documentation ¶
Index ¶
- type CacheConfig
- type DebugOptions
- type GVKMap
- type ObjectCache
- func (o *ObjectCache) AddPossibleGVKFromIdent(objs ...ResourceIdent)
- func (o *ObjectCache) ApplyAll() error
- func (o *ObjectCache) Create(resourceIdent ResourceIdent, nn types.NamespacedName, object client.Object) error
- func (o *ObjectCache) Debug()
- func (o *ObjectCache) Get(resourceIdent ResourceIdent, object client.Object, nn ...types.NamespacedName) error
- func (o *ObjectCache) GetScheme() *runtime.Scheme
- func (o *ObjectCache) List(resourceIdent ResourceIdentMulti, object runtime.Object) error
- func (o *ObjectCache) Reconcile(ownedUID types.UID, opts ...client.ListOption) error
- func (o *ObjectCache) Status(resourceIdent ResourceIdent, object client.Object) error
- func (o *ObjectCache) Update(resourceIdent ResourceIdent, object client.Object) error
- type ObjectToApply
- type Options
- type ResourceIdent
- type ResourceIdentMulti
- type ResourceIdentSingle
- type ResourceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type CacheConfig struct {
// contains filtered or unexported fields
}
func NewCacheConfig ¶
func NewCacheConfig(scheme *runtime.Scheme, possibleGVKs, protectedGVKs GVKMap, options ...Options) *CacheConfig
type DebugOptions ¶
type GVKMap ¶
type GVKMap map[schema.GroupVersionKind]bool
type ObjectCache ¶
type ObjectCache struct {
// contains filtered or unexported fields
}
ObjectCache is the main caching provider object. It holds references to some anciliary objects as well as a Data structure that is used to hold the K8sResources.
func NewObjectCache ¶
func NewObjectCache(ctx context.Context, kclient client.Client, logger *logr.Logger, config *CacheConfig) ObjectCache
NewObjectCache returns an instance of the ObjectCache which defers all applys until the end of the reconciliation process, and allows providers to pull objects out of the cache for modification.
func (*ObjectCache) AddPossibleGVKFromIdent ¶
func (o *ObjectCache) AddPossibleGVKFromIdent(objs ...ResourceIdent)
func (*ObjectCache) ApplyAll ¶
func (o *ObjectCache) ApplyAll() error
ApplyAll takes all the items in the cache and tries to apply them, given the boolean by the update field on the internal resource. If the update is true, then the object will by applied, if it is false, then the object will be created.
func (*ObjectCache) Create ¶
func (o *ObjectCache) Create(resourceIdent ResourceIdent, nn types.NamespacedName, object client.Object) error
Create first attempts to fetch the object from k8s for initial population. If this fails, the blank object is stored in the cache it is imperative that the user of this function call Create before modifying the obejct they wish to be placed in the cache.
func (*ObjectCache) Debug ¶
func (o *ObjectCache) Debug()
Debug prints out the contents of the cache.
func (*ObjectCache) Get ¶
func (o *ObjectCache) Get(resourceIdent ResourceIdent, object client.Object, nn ...types.NamespacedName) error
Get pulls the item from the cache and populates the given empty object. An error is returned if the items are of different types and also if the item is not in the cache. A get should be used by a downstream provider. If modifications are made to the object, it should be updated using the Update call.
func (*ObjectCache) GetScheme ¶
func (o *ObjectCache) GetScheme() *runtime.Scheme
func (*ObjectCache) List ¶
func (o *ObjectCache) List(resourceIdent ResourceIdentMulti, object runtime.Object) error
List returns a list of objects stored in the cache for the given ResourceIdent. This list behanves like a standard k8s List object although the revision cannot be relied upon. It is simply to return something that is familiar to users of k8s client-go.
func (*ObjectCache) Reconcile ¶
func (o *ObjectCache) Reconcile(ownedUID types.UID, opts ...client.ListOption) error
Reconcile performs the delete on objects that are no longer required
func (*ObjectCache) Status ¶
func (o *ObjectCache) Status(resourceIdent ResourceIdent, object client.Object) error
Status marks the object for having a status update
func (*ObjectCache) Update ¶
func (o *ObjectCache) Update(resourceIdent ResourceIdent, object client.Object) error
Update takes the item and tries to update the version in the cache. This will fail if the item is not in the cache. A previous provider should have "created" the item before it can be updated.
type ObjectToApply ¶ added in v0.9.0
type ObjectToApply struct { Ident ResourceIdent NamespacedName types.NamespacedName Resource *k8sResource }
type Options ¶
type Options struct { StrictGVK bool Ordering []string DebugOptions DebugOptions }
type ResourceIdent ¶
type ResourceIdentMulti ¶
ResourceIdent is a simple struct declaring a providers identifier and the type of resource to be put into the cache. It functions as an identifier allowing multiple objects to be returned if they all come from the same provider and have the same purpose. Think a list of Jobs created by a Job creator.
func NewMultiResourceIdent ¶
func NewMultiResourceIdent(provider string, purpose string, object client.Object, opts ...ResourceOptions) ResourceIdentMulti
NewMultiResourceIdent is a helper function that returns a ResourceIdent object.
func (ResourceIdentMulti) GetProvider ¶
func (r ResourceIdentMulti) GetProvider() string
func (ResourceIdentMulti) GetPurpose ¶
func (r ResourceIdentMulti) GetPurpose() string
func (ResourceIdentMulti) GetType ¶
func (r ResourceIdentMulti) GetType() client.Object
func (ResourceIdentMulti) GetWriteNow ¶
func (r ResourceIdentMulti) GetWriteNow() bool
type ResourceIdentSingle ¶
ResourceIdent is a simple struct declaring a providers identifier and the type of resource to be put into the cache. It functions as an identifier allowing multiple objects to be returned if they all come from the same provider and have the same purpose. Think a list of Jobs created by a Job creator.
func NewSingleResourceIdent ¶
func NewSingleResourceIdent(provider string, purpose string, object client.Object, opts ...ResourceOptions) ResourceIdentSingle
NewSingleResourceIdent is a helper function that returns a ResourceIdent object.
func (ResourceIdentSingle) GetProvider ¶
func (r ResourceIdentSingle) GetProvider() string
func (ResourceIdentSingle) GetPurpose ¶
func (r ResourceIdentSingle) GetPurpose() string
func (ResourceIdentSingle) GetType ¶
func (r ResourceIdentSingle) GetType() client.Object
func (ResourceIdentSingle) GetWriteNow ¶
func (r ResourceIdentSingle) GetWriteNow() bool
type ResourceOptions ¶
type ResourceOptions struct {
WriteNow bool
}