processor

package
v0.0.0-...-a11b7ec Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Log          logging.Logger
	ServiceLabel servicelabel.ReaderAPI
	Contiv       contiv.API         /* to get all interface names and pod IP network */
	VPP          defaultplugins.API /* interface IP addresses */
	Configurator configurator.ServiceConfiguratorAPI
}

Deps lists dependencies of ServiceProcessor.

type InterfaceIPAddress

type InterfaceIPAddress struct {
	IP      net.IP
	Network *net.IPNet
}

InterfaceIPAddress encapsulates interface IP address and the network implied by the IP and prefix length.

type LocalEndpoint

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

LocalEndpoint represents a node-local endpoint.

type ResyncEventData

type ResyncEventData struct {
	Nodes     map[int]*nodemodel.NodeInfo
	Pods      []*podmodel.Pod
	Endpoints []*epmodel.Endpoints
	Services  []*svcmodel.Service
}

ResyncEventData wraps an entire state of K8s services that should be reflected into VPP.

func NewResyncEventData

func NewResyncEventData() *ResyncEventData

NewResyncEventData creates an empty instance of ResyncEventData.

func (ResyncEventData) String

func (red ResyncEventData) String() string

String converts ResyncEventData into a human-readable string.

type Service

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

Service is used to combine data from the service model with the endpoints.

func NewService

func NewService(sp *ServiceProcessor) *Service

NewService is a constructor for Service.

func (*Service) GetContivService

func (s *Service) GetContivService() *configurator.ContivService

GetContivService returns the service data represented as ContivService. Returns nil if there are not enough available data.

func (*Service) GetLocalBackends

func (s *Service) GetLocalBackends() []podmodel.ID

GetLocalBackends returns the set of IDs od all local backends of this service. Returns empty array if there are not enough available data.

func (*Service) Refresh

func (s *Service) Refresh()

Refresh combines metadata with endpoints to get ContivService representation and the list of local backends.

func (*Service) SetEndpoints

func (s *Service) SetEndpoints(endpoints *epmodel.Endpoints)

SetEndpoints initializes or changes endpoints for the service.

func (*Service) SetMetadata

func (s *Service) SetMetadata(meta *svcmodel.Service)

SetMetadata initializes or changes metadata for the service.

type ServiceProcessor

type ServiceProcessor struct {
	Deps
	// contains filtered or unexported fields
}

ServiceProcessor implements ServiceProcessorAPI.

func (*ServiceProcessor) Close

func (sp *ServiceProcessor) Close() error

Close deallocates resource held by the processor.

func (*ServiceProcessor) Init

func (sp *ServiceProcessor) Init() error

Init initializes service processor.

func (*ServiceProcessor) Resync

func (sp *ServiceProcessor) Resync(resyncEv datasync.ResyncEvent) error

Resync processes a datasync resync event associated with the state data of K8s pods, endpoints and services. The cache content is fully replaced and the configurator receives a full snapshot of Contiv Services at the present state to be (re)installed.

func (*ServiceProcessor) Update

func (sp *ServiceProcessor) Update(dataChngEv datasync.ChangeEvent) error

Update processes a datasync change event associated with the state data of K8s pods, endpoints and services. The data change is stored into the cache and the configurator is notified about any changes related to services that need to be reflected in the VPP NAT configuration.

type ServiceProcessorAPI

type ServiceProcessorAPI interface {
	// Update processes a datasync change event associated with the state data
	// of K8s pods, endpoints and services.
	// The data change is stored into the cache and the configurator
	// is notified about any changes related to services that need to be reflected
	// in the VPP NAT configuration.
	Update(dataChngEv datasync.ChangeEvent) error

	// Resync processes a datasync resync event associated with the state data
	// of K8s pods, endpoints and services.
	// The cache content is fully replaced and the configurator receives a full
	// snapshot of Contiv Services at the present state to be (re)installed.
	Resync(resyncEv datasync.ResyncEvent) error
}

ServiceProcessorAPI defines the API of the Service Processor. The processor receives RESYNC and data-change events for endpoints and services from the service plugin. The state of the K8s configuration is internally cached (since the last RESYNC). The cache is used to match subsets of endpoints with the corresponding service definition (including ports). Based on the service type, the list of addresses on which the service should be exposed is determined. Processor also maintains the set of interfaces connecting frontends (physical interfaces and pods that do not run any service) and backends (pods which act as replicas of some service). The set of physical interfaces and interfaces connecting pods are learned from the Contiv plugin.

Jump to

Keyboard shortcuts

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