clustercache

package
v1.119.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKubernetesClusterCache

func NewKubernetesClusterCache(client kubernetes.Interface) cc.ClusterCache

func NewKubernetesClusterCacheV1 added in v1.114.0

func NewKubernetesClusterCacheV1(client kubernetes.Interface) cc.ClusterCache

Types

type CachingWatchController

type CachingWatchController struct {
	// contains filtered or unexported fields
}

CachingWatchController composites the watching behavior and a cache to ensure that all up to date resources are readily available

func (*CachingWatchController) GetAll

func (c *CachingWatchController) GetAll() []interface{}

func (*CachingWatchController) Run

func (c *CachingWatchController) Run(threadiness int, stopCh chan struct{})

func (*CachingWatchController) SetRemovedHandler

func (c *CachingWatchController) SetRemovedHandler(handler WatchHandler) WatchController

func (*CachingWatchController) SetUpdateHandler

func (c *CachingWatchController) SetUpdateHandler(handler WatchHandler) WatchController

func (*CachingWatchController) WarmUp

func (c *CachingWatchController) WarmUp(cancelCh chan struct{})

type ClusterExporter

type ClusterExporter struct {
	// contains filtered or unexported fields
}

ClusterExporter manages and runs an file export process which dumps the local kubernetes cluster to a target location.

func NewClusterExporter

func NewClusterExporter(cluster cc.ClusterCache, target *config.ConfigFile, interval time.Duration) *ClusterExporter

NewClusterExporter creates a new ClusterExporter instance for exporting the kubernetes cluster.

func (*ClusterExporter) Export

func (ce *ClusterExporter) Export() error

Export stores the cluster cache data into a PODO, marshals as JSON, and saves it to the target location.

func (*ClusterExporter) Run

func (ce *ClusterExporter) Run()

Run starts the automated process of running Export on a specific interval.

func (*ClusterExporter) Stop

func (ce *ClusterExporter) Stop()

Stop halts the Cluster export on an interval

type GenericStore added in v1.114.0

type GenericStore[Input UIDGetter, Output any] struct {
	// contains filtered or unexported fields
}

GenericStore is a generic store implementation. It converts objects to a different type using a transform function. The main purpose is to reduce a memory footprint by storing only the necessary data.

func CreateStore added in v1.114.0

func CreateStore[Input UIDGetter, Output any](
	restClient rest.Interface,
	resource string,
	transformFunc func(input Input) Output,
) *GenericStore[Input, Output]

func NewGenericStore added in v1.114.0

func NewGenericStore[Input UIDGetter, Output any](transformFunc func(input Input) Output) *GenericStore[Input, Output]

NewGenericStore creates a new instance of GenericStore.

func (*GenericStore[Input, Output]) Add added in v1.114.0

func (s *GenericStore[Input, Output]) Add(obj any) error

Add inserts an object into the store.

func (*GenericStore[Input, Output]) Delete added in v1.114.0

func (s *GenericStore[Input, Output]) Delete(obj any) error

Delete removes an object from the store.

func (*GenericStore[Input, Output]) Get added in v1.114.0

func (s *GenericStore[Input, Output]) Get(_ interface{}) (item interface{}, exists bool, err error)

func (*GenericStore[Input, Output]) GetAll added in v1.114.0

func (s *GenericStore[Input, Output]) GetAll() []Output

GetAll returns all stored objects.

func (*GenericStore[Input, Output]) GetByKey added in v1.114.0

func (s *GenericStore[Input, Output]) GetByKey(_ string) (item interface{}, exists bool, err error)

func (*GenericStore[Input, Output]) List added in v1.114.0

func (s *GenericStore[Input, Output]) List() []interface{}

Stubs to satisfy the cache.Store interface

func (*GenericStore[Input, Output]) ListKeys added in v1.114.0

func (s *GenericStore[Input, Output]) ListKeys() []string

func (*GenericStore[Input, Output]) Replace added in v1.114.0

func (s *GenericStore[Input, Output]) Replace(list []any, _ string) error

Replace replaces the current list of items in the store.

func (*GenericStore[Input, Output]) Resync added in v1.114.0

func (s *GenericStore[Input, Output]) Resync() error

func (*GenericStore[Input, Output]) Update added in v1.114.0

func (s *GenericStore[Input, Output]) Update(obj any) error

Update updates the existing entry in the store.

func (*GenericStore[Input, Output]) Watch added in v1.114.0

func (s *GenericStore[Input, Output]) Watch(stopCh <-chan struct{}, onInit func())

type KubernetesClusterCache

type KubernetesClusterCache struct {
	// contains filtered or unexported fields
}

KubernetesClusterCache is the implementation of ClusterCache

func (*KubernetesClusterCache) GetAllDaemonSets

func (kcc *KubernetesClusterCache) GetAllDaemonSets() []*cc.DaemonSet

func (*KubernetesClusterCache) GetAllDeployments

func (kcc *KubernetesClusterCache) GetAllDeployments() []*cc.Deployment

func (*KubernetesClusterCache) GetAllJobs

func (kcc *KubernetesClusterCache) GetAllJobs() []*cc.Job

func (*KubernetesClusterCache) GetAllNamespaces

func (kcc *KubernetesClusterCache) GetAllNamespaces() []*cc.Namespace

func (*KubernetesClusterCache) GetAllNodes

func (kcc *KubernetesClusterCache) GetAllNodes() []*cc.Node

