MCPcopy
hub / github.com/kubernetes-sigs/controller-runtime / GetInformer

Method GetInformer

pkg/cache/informer_cache.go:159–170  ·  view source on GitHub ↗

GetInformer returns the informer for the obj. If no informer exists, one will be started.

(ctx context.Context, obj client.Object, opts ...InformerGetOption)

Source from the content-addressed store, hash-verified

157
158// GetInformer returns the informer for the obj. If no informer exists, one will be started.
159func (ic *informerCache) GetInformer(ctx context.Context, obj client.Object, opts ...InformerGetOption) (Informer, error) {
160 gvk, err := apiutil.GVKForObject(obj, ic.scheme)
161 if err != nil {
162 return nil, err
163 }
164
165 _, i, err := ic.Informers.Get(ctx, gvk, obj, false, applyGetOptions(opts...))
166 if err != nil {
167 return nil, err
168 }
169 return i.Informer, nil
170}
171
172func (ic *informerCache) getInformerForKind(ctx context.Context, gvk schema.GroupVersionKind, obj runtime.Object) (bool, *internal.Cache, error) {
173 started, cache, err := ic.Informers.Get(ctx, gvk, obj, ic.readerFailOnMissingInformer, &internal.GetOptions{})

Callers 1

IndexFieldMethod · 0.95

Calls 3

GVKForObjectFunction · 0.92
applyGetOptionsFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected