k8s

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResourceTypeEvent is event resource type.,
	ResourceTypeEvent = "Event"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NetServiceWatcher

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

NetServiceWatcher watchs resources in netservice, and sync to storage.

func NewNetServiceWatcher

func NewNetServiceWatcher(clusterID string, storageService, netservice *bcs.InnerService) *NetServiceWatcher

NewNetServiceWatcher creates a new NetServiceWatcher instance.

func (*NetServiceWatcher) Run

func (w *NetServiceWatcher) Run(stopCh <-chan struct{})

Run starts the netservice watcher.

func (*NetServiceWatcher) SyncIPResource

func (w *NetServiceWatcher) SyncIPResource()

SyncIPResource syncs target ip resources to storages.

func (*NetServiceWatcher) SyncIPResourceDetail

func (w *NetServiceWatcher) SyncIPResourceDetail()

SyncIPResourceDetail syncs target ip resource detail to storages.

type Synchronizer

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

Synchronizer syncs resource metadata to storage.

func NewSynchronizer

func NewSynchronizer(clusterID string, watchers, crdWatchers map[string]WatcherInterface, storageService *bcs.InnerService) *Synchronizer

NewSynchronizer creates a new Synchronizer instance.

func (*Synchronizer) Run

func (sync *Synchronizer) Run(stopCh <-chan struct{})

Run starts the Synchronizer and make it keep sync resources in period.

type Watcher

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

Watcher watchs target type resource metadata from k8s cluster, and write to storage by synchronizer with series actions.

func NewWatcher

func NewWatcher(client *rest.Interface, resourceType string, resourceName string, objType runtime.Object,
	writer *output.Writer, sharedWatchers map[string]WatcherInterface, resourceNamespaced bool) *Watcher

NewWatcher creates a new watcher of target type resource.

func (*Watcher) AddEvent

func (w *Watcher) AddEvent(obj interface{})

AddEvent is event handler for add resource event.

func (*Watcher) DeleteEvent

func (w *Watcher) DeleteEvent(obj interface{})

DeleteEvent is event handler for delete resource event.

func (*Watcher) GetByKey

func (w *Watcher) GetByKey(key string) (interface{}, bool, error)

GetByKey returns object data by target key.

func (*Watcher) ListKeys

func (w *Watcher) ListKeys() []string

ListKeys returns all keys in local store.

func (*Watcher) Run

func (w *Watcher) Run(stopCh <-chan struct{})

Run starts the watcher.

func (*Watcher) UpdateEvent

func (w *Watcher) UpdateEvent(oldObj, newObj interface{})

UpdateEvent is event handler for update resource event.

type WatcherInterface

type WatcherInterface interface {
	// Run starts the watcher.
	Run(stopCh <-chan struct{})

	// AddEvent is event to sync new resource.
	AddEvent(obj interface{})

	// DeleteEvent is event to delete old resource.
	DeleteEvent(obj interface{})

	// UpdateEvent is event to update old resource.
	UpdateEvent(oldObj, newObj interface{})

	// GetByKey returns object data by target key.
	GetByKey(key string) (interface{}, bool, error)

	// ListKeys returns all keys in local store.
	ListKeys() []string
}

WatcherInterface describes a resource watcher.

type WatcherManager

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

WatcherManager is resource watcher manager.

func NewWatcherManager

func NewWatcherManager(clusterID string, writer *output.Writer, k8sConfig *options.K8sConfig,
	storageService, netservice *bcs.InnerService, sc <-chan struct{}) (*WatcherManager, error)

NewWatcherManager creates a new WatcherManager instance.

func (*WatcherManager) AddEvent

func (mgr *WatcherManager) AddEvent(obj interface{})

func (*WatcherManager) DeleteEvent

func (mgr *WatcherManager) DeleteEvent(obj interface{})

func (*WatcherManager) Run

func (mgr *WatcherManager) Run(stopCh <-chan struct{})

Run starts the watcher manager, and runs all watchers.

func (*WatcherManager) StopCrdWatchers

func (mgr *WatcherManager) StopCrdWatchers()

StopCrdWatchers stop all crd watcher and writer handler

func (*WatcherManager) UpdateEvent

func (mgr *WatcherManager) UpdateEvent(oldObj, newObj interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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