Documentation ¶
Index ¶
- type ServiceMediator
- func (serviceMediator *ServiceMediator) GetAvailableSubnet(subnetSet *v1alpha1.SubnetSet) (string, error)
- func (serviceMediator *ServiceMediator) GetNodeByName(nodeName string) (*model.HostTransportNode, error)
- func (serviceMediator *ServiceMediator) GetPortsOfSubnet(nsxSubnetID string) (ports []model.VpcSubnetPort)
- func (m *ServiceMediator) GetVPCNetworkConfigByNamespace(ns string) *vpc.VPCNetworkConfigInfo
- func (serviceMediator *ServiceMediator) ListVPCInfo(ns string) []common.VPCResourceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceMediator ¶
type ServiceMediator struct { *vpc.VPCService *subnet.SubnetService *subnetport.SubnetPortService *node.NodeService }
ServiceMediator We use mediator pattern to wrap all the services, embed all the services in ServiceMediator, so that we can mediate all the methods of all the services transparently to the caller, for example, in other packages, we can use ServiceMediator.GetVPCsByNamespace directly. In startCRDController function, we register the CRDService to the ServiceMediator, since only one controller writes to its own store and other controllers read from the store, so we don't need lock here.
func (*ServiceMediator) GetAvailableSubnet ¶
func (serviceMediator *ServiceMediator) GetAvailableSubnet(subnetSet *v1alpha1.SubnetSet) (string, error)
GetAvailableSubnet returns available Subnet under SubnetSet, and creates Subnet if necessary.
func (*ServiceMediator) GetNodeByName ¶
func (serviceMediator *ServiceMediator) GetNodeByName(nodeName string) (*model.HostTransportNode, error)
func (*ServiceMediator) GetPortsOfSubnet ¶
func (serviceMediator *ServiceMediator) GetPortsOfSubnet(nsxSubnetID string) (ports []model.VpcSubnetPort)
func (*ServiceMediator) GetVPCNetworkConfigByNamespace ¶
func (m *ServiceMediator) GetVPCNetworkConfigByNamespace(ns string) *vpc.VPCNetworkConfigInfo
This method is used for subnet service since vpc network config contains default subnet size and default subnet access mode.
func (*ServiceMediator) ListVPCInfo ¶
func (serviceMediator *ServiceMediator) ListVPCInfo(ns string) []common.VPCResourceInfo
ListVPCInfo is a common method, extracting the org, the project, and the vpc string from vpc path of the VPC model. VPC path looks like "/orgs/default/projects/project-1/vpcs/vpc-1", Since other modules only know namespace, this is the only entry point to get org and project. Currently, we only support one vpc per namespace, but we may support multiple vpcs per namespace in the future, so we return a slice of VPCInfo.