kubernetes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package kubernetes is a generated GoMock package.

Index

Constants

View Source
const (
	// DefaultKubeEventResyncInterval is the default resync interval for k8s events
	DefaultKubeEventResyncInterval = 30 * time.Second

	// ProviderName is used for provider logging
	ProviderName = "Kubernetes"
)

Variables

This section is empty.

Functions

func GetHostnamesForService added in v0.3.0

func GetHostnamesForService(service *corev1.Service) []string

GetHostnamesForService returns a list of hostnames over which the service can be accessed within the local cluster.

func GetKubernetesEventHandlers

func GetKubernetesEventHandlers(informerName string, providerName string, announcements chan interface{}, shouldObserve observeFilter) cache.ResourceEventHandlerFuncs

GetKubernetesEventHandlers creates Kubernetes events handlers.

func GetServiceFromHostname added in v0.3.0

func GetServiceFromHostname(host string) string

GetServiceFromHostname returns the service name from its hostname

Types

type Client added in v0.4.0

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

Client is a struct for all components necessary to connect to and maintain state of a Kubernetes cluster.

func (Client) GetAnnouncementsChannel added in v0.4.0

func (c Client) GetAnnouncementsChannel(informerID InformerKey) <-chan interface{}

GetAnnouncementsChannel gets the Announcements channel back

func (Client) GetService added in v0.4.0

func (c Client) GetService(svc service.MeshService) *corev1.Service

GetService retrieves the Kubernetes Services resource for the given MeshService

func (Client) IsMonitoredNamespace added in v0.4.0

func (c Client) IsMonitoredNamespace(namespace string) bool

IsMonitoredNamespace returns a boolean indicating if the namespace is among the list of monitored namespaces

func (Client) ListMonitoredNamespaces added in v0.4.0

func (c Client) ListMonitoredNamespaces() ([]string, error)

ListMonitoredNamespaces returns all namespaces that the mesh is monitoring.

func (Client) ListServices added in v0.4.0

func (c Client) ListServices() []*corev1.Service

ListServices returns a list of services that are part of monitored namespaces

type Controller added in v0.4.0

type Controller interface {
	// ListServices returns a list of all (monitored-namespace filtered) services in the mesh
	ListServices() []*corev1.Service

	// Returns a corev1 Service representation if the MeshService exists in cache, otherwise nil
	GetService(svc service.MeshService) *corev1.Service

	// IsMonitoredNamespace returns whether a namespace with the given name is being monitored
	// by the mesh
	IsMonitoredNamespace(string) bool

	// ListMonitoredNamespaces returns the namespaces monitored by the mesh
	ListMonitoredNamespaces() ([]string, error)

	// Returns the announcement channel for a certain Informer ID
	GetAnnouncementsChannel(informerID InformerKey) <-chan interface{}
}

Controller is the controller interface for K8s services

func NewKubernetesController added in v0.4.0

func NewKubernetesController(kubeClient kubernetes.Interface, meshName string, stop chan struct{}) (Controller, error)

NewKubernetesController returns a new kubernetes.Controller which means to provide access to locally-cached k8s resources

type Event

type Event struct {
	Type  EventType
	Value interface{}
}

Event is the combined type and actual object we received from Kubernetes

type EventType

type EventType int

EventType is the type of event we have received from Kubernetes

const (
	// CreateEvent is a type of a Kubernetes API event.
	CreateEvent EventType = iota + 1

	// UpdateEvent is a type of a Kubernetes API event.
	UpdateEvent

	// DeleteEvent is a type of a Kubernetes API event.
	DeleteEvent
)

type InformerCollection added in v0.4.0

type InformerCollection map[InformerKey]cache.SharedIndexInformer

InformerCollection is the type holding the collection of informers we keep

type InformerKey added in v0.4.0

type InformerKey string

InformerKey stores the different Informers we keep for K8s resources

const (
	// Namespaces lookup identifier
	Namespaces InformerKey = "Namespaces"
	// Services lookup identifier
	Services InformerKey = "Services"
)

type MockController added in v0.4.0

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

MockController is a mock of Controller interface

func NewMockController added in v0.4.0

func NewMockController(ctrl *gomock.Controller) *MockController

NewMockController creates a new mock instance

func (*MockController) EXPECT added in v0.4.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockController) GetAnnouncementsChannel added in v0.4.0

func (m *MockController) GetAnnouncementsChannel(arg0 InformerKey) <-chan interface{}

GetAnnouncementsChannel mocks base method

func (*MockController) GetService added in v0.4.0

func (m *MockController) GetService(arg0 service.MeshService) *v1.Service

GetService mocks base method

func (*MockController) IsMonitoredNamespace added in v0.4.0

func (m *MockController) IsMonitoredNamespace(arg0 string) bool

IsMonitoredNamespace mocks base method

func (*MockController) ListMonitoredNamespaces added in v0.4.0

func (m *MockController) ListMonitoredNamespaces() ([]string, error)

ListMonitoredNamespaces mocks base method

func (*MockController) ListServices added in v0.4.0

func (m *MockController) ListServices() []*v1.Service

ListServices mocks base method

type MockControllerMockRecorder added in v0.4.0

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

MockControllerMockRecorder is the mock recorder for MockController

func (*MockControllerMockRecorder) GetAnnouncementsChannel added in v0.4.0

func (mr *MockControllerMockRecorder) GetAnnouncementsChannel(arg0 interface{}) *gomock.Call

GetAnnouncementsChannel indicates an expected call of GetAnnouncementsChannel

func (*MockControllerMockRecorder) GetService added in v0.4.0

func (mr *MockControllerMockRecorder) GetService(arg0 interface{}) *gomock.Call

GetService indicates an expected call of GetService

func (*MockControllerMockRecorder) IsMonitoredNamespace added in v0.4.0

func (mr *MockControllerMockRecorder) IsMonitoredNamespace(arg0 interface{}) *gomock.Call

IsMonitoredNamespace indicates an expected call of IsMonitoredNamespace

func (*MockControllerMockRecorder) ListMonitoredNamespaces added in v0.4.0

func (mr *MockControllerMockRecorder) ListMonitoredNamespaces() *gomock.Call

ListMonitoredNamespaces indicates an expected call of ListMonitoredNamespaces

func (*MockControllerMockRecorder) ListServices added in v0.4.0

func (mr *MockControllerMockRecorder) ListServices() *gomock.Call

ListServices indicates an expected call of ListServices

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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