Documentation ¶
Index ¶
Constants ¶
const ( // ScopeOwner is the owner scope ScopeOwner = "owner" // ScopeCluster is the cluster scope ScopeCluster = "cluster" // ScopeService is the service scope ScopeService = "service" // ScopePort is the port scope ScopePort = "port" // ScopeIPPoolID is the IP pool id scope ScopeIPPoolID = "ippoolid" // ScopeLBClass is the load balancer class scope ScopeLBClass = "lbclass" )
const (
// LoadBalancerClassAnnotation is the optional class annotation at the service
LoadBalancerClassAnnotation = "loadbalancer.vmware.io/class"
)
Variables ¶
var ( // AppName is set by the main program to the name of the application AppName string // Version is set by the main program to the version of the application Version string )
var ClusterName string
ClusterName contains the cluster-name flag injected from main, needed for cleanup
Functions ¶
This section is empty.
Types ¶
type LBClass ¶
type LBClass interface { // Tags retrieves tags of an object Tags() []model.Tag // AppProfile retrieves application profile either by path (stored in Reference.Identifier) or by name AppProfile(protocol corev1.Protocol) (Reference, error) }
LBClass is an interface to retrieve settings of load balancer class.
type LBProvider ¶
type LBProvider interface { cloudprovider.LoadBalancer Initialize(clusterName string, client clientset.Interface, stop <-chan struct{}) CleanupServices(clusterName string, services map[types.NamespacedName]corev1.Service) error }
LBProvider is the interface used call the load balancer functionality It extends the cloud controller manager LoadBalancer interface by an initialization function
func NewLBProvider ¶
NewLBProvider creates a new LBProvider
type Mapping ¶
type Mapping struct { // SourcePort is the service source port SourcePort int // NodePort is the service node port NodePort int // Protoocl is the protocol on the service port Protocol corev1.Protocol }
Mapping defines the port mapping and protocol
func NewMapping ¶
func NewMapping(servicePort corev1.ServicePort) Mapping
NewMapping creates a new Mapping for the given service port
func (Mapping) MatchNodePort ¶
func (m Mapping) MatchNodePort(server *model.LBVirtualServer) bool
MatchNodePort returns true if the server pool member port is equal to the mapping's node port
func (Mapping) MatchTCPMonitor ¶
func (m Mapping) MatchTCPMonitor(monitor *model.LBTcpMonitorProfile) bool
MatchTCPMonitor returns true if the monitor has the correct port tag
func (Mapping) MatchVirtualServer ¶
func (m Mapping) MatchVirtualServer(server *model.LBVirtualServer) bool
MatchVirtualServer returns true if source port is matching
type NSXTAccess ¶
type NSXTAccess interface { // CreateLoadBalancerService creates a LbService CreateLoadBalancerService(clusterName string) (*model.LBService, error) // FindLoadBalancerService finds a LbService by cluster name and LB service id FindLoadBalancerService(clusterName string, lbServiceID string) (lbService *model.LBService, err error) // UpdateLoadBalancerService updates a LbService UpdateLoadBalancerService(lbService *model.LBService) error // DeleteLoadBalancerService deletes a LbService by id DeleteLoadBalancerService(id string) error // CreateVirtualServer creates a virtual server CreateVirtualServer(clusterName string, objectName types.NamespacedName, class LBClass, ipAddress string, mapping Mapping, lbServicePath, applicationProfilePath string, poolPath *string) (*model.LBVirtualServer, error) // FindVirtualServers finds a virtual server by cluster and object name FindVirtualServers(clusterName string, objectName types.NamespacedName) ([]*model.LBVirtualServer, error) // ListVirtualServers finds all virtual servers for a cluster ListVirtualServers(clusterName string) ([]*model.LBVirtualServer, error) // UpdateVirtualServer updates a virtual server UpdateVirtualServer(server *model.LBVirtualServer) error // DeleteVirtualServer deletes a virtual server by id DeleteVirtualServer(id string) error // CreatePool creates a LbPool CreatePool(clusterName string, objectName types.NamespacedName, mapping Mapping, members []model.LBPoolMember, activeMonitorPaths []string) (*model.LBPool, error) // GetPool gets a LbPool by id GetPool(id string) (*model.LBPool, error) // FindPool finds a LbPool for a mapping FindPool(clusterName string, objectName types.NamespacedName, mapping Mapping) (*model.LBPool, error) // FindPools finds a LbPool by cluster and object name FindPools(clusterName string, objectName types.NamespacedName) ([]*model.LBPool, error) // ListPools lists all LbPool for a cluster ListPools(clusterName string) ([]*model.LBPool, error) // UpdatePool updates a LbPool UpdatePool(*model.LBPool) error // DeletePool deletes a LbPool by id DeletePool(id string) error // FindIPPoolByName finds an IP pool by name FindIPPoolByName(poolName string) (string, error) // GetAppProfilePath gets the application profile for given loadbalancer class and protocol GetAppProfilePath(class LBClass, protocol corev1.Protocol) (string, error) // AllocateExternalIPAddress allocates an IP address from the given IP pool AllocateExternalIPAddress(ipPoolID string, clusterName string, objectName types.NamespacedName) (allocation *model.IpAddressAllocation, ipAddress *string, err error) // ListExternalIPAddresses finds all IP addresses belonging to a clusterName from the given IP pool ListExternalIPAddresses(ipPoolID string, clusterName string) ([]*model.IpAddressAllocation, error) // FindExternalIPAddressForObject finds an IP address belonging to an object FindExternalIPAddressForObject(ipPoolID string, clusterName string, objectName types.NamespacedName) (allocation *model.IpAddressAllocation, ipAddress *string, err error) // ReleaseExternalIPAddress releases an allocated IP address ReleaseExternalIPAddress(ipPoolID string, id string) error // CreateTCPMonitorProfile creates a LBTcpMonitorProfile CreateTCPMonitorProfile(clusterName string, objectName types.NamespacedName, mapping Mapping) (*model.LBTcpMonitorProfile, error) // FindTCPMonitors finds a LBTcpMonitorProfile by cluster and object name FindTCPMonitorProfiles(clusterName string, objectName types.NamespacedName) ([]*model.LBTcpMonitorProfile, error) // ListTCPMonitorProfile lists LBTcpMonitorProfile by cluster ListTCPMonitorProfiles(clusterName string) ([]*model.LBTcpMonitorProfile, error) // UpdateTCPMonitorProfile updates a LBTcpMonitorProfile UpdateTCPMonitorProfile(monitor *model.LBTcpMonitorProfile) error // DeleteTCPMonitorProfile deletes a LBTcpMonitorProfile by id DeleteTCPMonitorProfile(id string) error }
NSXTAccess provides methods for dealing with NSX-T objects
func NewNSXTAccess ¶
func NewNSXTAccess(broker NsxtBroker, config *config.LBConfig) (NSXTAccess, error)
NewNSXTAccess creates a new NSXTAccess instance
type NsxtBroker ¶
type NsxtBroker interface { ReadLoadBalancerService(id string) (model.LBService, error) CreateLoadBalancerService(service model.LBService) (model.LBService, error) ListLoadBalancerServices() ([]model.LBService, error) UpdateLoadBalancerService(service model.LBService) (model.LBService, error) DeleteLoadBalancerService(id string) error CreateLoadBalancerVirtualServer(server model.LBVirtualServer) (model.LBVirtualServer, error) ListLoadBalancerVirtualServers() ([]model.LBVirtualServer, error) UpdateLoadBalancerVirtualServer(server model.LBVirtualServer) (model.LBVirtualServer, error) DeleteLoadBalancerVirtualServer(id string) error CreateLoadBalancerPool(pool model.LBPool) (model.LBPool, error) ReadLoadBalancerPool(id string) (model.LBPool, error) ListLoadBalancerPools() ([]model.LBPool, error) UpdateLoadBalancerPool(pool model.LBPool) (model.LBPool, error) DeleteLoadBalancerPool(id string) error ListIPPools() ([]model.IpAddressPool, error) AllocateFromIPPool(ipPoolID string, allocation model.IpAddressAllocation) (model.IpAddressAllocation, string, error) ListIPPoolAllocations(ipPoolID string) ([]model.IpAddressAllocation, error) ReleaseFromIPPool(ipPoolID, ipAllocationID string) error GetRealizedExternalIPAddress(ipAllocationPath string, timeout time.Duration) (*string, error) ListAppProfiles() ([]*data.StructValue, error) CreateLoadBalancerTCPMonitorProfile(monitor model.LBTcpMonitorProfile) (model.LBTcpMonitorProfile, error) ListLoadBalancerMonitorProfiles() ([]*data.StructValue, error) ReadLoadBalancerTCPMonitorProfile(id string) (model.LBTcpMonitorProfile, error) UpdateLoadBalancerTCPMonitorProfile(monitor model.LBTcpMonitorProfile) (model.LBTcpMonitorProfile, error) DeleteLoadBalancerMonitorProfile(id string) error }
NsxtBroker is an internal interface to enable mocking the nsxt backend
func NewNsxtBroker ¶
func NewNsxtBroker(connector client.Connector) (NsxtBroker, error)
NewNsxtBroker creates a new NsxtBroker using the configuration
func NewNsxtBrokerFromConnector ¶
func NewNsxtBrokerFromConnector(connector client.Connector) NsxtBroker
NewNsxtBrokerFromConnector creates a new NsxtBroker to the real API