opencontrail

package
v0.0.0-...-814f547 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2016 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MetadataAnnotationTag = "opencontrail.org/pod-state"

	DefaultPodNetworkName     = "cluster-network"
	DefaultServiceDomainName  = "default-domain"
	DefaultServiceProjectName = "default"
	ClusterNetworkName        = "cluster-network"
	ClusterServiceNetworkName = DefaultServiceDomainName + ":" + DefaultServiceProjectName +
		":" + ClusterNetworkName
)
View Source
const (
	AddressAllocationNetwork = "default-domain:default:addr-alloc"
)
View Source
const (
	DefaultServiceSubnet = "10.254.0.0/16"
)
View Source
const (
	ServiceNetworkFmt = "service-%s"
)

Variables

This section is empty.

Functions

func AppendConst

func AppendConst(slice []string, element string) []string

func CompareSortedLists

func CompareSortedLists(lhs, rhs []string, addFn, delFn deltaFn, cmpFn compareFn) bool

func EqualTags

func EqualTags(m1, m2 map[string]string, tags []string) bool

func IgnorePod

func IgnorePod(pod *api.Pod) bool

IgnorePod returns true if this pod should not be managed by OpenContrail. Pods that use host networking on kubelet static pods fall into this category.

func IsClusterService

func IsClusterService(c *Config, namespace, name string) bool

func NewController

func NewController(kube *kubeclient.Client, args []string) network.NetworkController

func PrefixToAddressLen

func PrefixToAddressLen(subnet string) (string, int)

Types

type AddressAllocator

type AddressAllocator interface {
	LocateIpAddress(uid string) (string, error)
	ReleaseIpAddress(uid string)
}

func NewAddressAllocator

func NewAddressAllocator(client contrail.ApiClient, config *Config) AddressAllocator

type AddressAllocatorImpl

type AddressAllocatorImpl struct {
	// contains filtered or unexported fields
}

Allocate an unique address for each Pod.

func (*AddressAllocatorImpl) LocateIpAddress

func (a *AddressAllocatorImpl) LocateIpAddress(uid string) (string, error)

func (*AddressAllocatorImpl) ReleaseIpAddress

func (a *AddressAllocatorImpl) ReleaseIpAddress(uid string)

type Config

type Config struct {
	// OpenContrail Default Domain
	DefaultDomain string `gcfg:"default-domain"`

	// OpenContrail api server address:port
	ApiAddress string `gcfg:"api-server"`
	ApiPort    int    `gcfg:"api-port"`

	// Project used for objects that are not namespace specific
	DefaultProject string `gcfg:"default"`
	// Network identifier for the external network
	PublicNetwork string `gcfg:"public-network"`
	// IP address range configured on the external network
	PublicSubnet string `gcfg:"public-ip-range"`
	// IP address range used to allocate Pod private IP addresses
	PrivateSubnet string `gcfg:"private-ip-range"`
	// IP address range used by the kube-apiserver to allocate ClusterIP addresses for services
	ServiceSubnet string `gcfg:"service-cluster-ip-range"`

	// Label used to create the network name used by pods and services
	NetworkTag string `gcfg:"network-label"`
	// Label used to connect pods with services
	NetworkAccessTag string `gcfg:"service-label"`

	// Networks connected to all pod networks
	GlobalNetworks []string `gcfg:"global-network"`
	// Connect networks that match this pattern to the global network list.
	GlobalConnectInclude string `gcfg:"global-connect-include"`
	// Exclude networks that match the following pattern from connecting to the global network list.
	GlobalConnectExclude string `gcfg:"global-connect-exclude"`

	// Cluster-wide service networks
	ClusterServices []string `gcfg:"cluster-service"`

	// Tenant-specific service networks that are automatically attached to tenant networks
	NamespaceServices []string `gcfg:"namespace-service"`
}

func NewConfig

func NewConfig() *Config

func (*Config) Parse

func (c *Config) Parse(args []string)

DEPRECATED

func (*Config) ReadConfiguration

func (c *Config) ReadConfiguration(global *network.Config, reader io.Reader) error

func (*Config) Validate

func (c *Config) Validate() error

type ConsistencyChecker

type ConsistencyChecker interface {
	Check() bool
}

func NewConsistencyChecker

