clustercache

package
v0.0.0-...-8b28c38 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 ClusterCache

type ClusterCache interface {
	// Run starts the watcher processes
	Run()

	// Stops the watcher processes
	Stop()

	// GetAllNamespaces returns all the cached namespaces
	GetAllNamespaces() []*v1.Namespace

	// GetAllNodes returns all the cached nodes
	GetAllNodes() []*v1.Node

	// GetAllPods returns all the cached pods
	GetAllPods() []*v1.Pod

	// GetAllServices returns all the cached services
	GetAllServices() []*v1.Service

	// GetAllDaemonSets returns all the cached DaemonSets
	GetAllDaemonSets() []*appsv1.DaemonSet

	// GetAllDeployments returns all the cached deployments
	GetAllDeployments() []*appsv1.Deployment

	// GetAllStatfulSets returns all the cached StatefulSets
	GetAllStatefulSets() []*appsv1.StatefulSet

	// GetAllReplicaSets returns all the cached ReplicaSets
	GetAllReplicaSets() []*appsv1.ReplicaSet

	// GetAllPersistentVolumes returns all the cached persistent volumes
	GetAllPersistentVolumes() []*v1.PersistentVolume

	// GetAllPersistentVolumeClaims returns all the cached persistent volume claims
	GetAllPersistentVolumeClaims() []*v1.PersistentVolumeClaim

	// GetAllStorageClasses returns all the cached storage classes
	GetAllStorageClasses() []*stv1.StorageClass

	// GetAllJobs returns all the cached jobs
	GetAllJobs() []*batchv1.Job

	// GetAllPodDisruptionBudgets returns all cached pod disruption budgets
	GetAllPodDisruptionBudgets() []*v1beta1.PodDisruptionBudget

	// GetAllReplicationControllers returns all cached replication controllers
	GetAllReplicationControllers() []*v1.ReplicationController

	// SetConfigMapUpdateFunc sets the configmap update function
	SetConfigMapUpdateFunc(func(interface{}))
}

ClusterCache defines an contract for an object which caches components within a cluster, ensuring up to date resources using watchers

func NewClusterImporter

func NewClusterImporter(source *config.ConfigFile) ClusterCache

Creates a new ClusterCache implementation which uses an import process to provide cluster data

func NewKubernetesClusterCache

func NewKubernetesClusterCache(client kubernetes.Interface) ClusterCache

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 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 ClusterImporter

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

ClusterImporter is an implementation of ClusterCache which leverages a backing configuration file as it's source of the cluster data.

func (*ClusterImporter) GetAllDaemonSets

func (ci *ClusterImporter) GetAllDaemonSets() []*appsv1.DaemonSet

GetAllDaemonSets returns all the cached DaemonSets

func (*ClusterImporter) GetAllDeployments

func (ci *ClusterImporter) GetAllDeployments() []*appsv1.Deployment

GetAllDeployments returns all the cached deployments

func (*ClusterImporter) GetAllJobs

func (ci *ClusterImporter) GetAllJobs() []*batchv1.Job

GetAllJobs returns all the cached jobs

func (*ClusterImporter) GetAllNamespaces

func (ci *ClusterImporter) GetAllNamespaces() []*v1.Namespace

GetAllNamespaces returns all the cached namespaces

func (*ClusterImporter) GetAllNodes

func (ci *ClusterImporter) GetAllNodes() []*v1.Node

GetAllNodes returns all the cached nodes

func (*ClusterImporter) GetAllPersistentVolumeClaims

func (ci *ClusterImporter) GetAllPersistentVolumeClaims() []*v1.PersistentVolumeClaim

GetAllPersistentVolumeClaims returns all the cached persistent volume claims

func (*ClusterImporter) GetAllPersistentVolumes

func (ci *ClusterImporter) GetAllPersistentVolumes() []*v1.PersistentVolume

GetAllPersistentVolumes returns all the cached persistent volumes

func (*ClusterImporter) GetAllPodDisruptionBudgets

func (ci *ClusterImporter) GetAllPodDisruptionBudgets() []*v1beta1.PodDisruptionBudget

GetAllPodDisruptionBudgets returns all cached pod disruption budgets

func (*ClusterImporter) GetAllPods

func (ci *ClusterImporter) GetAllPods() []*v1.Pod

GetAllPods returns all the cached pods

func (*ClusterImporter) GetAllReplicaSets

func (ci *ClusterImporter) GetAllReplicaSets() []*appsv1.ReplicaSet

GetAllReplicaSets returns all the cached ReplicaSets

func (*ClusterImporter) GetAllReplicationControllers

func (ci *ClusterImporter) GetAllReplicationControllers() []*v1.ReplicationController

func (*ClusterImporter) GetAllServices

func (ci *ClusterImporter) GetAllServices() []*v1.Service

GetAllServices returns all the cached services

func (*ClusterImporter) GetAllStatefulSets

func (ci *ClusterImporter) GetAllStatefulSets() []*appsv1.StatefulSet

GetAllStatfulSets returns all the cached StatefulSets

func (*ClusterImporter) GetAllStorageClasses

func (ci *ClusterImporter) GetAllStorageClasses() []*stv1.StorageClass

GetAllStorageClasses returns all the cached storage classes

func (*ClusterImporter) Run

func (ci *ClusterImporter) Run()

Run starts the watcher processes

func (*ClusterImporter) SetConfigMapUpdateFunc

func (ci *ClusterImporter) SetConfigMapUpdateFunc(_ func(interface{}))

SetConfigMapUpdateFunc sets the configmap update function

func (*ClusterImporter) Stop

func (ci *ClusterImporter) Stop()

Stops the watcher processes

type KubernetesClusterCache

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

KubernetesClusterCache is the implementation of ClusterCache

func (*KubernetesClusterCache) GetAllDaemonSets

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

func (*KubernetesClusterCache) GetAllDeployments

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

func (*KubernetesClusterCache) GetAllJobs

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

func (*KubernetesClusterCache) GetAllNamespaces

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

func (*KubernetesClusterCache) GetAllNodes

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

func (*KubernetesClusterCache) GetAllPersistentVolumeClaims

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

func (*KubernetesClusterCache) GetAllPersistentVolumes

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

func (*KubernetesClusterCache) GetAllPodDisruptionBudgets

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

func (*KubernetesClusterCache) GetAllPods

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

func (*KubernetesClusterCache) GetAllReplicaSets

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

func (*KubernetesClusterCache) GetAllReplicationControllers

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

func (*KubernetesClusterCache) GetAllServices

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

func (*KubernetesClusterCache) GetAllStatefulSets

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

func (*KubernetesClusterCache) GetAllStorageClasses

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

func (*KubernetesClusterCache) Run

func (kcc *KubernetesClusterCache) Run()

func (*KubernetesClusterCache) SetConfigMapUpdateFunc

func (kcc *KubernetesClusterCache) SetConfigMapUpdateFunc(f func(interface{}))

func (*KubernetesClusterCache) Stop

func (kcc *KubernetesClusterCache) Stop()

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