networkallocator

package
v0.0.0-...-1e20cbf Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PredefinedLabel identifies internally allocated swarm networks
	// corresponding to the node-local predefined networks on the host.
	PredefinedLabel = "com.docker.swarm.predefined"
)

Variables

This section is empty.

Functions

func IsIngressNetwork

func IsIngressNetwork(nw *api.Network) bool

IsIngressNetwork check if the network is an ingress network

func IsIngressNetworkNeeded

func IsIngressNetworkNeeded(s *api.Service) bool

IsIngressNetworkNeeded checks whether the service requires the routing-mesh

func OnInit

func OnInit(options *ServiceAllocationOpts)

OnInit is called for allocator initialization stage

Types

type NetworkAllocator

type NetworkAllocator interface {

	// IsAllocated returns if the passed network has been allocated or not.
	IsAllocated(n *api.Network) bool

	// Allocate allocates all the necessary resources both general
	// and driver-specific which may be specified in the NetworkSpec
	Allocate(n *api.Network) error

	// Deallocate frees all the general and driver specific resources
	// which were assigned to the passed network.
	Deallocate(n *api.Network) error

	// IsServiceAllocated returns false if the passed service
	// needs to have network resources allocated/updated.
	IsServiceAllocated(s *api.Service, flags ...func(*ServiceAllocationOpts)) bool

	// AllocateService allocates all the network resources such as virtual
	// IP and ports needed by the service.
	AllocateService(s *api.Service) (err error)

	// DeallocateService de-allocates all the network resources such as
	// virtual IP and ports associated with the service.
	DeallocateService(s *api.Service) error

	// HostPublishPortsNeedUpdate returns true if the passed service needs
	// allocations for its published ports in host (non ingress) mode
	HostPublishPortsNeedUpdate(s *api.Service) bool

	// IsTaskAllocated returns if the passed task has its network
	// resources allocated or not.
	IsTaskAllocated(t *api.Task) bool

	// AllocateTask allocates all the endpoint resources for all the
	// networks that a task is attached to.
	AllocateTask(t *api.Task) error

	// DeallocateTask releases all the endpoint resources for all the
	// networks that a task is attached to.
	DeallocateTask(t *api.Task) error

	// AllocateAttachment Allocates a load balancer endpoint for the node
	AllocateAttachment(node *api.Node, networkAttachment *api.NetworkAttachment) error

	// DeallocateAttachment Deallocates a load balancer endpoint for the node
	DeallocateAttachment(node *api.Node, networkAttachment *api.NetworkAttachment) error

	// IsAttachmentAllocated If lb endpoint is allocated on the node
	IsAttachmentAllocated(node *api.Node, networkAttachment *api.NetworkAttachment) bool
}

NetworkAllocator provides network model specific allocation functionality.

type PredefinedNetworkData

type PredefinedNetworkData struct {
	Name   string
	Driver string
}

PredefinedNetworkData contains the minimum set of data needed to create the correspondent predefined network object in the store.

type ServiceAllocationOpts

type ServiceAllocationOpts struct {
	OnInit bool
}

ServiceAllocationOpts is struct used for functional options in IsServiceAllocated

Jump to

Keyboard shortcuts

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