resourcewatcher

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type K8sStore

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

K8sStore stores the current state of k8s resources

func NewK8sStore

func NewK8sStore(cfg watchConfig, storeConfig StoreConfig) (K8sStore, error)

NewK8sStore creates a new store

func (*K8sStore) AddResource

func (k *K8sStore) AddResource(obj interface{})

AddResource adds a new k8s object to the store

func (*K8sStore) AddResourceList

func (k *K8sStore) AddResourceList(lstRuntime []runtime.Object)

AddResourceList clears current state add the objects to the store. It will trigger a full dump

func (*K8sStore) AppendNewObject

func (k *K8sStore) AppendNewObject(resource k8sresources.K8sResource) error

AppendNewObject appends a new object to the cache dump

func (*K8sStore) DeleteResource

func (k *K8sStore) DeleteResource(obj interface{})

DeleteResource removes an existing k8s object to the store

func (*K8sStore) DumpFullState

func (k *K8sStore) DumpFullState() error

DumpFullState writes the full state to the cache file

func (*K8sStore) UpdateResource

func (k *K8sStore) UpdateResource(oldObj, newObj interface{})

UpdateResource update an existing k8s object

type ResourceWatcher

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

func NewResourceWatcher

func NewResourceWatcher(namespace string, config *restclient.Config) ResourceWatcher

NewResourceWatcher creates a new resource watcher on a given cluster

func (*ResourceWatcher) GetWatchConfigs

func (r *ResourceWatcher) GetWatchConfigs(nodePollingPeriod time.Duration, namespacePollingPeriod time.Duration) []watchConfig

GetWatchConfigs creates the list of k8s to watch

func (*ResourceWatcher) Start

func (r *ResourceWatcher) Start(parentCtx context.Context, cfg watchConfig, storeConfig StoreConfig) error

Start begins the watch/poll of a given k8s resource

func (*ResourceWatcher) Stop

func (r *ResourceWatcher) Stop()

Stop closes the watch/poll process of a k8s resource

type StoreConfig

type StoreConfig struct {
	Cluster             string
	CacheDir            string
	TimeBetweenFullDump time.Duration
}

StoreConfig defines parameters used for the cache location

Jump to

Keyboard shortcuts

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