func NewConsistencyChecker(client contrail.ApiClient, config *Config, podStore cache.Indexer,
	serviceStore cache.Store, networkMgr NetworkManager, serviceMgr ServiceManager) ConsistencyChecker

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func (*Controller) AddNamespace

func (c *Controller) AddNamespace(namespace *api.Namespace)

func (*Controller) AddPod

func (c *Controller) AddPod(pod *api.Pod)

func (*Controller) AddReplicationController

func (c *Controller) AddReplicationController(rc *api.ReplicationController)

func (*Controller) AddService

func (c *Controller) AddService(service *api.Service)

func (*Controller) DeleteNamespace

func (c *Controller) DeleteNamespace(namespace *api.Namespace)

func (*Controller) DeletePod

func (c *Controller) DeletePod(pod *api.Pod)

func (*Controller) DeleteReplicationController

func (c *Controller) DeleteReplicationController(rc *api.ReplicationController)

func (*Controller) DeleteService

func (c *Controller) DeleteService(service *api.Service)

func (*Controller) GetPodNetwork

func (c *Controller) GetPodNetwork(pod *api.Pod) *types.VirtualNetwork

Retrieve the private network for this Pod.

func (*Controller) Init

func (c *Controller) Init(global *network.Config, reader io.Reader) error

func (*Controller) Run

func (c *Controller) Run(shutdown chan struct{})

func (*Controller) SetNamespaceStore

func (c *Controller) SetNamespaceStore(store cache.Store)

func (*Controller) SetPodStore

func (c *Controller) SetPodStore(store cache.Indexer)

func (*Controller) SetReplicationControllerStore

func (c *Controller) SetReplicationControllerStore(store cache.Store)

func (*Controller) SetServiceStore

func (c *Controller) SetServiceStore(store cache.Store)

func (*Controller) UpdateNamespace

func (c *Controller) UpdateNamespace(oldObj, newObj *api.Namespace)

func (*Controller) UpdatePod

func (c *Controller) UpdatePod(oldPod, newPod *api.Pod)

func (*Controller) UpdateReplicationController

func (c *Controller) UpdateReplicationController(oldObj, newObj *api.ReplicationController)

func (*Controller) UpdateService

func (c *Controller) UpdateService(oldObj, newObj *api.Service)

type InstanceManager

type InstanceManager struct {
	// contains filtered or unexported fields
}

func NewInstanceManager

func NewInstanceManager(client contrail.ApiClient, config *Config, allocator AddressAllocator) *InstanceManager

func (*InstanceManager) AttachFloatingIp

func (m *InstanceManager) AttachFloatingIp(
	podName, projectName string, floatingIp *types.FloatingIp)

func (*InstanceManager) DeleteInstance

func (m *InstanceManager) DeleteInstance(uid string) error

func (*InstanceManager) LocateInstance

func (m *InstanceManager) LocateInstance(tenant, podName, uid string) *types.VirtualMachine

func (*InstanceManager) LocateInstanceIp

func (m *InstanceManager) LocateInstanceIp(
	network *types.VirtualNetwork, instanceUID string, nic *types.VirtualMachineInterface) *types.InstanceIp

func (*InstanceManager) LocateInterface

func (m *InstanceManager) LocateInterface(project string,
	network *types.VirtualNetwork, instance *types.VirtualMachine) *types.VirtualMachineInterface

func (*InstanceManager) LookupInterface

func (m *InstanceManager) LookupInterface(tenant, podName string) *types.VirtualMachineInterface

func (*InstanceManager) ReleaseInstanceIp

func (m *InstanceManager) ReleaseInstanceIp(tenant, nicName, instanceUID string)

func (*InstanceManager) ReleaseInterface

func (m *InstanceManager) ReleaseInterface(project, podName string)

type InstanceMetadata

type InstanceMetadata struct {
	// Interface uuid
	Uuid string `json:"uuid"`

	// The OpenContrail vrouter verifies the source-mac of the virtual interface.
	MacAddress string `json:"macAddress"`

	// Private IP address
	IpAddress string `json:"ipAddress"`

	// Default gateway (VRouter address)
	Gateway string `json:"gateway"`
}

InstanceMetadata contains the information required in the kubernetes minion to connect the Pod interface to the network.

type NamespaceManager

