Documentation ¶
Index ¶
- Constants
- Variables
- type Access
- type Mapping
- func (m Mapping) MatchNodePort(server *loadbalancer.LbVirtualServer) bool
- func (m Mapping) MatchPool(pool *loadbalancer.LbPool) bool
- func (m Mapping) MatchTCPMonitor(monitor *loadbalancer.LbTcpMonitor) bool
- func (m Mapping) MatchVirtualServer(server *loadbalancer.LbVirtualServer) bool
- func (m Mapping) String() string
- type NsxtBroker
- type ObjectName
- type TagSource
- type TagsSourceFunc
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 (
// AnnotLoadBalancerClass is the optional class annotation at the service
AnnotLoadBalancerClass = "loadbalancer.vmware.io/class"
)
const (
// ProviderName is the provider name
ProviderName = "vsphere"
)
Variables ¶
var ( // Version contains the build version Version string // AppName contains the app name AppName string )
var ClusterName string
ClusterName contains the cluster name injected from main TODO cluster name needed for reorg and is currently injected from main
var EmptyTagsSource = TagsSourceFunc(func() []common.Tag { return []common.Tag{} })
EmptyTagsSource is an empty tags source
Functions ¶
This section is empty.
Types ¶
type Access ¶
type Access interface { // CreateLoadBalancerService creates a LbService CreateLoadBalancerService(clusterName string) (*loadbalancer.LbService, error) // FindLoadBalancerService finds a LbService by cluster name and LB service id FindLoadBalancerService(clusterName string, lbServiceID string) (lbService *loadbalancer.LbService, err error) // FindLoadBalancerServiceForVirtualServer finds the LbService for a virtual server FindLoadBalancerServiceForVirtualServer(clusterName string, serverID string) (lbService *loadbalancer.LbService, err error) // UpdateLoadBalancerService updates a LbService UpdateLoadBalancerService(lbService *loadbalancer.LbService) error // DeleteLoadBalancerService deletes a LbService by id DeleteLoadBalancerService(id string) error // CreateVirtualServer creates a virtual server CreateVirtualServer(clusterName string, objectName ObjectName, tags TagSource, ipAddress string, mapping Mapping, poolID string) (*loadbalancer.LbVirtualServer, error) // FindVirtualServers finds a virtual server by cluster and object name FindVirtualServers(clusterName string, objectName ObjectName) ([]*loadbalancer.LbVirtualServer, error) // ListVirtualServers finds all virtual servers for a cluster ListVirtualServers(clusterName string) ([]*loadbalancer.LbVirtualServer, error) // UpdateVirtualServer updates a virtual server UpdateVirtualServer(server *loadbalancer.LbVirtualServer) error // DeleteVirtualServer deletes a virtual server by id DeleteVirtualServer(id string) error // CreatePool creates a LbPool CreatePool(clusterName string, objectName ObjectName, mapping Mapping, members []loadbalancer.PoolMember, activeMonitorIDs []string) (*loadbalancer.LbPool, error) // GetPool gets a LbPool by id GetPool(id string) (*loadbalancer.LbPool, error) // FindPool finds a LbPool for a mapping FindPool(clusterName string, objectName ObjectName, mapping Mapping) (*loadbalancer.LbPool, error) // FindPools finds a LbPool by cluster and object name FindPools(clusterName string, objectName ObjectName) ([]*loadbalancer.LbPool, error) // ListPools lists all LbPool for a cluster ListPools(clusterName string) ([]*loadbalancer.LbPool, error) // UpdatePool updates a LbPool UpdatePool(*loadbalancer.LbPool) error // DeletePool deletes a LbPool by id DeletePool(id string) error // FindIPPoolByName finds an IP pool by name FindIPPoolByName(poolName string) (string, error) // AllocateExternalIPAddress allocates an IP address from the given IP pool AllocateExternalIPAddress(ipPoolID string) (string, error) // IsAllocatedExternalIPAddress checks if an IP address is allocated in the given IP pool IsAllocatedExternalIPAddress(ipPoolID string, address string) (bool, error) // ReleaseExternalIPAddress releases an allocated IP address ReleaseExternalIPAddress(ipPoolID string, address string) error // CreateTCPMonitor creates a LbTcpMonitor CreateTCPMonitor(clusterName string, objectName ObjectName, mapping Mapping) (*loadbalancer.LbTcpMonitor, error) // FindTCPMonitors finds a LbTcpMonitor by cluster and object name FindTCPMonitors(clusterName string, objectName ObjectName) ([]*loadbalancer.LbTcpMonitor, error) // ListTCPMonitorLight list LbMonitors ListTCPMonitorLight(clusterName string) ([]*loadbalancer.LbMonitor, error) // UpdateTCPMonitor updates a LbTcpMonitor UpdateTCPMonitor(monitor *loadbalancer.LbTcpMonitor) error // DeleteTCPMonitor deletes a LbTcpMonitor by id DeleteTCPMonitor(id string) error }
Access provides methods for dealing with NSX-T objects
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 *loadbalancer.LbVirtualServer) bool
MatchNodePort returns true if the server pool member port is equal to the mapping's node port
func (Mapping) MatchPool ¶
func (m Mapping) MatchPool(pool *loadbalancer.LbPool) bool
MatchPool returns true if the pool has the correct port tag
func (Mapping) MatchTCPMonitor ¶
func (m Mapping) MatchTCPMonitor(monitor *loadbalancer.LbTcpMonitor) bool
MatchTCPMonitor returns true if the monitor has the correct port tag
func (Mapping) MatchVirtualServer ¶
func (m Mapping) MatchVirtualServer(server *loadbalancer.LbVirtualServer) bool
MatchVirtualServer returns true if source port and protocol are matching
type NsxtBroker ¶
type NsxtBroker interface { ListIPPools() (manager.IpPoolListResult, error) ReadLoadBalancerService(id string) (loadbalancer.LbService, error) CreateLoadBalancerService(service loadbalancer.LbService) (loadbalancer.LbService, error) ListLoadBalancerServices() (loadbalancer.LbServiceListResult, error) UpdateLoadBalancerService(service loadbalancer.LbService) (loadbalancer.LbService, error) DeleteLoadBalancerService(id string) (statusCode int, err error) CreateLoadBalancerVirtualServer(server loadbalancer.LbVirtualServer) (loadbalancer.LbVirtualServer, error) ListLoadBalancerVirtualServers() (loadbalancer.LbVirtualServerListResult, error) UpdateLoadBalancerVirtualServer(server loadbalancer.LbVirtualServer) (loadbalancer.LbVirtualServer, error) DeleteLoadBalancerVirtualServer(id string) (statusCode int, err error) CreateLoadBalancerPool(pool loadbalancer.LbPool) (loadbalancer.LbPool, error) ReadLoadBalancerPool(id string) (loadbalancer.LbPool, error) ListLoadBalancerPools() (loadbalancer.LbPoolListResult, error) UpdateLoadBalancerPool(pool loadbalancer.LbPool) (loadbalancer.LbPool, error) DeleteLoadBalancerPool(id string) (statusCode int, err error) AllocateFromIPPool(ipPoolID string) (ipAddress string, statusCode int, err error) ListIPPoolAllocations(ipPoolID string) (ipAddresses []string, statusCode int, err error) ReleaseFromIPPool(ipPoolID, ipAddress string) (statusCode int, err error) CreateLoadBalancerTCPMonitor(monitor loadbalancer.LbTcpMonitor) (loadbalancer.LbTcpMonitor, error) ListLoadBalancerMonitors() (loadbalancer.LbMonitorListResult, error) ReadLoadBalancerTCPMonitor(id string) (loadbalancer.LbTcpMonitor, error) UpdateLoadBalancerTCPMonitor(monitor loadbalancer.LbTcpMonitor) (loadbalancer.LbTcpMonitor, error) DeleteLoadBalancerMonitor(id string) (int, error) }
NsxtBroker is an internal interface to enable mocking the nsxt backend
func NewInMemoryNsxtBroker ¶
func NewInMemoryNsxtBroker(ipPoolNames ...string) NsxtBroker
NewInMemoryNsxtBroker creates a new mock in-menory NsxtBroker
func NewNsxtBroker ¶
func NewNsxtBroker(client *nsxt.APIClient) NsxtBroker
NewNsxtBroker creates a new NsxtBroker to the real API
type ObjectName ¶
type ObjectName struct { // Namespace is the namespace Namespace string // Name is the name Name string }
ObjectName is a namespace/name pair
func (ObjectName) String ¶
func (o ObjectName) String() string
type TagsSourceFunc ¶
TagsSourceFunc is a function type to retrieve tags
func (TagsSourceFunc) Tags ¶
func (n TagsSourceFunc) Tags() []common.Tag
Tags implements the TagSource interface