Documentation ¶
Index ¶
- Constants
- func IsIngressNetwork(nw *api.Network) bool
- func IsIngressNetworkNeeded(s *api.Service) bool
- func OnInit(options *ServiceAllocationOpts)
- type Config
- type DriverValidator
- type Inert
- func (Inert) Allocate(n *api.Network) error
- func (Inert) AllocateAttachment(node *api.Node, networkAttachment *api.NetworkAttachment) error
- func (Inert) AllocateService(s *api.Service) error
- func (Inert) AllocateTask(t *api.Task) error
- func (Inert) Deallocate(n *api.Network) error
- func (Inert) DeallocateAttachment(node *api.Node, networkAttachment *api.NetworkAttachment) error
- func (Inert) DeallocateService(s *api.Service) error
- func (Inert) DeallocateTask(t *api.Task) error
- func (Inert) IsAllocated(n *api.Network) bool
- func (Inert) IsAttachmentAllocated(node *api.Node, networkAttachment *api.NetworkAttachment) bool
- func (Inert) IsServiceAllocated(s *api.Service, flags ...func(*ServiceAllocationOpts)) bool
- func (Inert) IsTaskAllocated(t *api.Task) bool
- type InertProvider
- func (InertProvider) NewAllocator(*Config) (NetworkAllocator, error)
- func (InertProvider) PredefinedNetworks() []PredefinedNetworkData
- func (InertProvider) SetDefaultVXLANUDPPort(uint32) error
- func (InertProvider) ValidateIPAMDriver(d *api.Driver) error
- func (InertProvider) ValidateIngressNetworkDriver(d *api.Driver) error
- func (InertProvider) ValidateNetworkDriver(d *api.Driver) error
- type NetworkAllocator
- type PredefinedNetworkData
- type Provider
- type ServiceAllocationOpts
Constants ¶
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 ¶
IsIngressNetwork check if the network is an ingress network
func IsIngressNetworkNeeded ¶
IsIngressNetworkNeeded checks whether the service requires the routing-mesh
func OnInit ¶
func OnInit(options *ServiceAllocationOpts)
OnInit is called for allocator initialization stage
Types ¶
type Config ¶
type Config struct { // DefaultAddrPool specifies default subnet pool for global scope networks DefaultAddrPool []string // SubnetSize specifies the subnet size of the networks created from // the default subnet pool SubnetSize uint32 // VXLANUDPPort specifies the UDP port number for VXLAN traffic VXLANUDPPort uint32 }
Config is used to store network related cluster config in the Manager.
type DriverValidator ¶
type DriverValidator interface { ValidateNetworkDriver(*api.Driver) error ValidateIngressNetworkDriver(*api.Driver) error ValidateIPAMDriver(*api.Driver) error }
DriverValidator validates whether a network driver spec is supported by the network provider.
type Inert ¶
type Inert struct{}
Inert is a NetworkAllocator which does not allocate networks.
func (Inert) AllocateAttachment ¶
AllocateAttachment unconditionally returns an error.
func (Inert) AllocateService ¶
AllocateService succeeds iff the service specifies no network attachments.
func (Inert) AllocateTask ¶
AllocateTask succeeds iff the task specifies no network attachments.
func (Inert) Deallocate ¶
Deallocate does nothing, successfully.
func (Inert) DeallocateAttachment ¶
DeallocateAttachment does nothing, successfully.
func (Inert) DeallocateService ¶
DeallocateService does nothing, successfully.
func (Inert) DeallocateTask ¶
DeallocateTask does nothing, successfully.
func (Inert) IsAllocated ¶
IsAllocated returns true iff Inert.Allocate would return nil.
func (Inert) IsAttachmentAllocated ¶
IsAttachmentAllocated returns false.
func (Inert) IsServiceAllocated ¶
func (Inert) IsServiceAllocated(s *api.Service, flags ...func(*ServiceAllocationOpts)) bool
IsServiceAllocated returns true iff Inert.AllocateService would return nil.
func (Inert) IsTaskAllocated ¶
IsTaskAllocated returns true iff Inert.AllocateTask would return nil.
type InertProvider ¶
type InertProvider struct{}
InertProvider is a network allocator Provider which does not allocate networks.
func (InertProvider) NewAllocator ¶
func (InertProvider) NewAllocator(*Config) (NetworkAllocator, error)
NewAllocator returns an instance of Inert.
func (InertProvider) PredefinedNetworks ¶
func (InertProvider) PredefinedNetworks() []PredefinedNetworkData
PredefinedNetworks returns a nil slice.
func (InertProvider) SetDefaultVXLANUDPPort ¶
func (InertProvider) SetDefaultVXLANUDPPort(uint32) error
SetDefaultVXLANUDPPort is a no-op.
func (InertProvider) ValidateIPAMDriver ¶
func (InertProvider) ValidateIPAMDriver(d *api.Driver) error
ValidateIPAMDriver returns an InvalidArgument error unless d is nil.
func (InertProvider) ValidateIngressNetworkDriver ¶
func (InertProvider) ValidateIngressNetworkDriver(d *api.Driver) error
ValidateIngressNetworkDriver returns an InvalidArgument error unless d is nil.
func (InertProvider) ValidateNetworkDriver ¶
func (InertProvider) ValidateNetworkDriver(d *api.Driver) error
ValidateNetworkDriver returns an InvalidArgument error unless d is nil.
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 // 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 ¶
PredefinedNetworkData contains the minimum set of data needed to create the correspondent predefined network object in the store.
type Provider ¶
type Provider interface { DriverValidator PredefinedNetworks() []PredefinedNetworkData SetDefaultVXLANUDPPort(uint32) error NewAllocator(*Config) (NetworkAllocator, error) }
Provider provides network allocation functionality.
type ServiceAllocationOpts ¶
type ServiceAllocationOpts struct {
OnInit bool
}
ServiceAllocationOpts is struct used for functional options in IsServiceAllocated