service

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package service implements Kubernetes Services [1] for Contiv/VPP.

A detailed description of the plugin can be found in the developer's guide for services [2].

[1]: https://kubernetes.io/docs/concepts/services-networking/service/ [2]: docs/dev-guide/SERVICES.md (from the repo's top directory)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	infra.PluginDeps
	ServiceLabel servicelabel.ReaderAPI
	ContivConf   contivconf.API
	IPAM         ipam.API
	IPv4Net      ipv4net.API        /* to get the Node IP and all interface names */
	NodeSync     nodesync.API       /* to get the list of all node IPs for nodePort services */
	PodManager   podmanager.API     /* to get the list or running pods which determines frontend interfaces */
	GoVPP        govppmux.API       /* used for direct NAT binary API calls */
	Stats        statscollector.API /* used for exporting the statistics */
}

Deps defines dependencies of the service plugin.

type Option

type Option func(*Plugin)

Option is a function that acts on a Plugin to inject Dependencies or configuration

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

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

Plugin watches configuration of K8s resources (as reflected by KSR into ETCD) for changes in services, endpoints and pods and updates the NAT configuration in the VPP accordingly.

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provides Options

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() error

AfterInit registers to the ResyncOrchestrator. The registration is done in this phase in order to ensure that the resync for this plugin is triggered only after resync of the Contiv plugin has finished.

func (*Plugin) Close

func (p *Plugin) Close() error

Close is NOOP.

func (*Plugin) HandlesEvent

func (p *Plugin) HandlesEvent(event controller.Event) bool

HandlesEvent selects:

  • any resync event
  • KubeStateChange for service-related data
  • AddPod & DeletePod
  • NodeUpdate event

func (*Plugin) Init

func (p *Plugin) Init() error

Init initializes the service plugin and starts watching ETCD for K8s configuration.

func (*Plugin) Resync

func (p *Plugin) Resync(event controller.Event, kubeStateData controller.KubeStateData,
	resyncCount int, txn controller.ResyncOperations) error

Resync is called by Controller to handle event that requires full re-synchronization. For startup resync, resyncCount is 1. Higher counter values identify run-time resync.

func (*Plugin) Revert

func (p *Plugin) Revert(event controller.Event) error

Revert is called for failed AddPod event.

func (*Plugin) Update

func (p *Plugin) Update(event controller.Event, txn controller.UpdateOperations) (changeDescription string, err error)

Update is called for:

  • KubeStateChange for service-related data
  • AddPod & DeletePod
  • NodeUpdate event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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