watchers

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OperationString array for Operation type
	OperationString = []string{"ADD", "UPDATE", "REMOVE", "SYNCED"}
)

Functions

This section is empty.

Types

type Broadcaster

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

Broadcaster holds the details of registered listeners

func NewBroadcaster

func NewBroadcaster() *Broadcaster

NewBroadcaster returns an instance of Broadcaster object

func (*Broadcaster) Add

func (b *Broadcaster) Add(listener Listener)

Add lets to register a listener

func (*Broadcaster) Notify

func (b *Broadcaster) Notify(instance interface{})

Notify notifies an update to registered listeners

type Listener

type Listener interface {
	OnUpdate(instance interface{})
}

Listener interface for K8S resource

type ListenerFunc

type ListenerFunc func(instance interface{})

ListenerFunc is callback of listener

func (ListenerFunc) OnUpdate

func (f ListenerFunc) OnUpdate(instance interface{})

OnUpdate callback

type Operation

type Operation int

Operation type for K8S resource

const (
	ADD Operation = iota
	UPDATE
	REMOVE
	SYNCED
)

Operation enum

type PodUpdate

type PodUpdate struct {
	Pod *api.Pod
	Op  Operation
}

PodUpdate struct

type PodUpdatesHandler

type PodUpdatesHandler interface {
	OnPodUpdate(podUpdate *PodUpdate)
}

PodUpdatesHandler interface

type PodWatcher

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

PodWatcher struct

func StartPodWatcher

func StartPodWatcher(clientset kubernetes.Interface, resyncPeriod time.Duration, stopCh <-chan struct{}) (*PodWatcher, error)

StartPodWatcher start watching updates for pods from Kuberentes API server

func (*PodWatcher) HasSynced

func (pw *PodWatcher) HasSynced() bool

HasSynced return true if podController.HasSynced()

func (*PodWatcher) ListBySelector

func (pw *PodWatcher) ListBySelector(set map[string]string) (ret []*api.Pod, err error)

ListBySelector for list pods with labels

func (*PodWatcher) RegisterHandler

func (pw *PodWatcher) RegisterHandler(handler PodUpdatesHandler)

RegisterHandler for register pod update interface

type ServiceUpdate

type ServiceUpdate struct {
	Service *api.Service
	Op      Operation
}

ServiceUpdate struct

type ServiceUpdatesHandler

type ServiceUpdatesHandler interface {
	OnServiceUpdate(serviceUpdate *ServiceUpdate)
}

ServiceUpdatesHandler interface

type ServiceWatcher

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

ServiceWatcher struct

func StartServiceWatcher

func StartServiceWatcher(clientset kubernetes.Interface, resyncPeriod time.Duration, stopCh <-chan struct{}) (*ServiceWatcher, error)

StartServiceWatcher start watching updates for services from Kuberentes API server

func (*ServiceWatcher) HasSynced

func (svcw *ServiceWatcher) HasSynced() bool

HasSynced return true if serviceController.HasSynced()

func (*ServiceWatcher) ListBySelector

func (svcw *ServiceWatcher) ListBySelector(set map[string]string) (ret []*api.Service, err error)

ListBySelector for list services with labels

func (*ServiceWatcher) RegisterHandler

func (svcw *ServiceWatcher) RegisterHandler(handler ServiceUpdatesHandler)

RegisterHandler for register service update interface

Jump to

Keyboard shortcuts

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