cache

package
v0.0.0-...-c510420 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Package cache provides a client-go informer based cache that can be populated with any API server objects, not just kubernetes API objects. The cache can be provided with any ListWatcher func for any API server. When the cache is started, it'll run List and Watch, and collect the API objects to populate the cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(createLWFunc informer.CreateListWatcherFunc, opts Options) cache.Cache

New initializes and returns a new Cache.

Types

type ListWatcher

type ListWatcher struct {
	ListWatcherClient
}

ListWatcher embeds a ListWatcherClient and uses the client to provider a cache.ListWatch.

func (ListWatcher) CreateListWatcherFunc

func (r ListWatcher) CreateListWatcherFunc() informer.CreateListWatcherFunc

CreateListWatcherFunc returns a CreateListWatcherFunc that uses the ListWatcherClient.

type ListWatcherClient

type ListWatcherClient interface {
	List(ctx context.Context, namespace string, obj runtime.Object) (runtime.Object, error)
	Watch(ctx context.Context, namespace string, kind string) (watch.Interface, error)
}

ListWatcherClient defines an interface for a list watcher client.

type Options

type Options struct {
	// Scheme is the scheme to use for mapping objects to GroupVersionKinds
	Scheme *runtime.Scheme

	// Resync is the base frequency the informers are resynced.
	// Defaults to defaultResyncTime.
	// A 10 percent jitter will be added to the Resync period between informers
	// So that all informers will not send list requests simultaneously.
	Resync *time.Duration

	// Namespace restricts the cache's ListWatch to the desired namespace
	// Default watches all namespaces
	Namespace string
}

Options are the optional arguments for creating a new InformersMap object.

Directories

Path Synopsis
Package informer is based on internal package https://github.com/kubernetes-sigs/controller-runtime/tree/v0.8.3/pkg/cache/internal, modified to not be kubernetes API specific.
Package informer is based on internal package https://github.com/kubernetes-sigs/controller-runtime/tree/v0.8.3/pkg/cache/internal, modified to not be kubernetes API specific.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL