kubernetes/pkg/kubelet/util/manager/cache_based_manager.go

type GetObjectTTLFunc

type GetObjectFunc

type objectKey

type objectStoreItem

type objectData

type objectStore

// NewObjectStore returns a new ttl-based instance of Store interface.
func NewObjectStore(getObject GetObjectFunc, clock clock.Clock, getTTL GetObjectTTLFunc, ttl time.Duration) Store {}

func isObjectOlder(newObject, oldObject runtime.Object) bool {}

func (s *objectStore) AddReference(namespace, name string, _ types.UID) {}

func (s *objectStore) DeleteReference(namespace, name string, _ types.UID) {}

// GetObjectTTLFromNodeFunc returns a function that returns TTL value
// from a given Node object.
func GetObjectTTLFromNodeFunc(getNode func() (*v1.Node, error)) GetObjectTTLFunc {}

func (s *objectStore) isObjectFresh(data *objectData) bool {}

func (s *objectStore) Get(namespace, name string) (runtime.Object, error) {}

type cacheBasedManager

func (c *cacheBasedManager) GetObject(namespace, name string) (runtime.Object, error) {}

func (c *cacheBasedManager) RegisterPod(pod *v1.Pod) {}

func (c *cacheBasedManager) UnregisterPod(pod *v1.Pod) {}

// NewCacheBasedManager creates a manager that keeps a cache of all objects
// necessary for registered pods.
// It implements the following logic:
//   - whenever a pod is created or updated, the cached versions of all objects
//     is referencing are invalidated
//   - every GetObject() call tries to fetch the value from local cache; if it is
//     not there, invalidated or too old, we fetch it from apiserver and refresh the
//     value in cache; otherwise it is just fetched from cache
func NewCacheBasedManager(objectStore Store, getReferencedObjects func(*v1.Pod) sets.Set[string]) Manager {}