cache

package
v0.0.0-...-192ee93 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterRetryTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewClusterCache

func NewClusterCache(settings Settings, config *rest.Config, namespaces []string, kubectl kube.Kubectl) *clusterCache

Types

type ClusterCache

type ClusterCache interface {
	EnsureSynced() error
	GetServerVersion() string
	GetAPIGroups() []metav1.APIGroup
	Invalidate(settingsCallback func(*rest.Config, []string, Settings) (*rest.Config, []string, Settings))
	GetNamespaceTopLevelResources(namespace string) map[kube.ResourceKey]*Resource
	IterateHierarchy(key kube.ResourceKey, action func(resource *Resource, namespaceResources map[kube.ResourceKey]*Resource))
	IsNamespaced(gk schema.GroupKind) (bool, error)
	GetManagedLiveObjs(targetObjs []*unstructured.Unstructured, isManaged func(r *Resource) bool) (map[kube.ResourceKey]*unstructured.Unstructured, error)
	GetClusterInfo() ClusterInfo
	SetPopulateResourceInfoHandler(handler OnPopulateResourceInfoHandler)
	OnResourceUpdated(handler OnResourceUpdatedHandler) Unsubscribe
	OnEvent(handler OnEventHandler) Unsubscribe
}

type ClusterInfo

type ClusterInfo struct {
	Server            string
	K8SVersion        string
	ResourcesCount    int
	APIsCount         int
	LastCacheSyncTime *time.Time
}

type OnEventHandler

type OnEventHandler func(event watch.EventType, un *unstructured.Unstructured)

type OnPopulateResourceInfoHandler

type OnPopulateResourceInfoHandler func(un *unstructured.Unstructured, isRoot bool) (info interface{}, cacheManifest bool)

type OnResourceUpdatedHandler

type OnResourceUpdatedHandler func(newRes *Resource, oldRes *Resource, namespaceResources map[kube.ResourceKey]*Resource)

type Resource

type Resource struct {
	ResourceVersion string
	Ref             v1.ObjectReference
	OwnerRefs       []metav1.OwnerReference
	Info            interface{}

	// available only for root application nodes
	Resource *unstructured.Unstructured
}

func (*Resource) ResourceKey

func (r *Resource) ResourceKey() kube.ResourceKey

type Settings

type Settings struct {
	ResourceHealthOverride health.HealthOverride
	ResourcesFilter        kube.ResourceFilter
}

type Unsubscribe

type Unsubscribe func()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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