Documentation
¶
Overview ¶
Package networkprovider supplies interfaces and implementations for network providers.
Index ¶
- Variables
- func ApiNetworkToProviderNetwork(net *api.Network) *types.Network
- func BuildLoadBalancerName(name, namespace string) string
- func BuildNetworkName(name, tenantID string) string
- func RegisterNetworkProvider(name string, networkProvider Factory)
- type Factory
- type Interface
- type LoadBalancerType
- type LoadBalancers
- type NetworkStatus
- type Networks
- type Pods
Constants ¶
This section is empty.
Variables ¶
var ErrMultipleResults = errors.New("MultipleResults")
var ErrNotFound = errors.New("NotFound")
Functions ¶
func BuildLoadBalancerName ¶
func BuildNetworkName ¶
func RegisterNetworkProvider ¶
RegisterNetworkProvider registers a networkprovider.Factory by name. This is expected to happen during app startup.
Types ¶
type Factory ¶
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 ¶
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 ¶
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)
}