type NamespaceManager struct {
	// contains filtered or unexported fields
}

func NewNamespaceManager

func NewNamespaceManager(client contrail.ApiClient, config *Config, kube kubeclient.Interface) *NamespaceManager

func (*NamespaceManager) DeleteNamespace

func (m *NamespaceManager) DeleteNamespace(name string) error

func (*NamespaceManager) LocateNamespace

func (m *NamespaceManager) LocateNamespace(name, uid string) *types.Project

func (*NamespaceManager) LookupNamespace

func (m *NamespaceManager) LookupNamespace(name string) *types.Project

type NetworkManager

type NetworkManager interface {
	LocateFloatingIpPool(network *types.VirtualNetwork) (*types.FloatingIpPool, error)
	LookupFloatingIpPool(network *types.VirtualNetwork) (*types.FloatingIpPool, error)
	DeleteFloatingIpPool(network *types.VirtualNetwork, cascade bool) error
	LookupNetwork(projectName, networkName string) (*types.VirtualNetwork, error)
	LocateNetwork(fqname, subnet string) (*types.VirtualNetwork, error)
	DeleteNetwork(*types.VirtualNetwork) error
	ReleaseNetworkIfEmpty(network *types.VirtualNetwork) (bool, error)
	LocateFloatingIp(network *types.VirtualNetwork, resourceName, address string) (*types.FloatingIp, error)
	DeleteFloatingIp(network *types.VirtualNetwork, resourceName string) error
	GetPublicNetwork() *types.VirtualNetwork
	GetClusterNetwork() *types.VirtualNetwork
	GetGatewayAddress(network *types.VirtualNetwork) (string, error)
	Connect(network *types.VirtualNetwork, targetCSN string) error
	Disconnect(networkFQN []string, targetCSN string) error
	DeleteConnections(network *types.VirtualNetwork, policies map[string]string) error
}

func NewNetworkManager

func NewNetworkManager(client contrail.ApiClient, config *Config) NetworkManager

type NetworkManagerImpl

type NetworkManagerImpl struct {
	// contains filtered or unexported fields
}

func (*NetworkManagerImpl) Connect

func (m *NetworkManagerImpl) Connect(network *types.VirtualNetwork, targetCSN string) error

Connect creates a network-policy and corresponding policy rule (when they do not exist) in order to connect the source network with the target. The target network may or not exist yet.

func (*NetworkManagerImpl) DeleteConnections

func (m *NetworkManagerImpl) DeleteConnections(network *types.VirtualNetwork, policies map[string]string) error

func (*NetworkManagerImpl) DeleteFloatingIp

func (m *NetworkManagerImpl) DeleteFloatingIp(network *types.VirtualNetwork, resourceName string) error

func (*NetworkManagerImpl) DeleteFloatingIpPool

func (m *NetworkManagerImpl) DeleteFloatingIpPool(network *types.VirtualNetwork, cascade bool) error

func (*NetworkManagerImpl) DeleteNetwork

func (m *NetworkManagerImpl) DeleteNetwork(network *types.VirtualNetwork) error

func (*NetworkManagerImpl) Disconnect

func (m *NetworkManagerImpl) Disconnect(networkFQN []string, targetCSN string) error

Disconnect is called after the virtual network is deleted. The corresponding rule should be removed from the policy; and the policy should be deleted if no longer in use.

func (*NetworkManagerImpl) GetClusterNetwork

func (m *NetworkManagerImpl) GetClusterNetwork() *types.VirtualNetwork

func (*NetworkManagerImpl) GetGatewayAddress

func (m *NetworkManagerImpl) GetGatewayAddress(network *types.VirtualNetwork) (string, error)

func (*NetworkManagerImpl) GetPublicNetwork

func (m *NetworkManagerImpl) GetPublicNetwork() *types.VirtualNetwork

func (*NetworkManagerImpl) LocateFloatingIp

func (m *NetworkManagerImpl) LocateFloatingIp(network *types.VirtualNetwork, resourceName, targetAddress string) (*types.FloatingIp, error)

func (*NetworkManagerImpl) LocateFloatingIpPool

func (m *NetworkManagerImpl) LocateFloatingIpPool(network *types.VirtualNetwork) (*types.FloatingIpPool, error)

func (*NetworkManagerImpl) LocateNetwork