func (*KubernetesClusterCache) GetAllPersistentVolumeClaims

func (kcc *KubernetesClusterCache) GetAllPersistentVolumeClaims() []*cc.PersistentVolumeClaim

func (*KubernetesClusterCache) GetAllPersistentVolumes

func (kcc *KubernetesClusterCache) GetAllPersistentVolumes() []*cc.PersistentVolume

func (*KubernetesClusterCache) GetAllPodDisruptionBudgets

func (kcc *KubernetesClusterCache) GetAllPodDisruptionBudgets() []*cc.PodDisruptionBudget

func (*KubernetesClusterCache) GetAllPods

func (kcc *KubernetesClusterCache) GetAllPods() []*cc.Pod

func (*KubernetesClusterCache) GetAllReplicaSets

func (kcc *KubernetesClusterCache) GetAllReplicaSets() []*cc.ReplicaSet

func (*KubernetesClusterCache) GetAllReplicationControllers

func (kcc *KubernetesClusterCache) GetAllReplicationControllers() []*cc.ReplicationController

func (*KubernetesClusterCache) GetAllResourceQuotas added in v1.119.0

func (kcc *KubernetesClusterCache) GetAllResourceQuotas() []*cc.ResourceQuota

GetAllResourceQuotas returns all cached resource quotas

func (*KubernetesClusterCache) GetAllServices

func (kcc *KubernetesClusterCache) GetAllServices() []*cc.Service

func (*KubernetesClusterCache) GetAllStatefulSets

func (kcc *KubernetesClusterCache) GetAllStatefulSets() []*cc.StatefulSet

func (*KubernetesClusterCache) GetAllStorageClasses

func (kcc *KubernetesClusterCache) GetAllStorageClasses() []*cc.StorageClass

func (*KubernetesClusterCache) Run

func (kcc *KubernetesClusterCache) Run()

func (*KubernetesClusterCache) Stop

func (kcc *KubernetesClusterCache) Stop()

type KubernetesClusterCacheV2 added in v1.114.0

type KubernetesClusterCacheV2 struct {
	// contains filtered or unexported fields
}

func NewKubernetesClusterCacheV2 added in v1.114.0

func NewKubernetesClusterCacheV2(clientset kubernetes.Interface) *KubernetesClusterCacheV2

func (*KubernetesClusterCacheV2) GetAllDaemonSets added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllDaemonSets() []*cc.DaemonSet

func (*KubernetesClusterCacheV2) GetAllDeployments added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllDeployments() []*cc.Deployment

func (*KubernetesClusterCacheV2) GetAllJobs added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllJobs() []*cc.Job

func (*KubernetesClusterCacheV2) GetAllNamespaces added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllNamespaces() []*cc.Namespace

func (*KubernetesClusterCacheV2) GetAllNodes added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllNodes() []*cc.Node

func (*KubernetesClusterCacheV2) GetAllPersistentVolumeClaims added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllPersistentVolumeClaims() []*cc.PersistentVolumeClaim

func (*KubernetesClusterCacheV2) GetAllPersistentVolumes added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllPersistentVolumes() []*cc.PersistentVolume

func (*KubernetesClusterCacheV2) GetAllPodDisruptionBudgets added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllPodDisruptionBudgets() []*cc.PodDisruptionBudget

func (*KubernetesClusterCacheV2) GetAllPods added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllPods() []*cc.Pod

func (*KubernetesClusterCacheV2) GetAllReplicaSets added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllReplicaSets() []*cc.ReplicaSet

func (*KubernetesClusterCacheV2) GetAllReplicationControllers added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllReplicationControllers() []*cc.ReplicationController

func (*KubernetesClusterCacheV2) GetAllResourceQuotas added in v1.119.0

func (kcc *KubernetesClusterCacheV2) GetAllResourceQuotas() []*cc.ResourceQuota

func (*KubernetesClusterCacheV2) GetAllServices added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllServices() []*cc.Service

func (*KubernetesClusterCacheV2) GetAllStatefulSets added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllStatefulSets() []*cc.StatefulSet

func (*KubernetesClusterCacheV2) GetAllStorageClasses added in v1.114.0

func (kcc *KubernetesClusterCacheV2) GetAllStorageClasses() []*cc.StorageClass

func (*KubernetesClusterCacheV2) Run added in v1.114.0

func (kcc *KubernetesClusterCacheV2) Run()

func (*KubernetesClusterCacheV2) Stop added in v1.114.0

func (kcc *KubernetesClusterCacheV2) Stop()

type UIDGetter added in v1.114.0

type UIDGetter interface {
	GetUID() types.UID
}

type WatchController

type WatchController interface {
	// Initializes the cache
	WarmUp(chan struct{})

	// Run starts the watching process
	Run(int, chan struct{})

	// GetAll returns all of the resources
	GetAll() []interface{}

	// SetUpdateHandler sets a specific handler for adding/updating individual resources
	SetUpdateHandler(WatchHandler) WatchController

	// SetRemovedHandler sets a specific handler for removing individual resources
	SetRemovedHandler(WatchHandler) WatchController
}

WatchController defines a contract for an object which watches a specific resource set for add, updates, and removals

func NewCachingWatcher

func NewCachingWatcher(restClient rest.Interface, resource string, resourceType rt.Object, namespace string, fieldSelector fields.Selector) WatchController

type WatchHandler

type WatchHandler = func(interface{})

Type alias for a receiver func

Jump to

Keyboard shortcuts

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