Documentation ¶
Overview ¶
Package networkprovider supplies interfaces and implementations for network providers.
Index ¶
- Variables
- func BuildLoadBalancerName(name, namespace string) string
- func BuildNetworkName(name, tenantID string) string
- func RegisterNetworkProvider(name string, networkProvider Factory)
- type Factory
- type HostPort
- type Interface
- type LoadBalancer
- type LoadBalancerType
- type LoadBalancers
- type Network
- type NetworkStatus
- type Networks
- type Pods
- type Route
- type Subnet
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 LoadBalancer ¶
type LoadBalancer struct { // the name of the load balancer Name string `json:"name"` // the id of the load balancer UID string `json:"id,omitempty"` // the type of the load balancer Type LoadBalancerType `json:"loadBalanceType,omitempty"` // the vip of the load balancer Vip string `json:"vip,omitempty"` // the external ip of the load balancer ExternalIPs []string `json:"externalIPs,omitempty"` // subnet of the load balancer Subnets []*Subnet `json:"subnets"` // hosts and ports of the load balancer Hosts []*HostPort `json:"hosts"` // status Status string `json:"status"` // TenantID is the tenant id of the network TenantID string `json:"tenantID"` }
LoadBalancer is a replace of kube-proxy, so load-balancing can be handled by network providers so as to overcome iptables overhead
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) (*LoadBalancer, error) // Create load balancer, return vip and externalIP CreateLoadBalancer(loadBalancer *LoadBalancer, affinity api.ServiceAffinity) (string, error) // Update load balancer, return vip and externalIP UpdateLoadBalancer(name string, hosts []*HostPort, externalIPs []string) (string, error) // Delete load balancer DeleteLoadBalancer(name string) error }
LoadBalancers is an abstract, pluggable interface for load balancers.
type Network ¶
type Network struct { // Name is the name of the network Name string `json:"name"` // UID is the id of the network UID string `json:"id,omitempty"` // SegmentID is the segment id of the network SegmentID int `json:"segmentID,omitempty"` // Subnets is a list of Subnet belongs to the network Subnets []*Subnet `json:"subnets,omitempty"` // TenantID is the tenant id of the network TenantID string `json:"tenantID,omitempty"` // Status is the status fo the network Status NetworkStatus `json:"status"` }
Network is a representation of a network segment
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) (*Network, error) // Get network by networkID GetNetworkByID(networkID string) (*Network, error) // Create network CreateNetwork(network *Network) error // Update network UpdateNetwork(network *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 *Network, containerRuntime string) error // Teardown pod TeardownPod(podName, namespace, podInfraContainerID string, network *Network, containerRuntime string) error // Status of pod PodStatus(podName, namespace, podInfraContainerID string, network *Network, containerRuntime string) (string, error) }
type Route ¶
type Route struct { // Name is the name of the routing rule in the subnet Name string `json:"name,omitempty"` // TNexthop is the nexthop the specified route Nexthop string `json:"nexthop"` // Destination CIDR is the CIDR format IP range that this routing rule // applies to. DestinationCIDR string `json:"destinationCIDR,omitempty"` }
Route is a representation of an advanced routing rule.
type Subnet ¶
type Subnet struct { // Name is the name of the subnet Name string `json:"name"` // UID is the id of the subnet UID string `json:"id,omitempty"` // CIDR is the subnet cidr of the subnet CIDR string `json:"cidr"` // Gateway is the gateway of the subnet Gateway string `json:"gateway,omitempty"` // Routes is a list of routes of the subnet Routes []*Route `json:"routes,omitempty"` // DNSNameServer is a list of dns nameservers of the subnet DNSNameServer []string `json:"dnsNameservers,omitempty"` // TenantID is the tenant id of the subnet TenantID string `json:"tenantID,omitempty"` }
Subnet is a representaion of a subnet