func (m *NetworkManagerImpl) LocateNetwork(fqname, subnet string) (*types.VirtualNetwork, error)

LocateNetwork creates a private network.

It is used to create pod and service networks.

func (*NetworkManagerImpl) LookupFloatingIpPool

func (m *NetworkManagerImpl) LookupFloatingIpPool(network *types.VirtualNetwork) (*types.FloatingIpPool, error)

func (*NetworkManagerImpl) LookupNetwork

func (m *NetworkManagerImpl) LookupNetwork(projectName, networkName string) (*types.VirtualNetwork, error)

func (*NetworkManagerImpl) NetworkIPPrefixList

func (m *NetworkManagerImpl) NetworkIPPrefixList(network *types.VirtualNetwork) ([]string, error)

Retrieve the list of IP prefixes associated with this network.

func (*NetworkManagerImpl) ReleaseNetworkIfEmpty

func (m *NetworkManagerImpl) ReleaseNetworkIfEmpty(network *types.VirtualNetwork) (bool, error)

type ServiceId

type ServiceId struct {
	Namespace string
	Service   string
}

type ServiceIdList

type ServiceIdList []ServiceId

func MakeServiceIdList

func MakeServiceIdList() ServiceIdList

func (*ServiceIdList) Add

func (s *ServiceIdList) Add(namespace, service string)

func (*ServiceIdList) Contains

func (s *ServiceIdList) Contains(namespace, service string) bool

type ServiceManager

type ServiceManager interface {
	Create(service *api.Service) error
	Delete(service *api.Service) error
	GetServiceNetwork(service *api.Service) *types.VirtualNetwork
	GetServiceName(service *api.Service) string
	ConnectNetworks(podNetwork, serviceNetwork *types.VirtualNetwork) error
	Connect(network *types.VirtualNetwork, tenant, serviceName string) error
	Disconnect(podNetwork *types.VirtualNetwork, project, serviceName string) error
	DeleteConnections(*types.VirtualNetwork, []string) error
}

func NewServiceManager

func NewServiceManager(client contrail.ApiClient, config *Config, networkMgr NetworkManager,
	kube kubeclient.Interface) ServiceManager

type ServiceManagerImpl

type ServiceManagerImpl struct {
	// contains filtered or unexported fields
}

func (*ServiceManagerImpl) Connect

func (m *ServiceManagerImpl) Connect(podNetwork *types.VirtualNetwork, project, serviceName string) error

Attach the network to the service policy. The policy can be created either by the first referer or when the service is created.

func (*ServiceManagerImpl) ConnectNetworks

func (m *ServiceManagerImpl) ConnectNetworks(podNetwork, serviceNetwork *types.VirtualNetwork) error

func (*ServiceManagerImpl) Create

func (m *ServiceManagerImpl) Create(service *api.Service) error

func (*ServiceManagerImpl) Delete

func (m *ServiceManagerImpl) Delete(service *api.Service) error

func (*ServiceManagerImpl) DeleteConnections

func (m *ServiceManagerImpl) DeleteConnections(network *types.VirtualNetwork, purgeList []string) error

func (*ServiceManagerImpl) Disconnect

func (m *ServiceManagerImpl) Disconnect(podNetwork *types.VirtualNetwork, project, serviceName string) error

func (*ServiceManagerImpl) GetServiceName

func (m *ServiceManagerImpl) GetServiceName(service *api.Service) string

func (*ServiceManagerImpl) GetServiceNetwork

func (m *ServiceManagerImpl) GetServiceNetwork(service *api.Service) *types.VirtualNetwork

func (*ServiceManagerImpl) IsEmpty

func (m *ServiceManagerImpl) IsEmpty(service *api.Service) (bool, []string)

type VirtualRouterManager

type VirtualRouterManager struct {
	// contains filtered or unexported fields
}

func NewVirtualRouterManager

func NewVirtualRouterManager(client contrail.ApiClient, config *Config) (*VirtualRouterManager, error)

Setup

Directories

Path Synopsis
cni
Common CNI plugin for Kubernetes and Mesos.
Common CNI plugin for Kubernetes and Mesos.
args
Common code to parse agruments for both Kubernetes and Mesos.
Common code to parse agruments for both Kubernetes and Mesos.

Jump to

Keyboard shortcuts

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