k8s

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientSet

func NewClientSet(kubeConfig string) (*kubernetes.Clientset, error)

Types

type EndpointsListener

type EndpointsListener interface {
	Update(add []common.TcpAddress, remove []common.TcpAddress)
	NoEndpoints(exists bool)
}

type EndpointsWatcher

type EndpointsWatcher interface {
	GetService(service string) (*v1.Service, bool, error)
	Subscribe(service string, port uint32, listener EndpointsListener) error
	Unsubscribe(service string, port uint32, listener EndpointsListener) error
	Run() error
	Stop()
}

func NewEndpointsWatcher

func NewEndpointsWatcher(clientset *kubernetes.Clientset) EndpointsWatcher

An EndpointsWatcher watches all endpoints and services in the Kubernetes cluster. Listeners can subscribe to a particular service and port and EndpointsWatcher will publish the address set and all future changes for that service:port.

type InMemoryPodIndex added in v0.4.0

type InMemoryPodIndex struct {
	BackingMap map[string][]*v1.Pod
}

func (*InMemoryPodIndex) GetPod added in v0.4.0

func (i *InMemoryPodIndex) GetPod(key string) (*v1.Pod, error)

func (*InMemoryPodIndex) GetPodsByIndex added in v0.4.0

func (i *InMemoryPodIndex) GetPodsByIndex(key string) ([]*v1.Pod, error)

func (*InMemoryPodIndex) List added in v0.4.0

func (i *InMemoryPodIndex) List() ([]*v1.Pod, error)

func (*InMemoryPodIndex) Run added in v0.4.0

func (i *InMemoryPodIndex) Run() error

func (*InMemoryPodIndex) Stop added in v0.4.0

func (i *InMemoryPodIndex) Stop()

type Lister added in v0.4.1

Lister wraps client-go Lister types for all Kubernetes objects

func NewLister added in v0.4.1

func NewLister(k8sClient kubernetes.Interface) *Lister

NewLister takes a Kubernetes client and returns an initialized Lister

func (*Lister) GetObjects added in v0.4.1

func (l *Lister) GetObjects(namespace, restype, name string) ([]runtime.Object, error)

GetObjects returns a list of Kubernetes objects, given a namespace, type, and name. If namespace is an empty string, match objects in all namespaces. If name is an empty string, match all objects of the given type.

func (*Lister) GetPodsFor added in v0.4.1

func (l *Lister) GetPodsFor(obj runtime.Object) ([]*apiv1.Pod, error)

GetPodsFor returns all running and pending Pods associated with a given Kubernetes object.

func (*Lister) Sync added in v0.4.1

func (l *Lister) Sync() error

Sync waits for all informers to be synced. For servers, call this asynchronously. For testing, call this synchronously.

type MockEndpointsWatcher added in v0.4.0

type MockEndpointsWatcher struct {
	HostReceived         string
	ListenerSubscribed   EndpointsListener
	ListenerUnsubscribed EndpointsListener
	ServiceToReturn      *v1.Service
	ExistsToReturn       bool
	ErrToReturn          error
}

func (*MockEndpointsWatcher) GetService added in v0.4.0

func (m *MockEndpointsWatcher) GetService(service string) (*v1.Service, bool, error)

func (*MockEndpointsWatcher) Run added in v0.4.0

func (m *MockEndpointsWatcher) Run() error

func (*MockEndpointsWatcher) Stop added in v0.4.0

func (m *MockEndpointsWatcher) Stop()

func (*MockEndpointsWatcher) Subscribe added in v0.4.0

func (m *MockEndpointsWatcher) Subscribe(service string, port uint32, listener EndpointsListener) error

func (*MockEndpointsWatcher) Unsubscribe added in v0.4.0

func (m *MockEndpointsWatcher) Unsubscribe(service string, port uint32, listener EndpointsListener) error

type PodIndex

type PodIndex interface {
	GetPod(key string) (*v1.Pod, error)
	GetPodsByIndex(key string) ([]*v1.Pod, error)
	List() ([]*v1.Pod, error)
	Run() error
	Stop()
}

func NewEmptyPodIndex added in v0.4.0

func NewEmptyPodIndex() PodIndex

func NewPodIndex

func NewPodIndex(clientset kubernetes.Interface, index cache.IndexFunc) (PodIndex, error)

func NewPodsByIp added in v0.4.0

func NewPodsByIp(clientSet *kubernetes.Clientset) (PodIndex, error)

NewPodsByIp returns a PodIndex with the Pod's IP as its key.

Jump to

Keyboard shortcuts

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