kubernetes: k8s.io/kubernetes/pkg/kubelet/util/manager Index | Files

package manager

import "k8s.io/kubernetes/pkg/kubelet/util/manager"

Index

Package Files

cache_based_manager.go manager.go watch_based_manager.go

type GetObjectFunc Uses

type GetObjectFunc func(string, string, metav1.GetOptions) (runtime.Object, error)

GetObjectFunc defines a function to get object with a given namespace and name.

type GetObjectTTLFunc Uses

type GetObjectTTLFunc func() (time.Duration, bool)

GetObjectTTLFunc defines a function to get value of TTL.

func GetObjectTTLFromNodeFunc Uses

func GetObjectTTLFromNodeFunc(getNode func() (*v1.Node, error)) GetObjectTTLFunc

GetObjectTTLFromNodeFunc returns a function that returns TTL value from a given Node object.

type Manager Uses

type Manager interface {
    // Get object by its namespace and name.
    GetObject(namespace, name string) (runtime.Object, error)

    // RegisterPod registers all objects referenced from a given pod.
    //
    // NOTE: All implementations of RegisterPod should be idempotent.
    RegisterPod(pod *v1.Pod)

    // UnregisterPod unregisters objects referenced from a given pod that are not
    // used by any other registered pod.
    //
    // NOTE: All implementations of UnregisterPod should be idempotent.
    UnregisterPod(pod *v1.Pod)
}

Manager is the interface for registering and unregistering objects referenced by pods in the underlying cache and extracting those from that cache if needed.

func NewCacheBasedManager Uses

func NewCacheBasedManager(objectStore Store, getReferencedObjects func(*v1.Pod) sets.String) Manager

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 NewWatchBasedManager Uses

func NewWatchBasedManager(listObject listObjectFunc, watchObject watchObjectFunc, newObject newObjectFunc, groupResource schema.GroupResource, getReferencedObjects func(*v1.Pod) sets.String) Manager

NewWatchBasedManager 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, we start individual watches for all

referenced objects that aren't referenced from other registered pods

- every GetObject() returns a value from local cache propagated via watches

type Store Uses

type Store interface {
    // AddReference adds a reference to the object to the store.
    // Note that multiple additions to the store has to be allowed
    // in the implementations and effectively treated as refcounted.
    AddReference(namespace, name string)
    // DeleteReference deletes reference to the object from the store.
    // Note that object should be deleted only when there was a
    // corresponding Delete call for each of Add calls (effectively
    // when refcount was reduced to zero).
    DeleteReference(namespace, name string)
    // Get an object from a store.
    Get(namespace, name string) (runtime.Object, error)
}

Store is the interface for a object cache that can be used by cacheBasedManager.

func NewObjectCache Uses

func NewObjectCache(listObject listObjectFunc, watchObject watchObjectFunc, newObject newObjectFunc, groupResource schema.GroupResource) Store

NewObjectCache returns a new watch-based instance of Store interface.

func NewObjectStore Uses

func NewObjectStore(getObject GetObjectFunc, clock clock.Clock, getTTL GetObjectTTLFunc, ttl time.Duration) Store

NewObjectStore returns a new ttl-based instance of Store interface.

Package manager imports 17 packages (graph) and is imported by 3 packages. Updated 2019-08-19. Refresh now. Tools for package owners.