Documentation ¶
Overview ¶
taken from sigs.k8s.io/controller-runtime@v0.12.3/pkg/cache/internal/selector.go
Index ¶
- func FieldIndexName(field string) string
- func KeyToNamespacedKey(ns string, baseKey string) string
- type Cache
- func (c *Cache) Free(ctx context.Context, owner client.Object) error
- func (c *Cache) Get(ctx context.Context, key client.ObjectKey, out client.Object, ...) error
- func (c *Cache) List(ctx context.Context, out client.ObjectList, opts ...client.ListOption) error
- func (c *Cache) OwnersForGKV(gvk schema.GroupVersionKind) []OwnerReference
- func (c *Cache) Source() source.Source
- func (c *Cache) Start(context.Context) error
- func (c *Cache) String() string
- func (c *Cache) Watch(ctx context.Context, owner client.Object, obj runtime.Object) error
- type CacheNotStartedError
- type CacheOption
- type CacheOptions
- type CacheReader
- type EnqueueWatchingObjects
- func (e *EnqueueWatchingObjects) Create(_ context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueWatchingObjects) Delete(_ context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueWatchingObjects) Generic(_ context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueWatchingObjects) Update(_ context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type FieldIndexer
- type FieldIndexersByGVK
- type InformerMap
- type OwnerReference
- type ResyncInterval
- type Selector
- type SelectorsByGVK
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldIndexName ¶
FieldIndexName constructs the name of the index over the given field, for use with an indexer.
func KeyToNamespacedKey ¶
KeyToNamespacedKey prefixes the given index key with a namespace for use in field selector indexes.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache( config *rest.Config, scheme *runtime.Scheme, mapper meta.RESTMapper, recorder metricsRecorder, opts ...CacheOption, ) *Cache
func (*Cache) Get ¶
func (c *Cache) Get( ctx context.Context, key client.ObjectKey, out client.Object, opts ...client.GetOption, ) error
Get implements client.Reader.
func (*Cache) List ¶
func (c *Cache) List( ctx context.Context, out client.ObjectList, opts ...client.ListOption, ) error
List implements client.Reader.
func (*Cache) OwnersForGKV ¶
func (c *Cache) OwnersForGKV(gvk schema.GroupVersionKind) []OwnerReference
Returns all owners registered watching the given GroupVersionKind.
type CacheNotStartedError ¶
type CacheNotStartedError struct{}
CacheNotStartedError is returned when trying to read from a cache before starting a watch.
func (CacheNotStartedError) Error ¶
func (CacheNotStartedError) Error() string
type CacheOption ¶
type CacheOption interface {
ApplyToCacheOptions(opts *CacheOptions)
}
CacheOption customizes an informer creation and cache behavior.
type CacheOptions ¶
type CacheOptions struct { // Custom cache indexes. Indexers FieldIndexersByGVK // Selectors filter caches on the api server. Selectors SelectorsByGVK // Time between full cache resyncs. ResyncInterval time.Duration }
CacheOptions holds all Cache configuration parameters.
func (*CacheOptions) Default ¶
func (co *CacheOptions) Default()
type CacheReader ¶
type CacheReader struct {
// contains filtered or unexported fields
}
CacheReader wraps a cache.Index to implement the client.CacheReader interface for a single type.
func (*CacheReader) Get ¶
func (c *CacheReader) Get(_ context.Context, key client.ObjectKey, out client.Object, _ ...client.GetOption) error
Get checks the indexer for the object and writes a copy of it if found.
func (*CacheReader) List ¶
func (c *CacheReader) List(_ context.Context, out client.ObjectList, opts ...client.ListOption) error
List lists items out of the indexer and writes them to out.
type EnqueueWatchingObjects ¶
type EnqueueWatchingObjects struct { WatcherRefGetter ownerRefGetter // WatcherType is the type of the Owner object to look for in OwnerReferences. Only Group and Kind are compared. WatcherType runtime.Object // contains filtered or unexported fields }
Enqueues all objects watching the object mentioned in the event, filtered by WatcherType.
func NewEnqueueWatchingObjects ¶
func NewEnqueueWatchingObjects(watcherRefGetter ownerRefGetter, watcherType runtime.Object, scheme *runtime.Scheme, ) *EnqueueWatchingObjects
func (*EnqueueWatchingObjects) Create ¶
func (e *EnqueueWatchingObjects) Create(_ context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
func (*EnqueueWatchingObjects) Delete ¶
func (e *EnqueueWatchingObjects) Delete(_ context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
func (*EnqueueWatchingObjects) Generic ¶
func (e *EnqueueWatchingObjects) Generic(_ context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
func (*EnqueueWatchingObjects) Update ¶
func (e *EnqueueWatchingObjects) Update(_ context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
type FieldIndexer ¶
type FieldIndexer struct { // Field name to refer to the index later. Field string // IndexFunc extracts the indexed values from objects. Indexer client.IndexerFunc }
FieldIndexer adds a custom index to the cache.
type FieldIndexersByGVK ¶
type FieldIndexersByGVK map[schema.GroupVersionKind][]FieldIndexer
FieldIndexers by GroupVersionKind.
func (FieldIndexersByGVK) ApplyToCacheOptions ¶
func (fi FieldIndexersByGVK) ApplyToCacheOptions(opts *CacheOptions)
type InformerMap ¶
type InformerMap struct {
// contains filtered or unexported fields
}
InformerMap caches informers and enables to shut them down later.
func NewInformerMap ¶
func NewInformerMap( config *rest.Config, scheme *runtime.Scheme, mapper apimetav1.RESTMapper, resync time.Duration, selectors SelectorsByGVK, indexers FieldIndexersByGVK, ) *InformerMap
func (*InformerMap) Delete ¶
func (im *InformerMap) Delete( _ context.Context, gvk schema.GroupVersionKind, ) error
Delete shuts down an informer for the given GVK, if one is registered.
func (*InformerMap) Get ¶
func (im *InformerMap) Get( ctx context.Context, gvk schema.GroupVersionKind, obj runtime.Object, ) (informer cache.SharedIndexInformer, reader client.Reader, err error)
Get returns a informer for the given GVK. If no informer is registered, a new Informer will be created.
type OwnerReference ¶
OwnerReference points to a single owner of a watch operation.
type ResyncInterval ¶
Time between full cache resyncs. A 10 percent jitter will be added to the resync period between informers, so that all informers will not send list requests simultaneously.
type Selector ¶
Selector specify the label/field selector to fill in ListOptions.
func (Selector) ApplyToList ¶
func (s Selector) ApplyToList(listOpts *metav1.ListOptions)
ApplyToList fill in ListOptions LabelSelector and FieldSelector if needed.
type SelectorsByGVK ¶
type SelectorsByGVK map[schema.GroupVersionKind]Selector
SelectorsByGVK associate a GroupVersionKind to a field/label selector.
func (SelectorsByGVK) ApplyToCacheOptions ¶
func (s SelectorsByGVK) ApplyToCacheOptions(opts *CacheOptions)
defined here, so we don't have to change selector.go, taken from controller-runtime.