networkprovider

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package networkprovider supplies interfaces and implementations for network providers.

Index

Constants

This section is empty.

Variables

View Source
var ErrMultipleResults = errors.New("MultipleResults")
View Source
var ErrNotFound = errors.New("NotFound")

Functions

func ApiNetworkToProviderNetwork

func ApiNetworkToProviderNetwork(net *api.Network) *types.Network

func BuildLoadBalancerName

func BuildLoadBalancerName(name, namespace string) string

func BuildNetworkName

func BuildNetworkName(name, tenantID string) string

func RegisterNetworkProvider

func RegisterNetworkProvider(name string, networkProvider Factory)

RegisterNetworkProvider registers a networkprovider.Factory by name. This is expected to happen during app startup.

Types

type Factory

type Factory func() (Interface, error)

Factory is a function that returns a networkprovider.Interface. The config parameter provides an io.Reader handler to the factory in order to load specific configurations. If no configuration is provided the parameter is nil.

type Interface

type Interface interface {
	// Pods returns a pod interface
	Pods() Pods
	// Networks returns a network interface
	Networks() Networks
	// LoadBalancer returns a balancer interface
	LoadBalancers() LoadBalancers
	// ProviderName returns the network provider ID.
	ProviderName() string
	// CheckTenantID
	CheckTenantID(tenantID string) (bool, error)
}

Interface is an abstract, pluggable interface for network providers.

func GetNetworkProvider

func GetNetworkProvider(name string) (Interface, error)

GetNetworkProvider creates an instance of the named network provider, or nil if the name is not known. The error return is only used if the named provider was known but failed to initialize.

func InitNetworkProvider

func InitNetworkProvider(name string) (Interface, error)

InitNetworkProvider creates an instance of the named networkProvider provider.

type LoadBalancerType

type LoadBalancerType string

LoadBalancerType is the type of the load balancer

const (
	LoadBalancerTypeTCP   LoadBalancerType = "TCP"
	LoadBalancerTypeUDP   LoadBalancerType = "UDP"
	LoadBalancerTypeHTTP  LoadBalancerType = "HTTP"
	LoadBalancerTypeHTTPS LoadBalancerType = "HTTPS"
)

type LoadBalancers

type LoadBalancers interface {
	// Get load balancer by name
	GetLoadBalancer(name string) (*types.LoadBalancer, error)
	// Create load balancer, return vip and externalIP
	CreateLoadBalancer(loadBalancer *types.LoadBalancer, affinity api.ServiceAffinity) (string, error)
	// Update load balancer, return vip and externalIP
	UpdateLoadBalancer(name string, hosts []*types.HostPort, externalIPs []string) (string, error)
	// Delete load balancer
	DeleteLoadBalancer(name string) error
}

LoadBalancers is an abstract, pluggable interface for load balancers.

type NetworkStatus

type NetworkStatus string
const (
	// NetworkInitializing means the network is just accepted by system
	NetworkInitializing NetworkStatus = "Initializing"
	// NetworkActive means the network is available for use in the system
	NetworkActive NetworkStatus = "Active"
	// NetworkPending means the network is accepted by system, but it is still
	// processing by network provider
	NetworkPending NetworkStatus = "Pending"
	// NetworkFailed means the network is not available
	NetworkFailed NetworkStatus = "Failed"
	// NetworkTerminating means the network is undergoing graceful termination
	NetworkTerminating NetworkStatus = "Terminating"
)

type Networks

type Networks interface {
	// Get network by networkName
	GetNetwork(networkName string) (*types.Network, error)
	// Get network by networkID
	GetNetworkByID(networkID string) (*types.Network, error)
	// Create network
	CreateNetwork(network *types.Network) error
	// Update network
	UpdateNetwork(network *types.Network) error
	// Delete network by networkName
	DeleteNetwork(networkName string) error
}

Networks is an abstract, pluggable interface for network segment

type Pods

type Pods interface {
	// Setup pod
	SetupPod(podName, namespace, podInfraContainerID string, network *types.Network, containerRuntime string) error
	// Teardown pod
	TeardownPod(podName, namespace, podInfraContainerID string, network *types.Network, containerRuntime string) error
	// Status of pod
	PodStatus(podName, namespace, podInfraContainerID string, network *types.Network, containerRuntime string) (string, error)
}

Directories

Path Synopsis
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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