Documentation ¶
Index ¶
- type Deps
- type LocalEndpoint
- type ResyncEventData
- type Service
- type ServiceProcessor
- func (sp *ServiceProcessor) AfterInit() error
- func (sp *ServiceProcessor) Close() error
- func (sp *ServiceProcessor) Init() error
- func (sp *ServiceProcessor) ProcessDeletingPod(podNamespace string, podName string) error
- func (sp *ServiceProcessor) ProcessNewPod(podNamespace string, podName string) error
- func (sp *ServiceProcessor) RegisterRenderer(renderer renderer.ServiceRendererAPI) error
- func (sp *ServiceProcessor) Resync(kubeStateData controller.KubeStateData) error
- func (sp *ServiceProcessor) Revert(event controller.Event) error
- func (sp *ServiceProcessor) Update(event controller.Event) error
- type ServiceProcessorAPI
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 ContivConf contivconf.API NodeSync nodesync.API PodManager podmanager.API IPAM ipam.API IPNet ipnet.API }
Deps lists dependencies of ServiceProcessor.
type LocalEndpoint ¶
type LocalEndpoint struct {
// contains filtered or unexported fields
}
LocalEndpoint represents a node-local endpoint.
type ResyncEventData ¶
type ResyncEventData struct { Pods []podmodel.ID Endpoints []*epmodel.Endpoints Services []*svcmodel.Service IPAllocations []*ipalloc.CustomIPAllocation }
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() *renderer.ContivService
GetContivService returns the service data represented as ContivService. Returns nil if there are not enough available data.
func (*Service) GetLocalBackends ¶
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 ¶
SetEndpoints initializes or changes endpoints for the service.
func (*Service) SetMetadata ¶
SetMetadata initializes or changes metadata for the service.
type ServiceProcessor ¶
type ServiceProcessor struct { Deps // contains filtered or unexported fields }
ServiceProcessor implements ServiceProcessorAPI.
func (*ServiceProcessor) AfterInit ¶
func (sp *ServiceProcessor) AfterInit() error
AfterInit does nothing for the processor.
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) ProcessDeletingPod ¶
func (sp *ServiceProcessor) ProcessDeletingPod(podNamespace string, podName string) error
ProcessDeletingPod is called during pod removal.
func (*ServiceProcessor) ProcessNewPod ¶
func (sp *ServiceProcessor) ProcessNewPod(podNamespace string, podName string) error
ProcessNewPod is called when connectivity to pod is being established.
func (*ServiceProcessor) RegisterRenderer ¶
func (sp *ServiceProcessor) RegisterRenderer(renderer renderer.ServiceRendererAPI) error
RegisterRenderer registers a new service renderer. The renderer will be receiving updates for all services on the cluster.
func (*ServiceProcessor) Resync ¶
func (sp *ServiceProcessor) Resync(kubeStateData controller.KubeStateData) error
Resync processes a resync event. The cache content is fully replaced and all registered renderers receive a full snapshot of Contiv Services at the present state to be (re)installed.
func (*ServiceProcessor) Revert ¶
func (sp *ServiceProcessor) Revert(event controller.Event) error
Revert is called for failed AddPod event.
func (*ServiceProcessor) Update ¶
func (sp *ServiceProcessor) Update(event controller.Event) error
Update is called for:
- KubeStateChange for service-related data
- AddPod & DeletePod
- NodeUpdate event
type ServiceProcessorAPI ¶
type ServiceProcessorAPI interface { // Update processes a datasync change event associated with the state data // of K8s pods, endpoints, services and nodes. // The data change is stored into the cache and all registered renderers // are notified about any changes related to services that need to be // reflected in the underlying network stack(s). Update(dataChngEv datasync.ChangeEvent) error // Resync processes a datasync resync event associated with the state data // of K8s pods, endpoints, services and nodes. // The cache content is fully replaced and all registered renderers // receive a full snapshot of Contiv Services at the present state to be // (re)installed. Resync(resyncEv datasync.ResyncEvent) error // RegisterRenderer registers a new service renderer. // The renderer will be receiving updates for all services on the cluster. RegisterRenderer(renderer renderer.ServiceRendererAPI) 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 endpoints of at least one service). The set of physical interfaces and interfaces connecting pods are learned from the Contiv plugin.
The combined service and endpoint state/configuration data are passed further to all registered renderers. The processor allows to register multiple renderers at once, each receiving the same set of data.