Documentation ¶
Index ¶
- type ServiceController
- type ServiceDiscovery
- func (sd *ServiceDiscovery) AddEndpoint(service host.Name, servicePortName string, servicePort int, address string, ...) *model.ServiceInstance
- func (sd *ServiceDiscovery) AddGateways(gws ...model.NetworkGateway)
- func (sd *ServiceDiscovery) AddHTTPService(name, vip string, port int)
- func (sd *ServiceDiscovery) AddInstance(service host.Name, instance *model.ServiceInstance)
- func (sd *ServiceDiscovery) AddService(svc *model.Service)
- func (sd *ServiceDiscovery) AddWorkload(ip string, labels labels.Instance)
- func (sd *ServiceDiscovery) GetIstioServiceAccounts(svc *model.Service, _ []int) []string
- func (sd *ServiceDiscovery) GetProxyServiceInstances(node *model.Proxy) []*model.ServiceInstance
- func (sd *ServiceDiscovery) GetProxyWorkloadLabels(proxy *model.Proxy) labels.Instance
- func (sd *ServiceDiscovery) GetService(hostname host.Name) *model.Service
- func (sd *ServiceDiscovery) InstancesByPort(svc *model.Service, port int, labels labels.Instance) []*model.ServiceInstance
- func (sd *ServiceDiscovery) MCSServices() []model.MCSServiceInfo
- func (sd *ServiceDiscovery) NetworkGateways() []model.NetworkGateway
- func (sd *ServiceDiscovery) RemoveService(name host.Name)
- func (sd *ServiceDiscovery) Services() []*model.Service
- func (sd *ServiceDiscovery) SetEndpoints(service string, namespace string, endpoints []*model.IstioEndpoint)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceController ¶
ServiceController is a mock service controller
func (*ServiceController) AppendServiceHandler ¶
func (c *ServiceController) AppendServiceHandler(f func(*model.Service, model.Event))
AppendServiceHandler appends a service handler to the controller
func (*ServiceController) AppendWorkloadHandler ¶
func (c *ServiceController) AppendWorkloadHandler(func(*model.WorkloadInstance, model.Event))
Memory does not support workload handlers; everything is done in terms of instances
func (*ServiceController) HasSynced ¶
func (c *ServiceController) HasSynced() bool
HasSynced always returns true
func (*ServiceController) Run ¶
func (c *ServiceController) Run(<-chan struct{})
Run will run the controller
type ServiceDiscovery ¶
type ServiceDiscovery struct { model.NetworkGatewaysHandler WantGetProxyServiceInstances []*model.ServiceInstance InstancesError error Controller model.Controller ClusterID cluster.ID // XDSUpdater will push EDS changes to the ADS model. EDSUpdater model.XDSUpdater // contains filtered or unexported fields }
ServiceDiscovery is a mock discovery interface
func NewServiceDiscovery ¶
func NewServiceDiscovery(services ...*model.Service) *ServiceDiscovery
NewServiceDiscovery builds an in-memory ServiceDiscovery
func (*ServiceDiscovery) AddEndpoint ¶
func (sd *ServiceDiscovery) AddEndpoint(service host.Name, servicePortName string, servicePort int, address string, port int) *model.ServiceInstance
AddEndpoint adds an endpoint to a service.
func (*ServiceDiscovery) AddGateways ¶
func (sd *ServiceDiscovery) AddGateways(gws ...model.NetworkGateway)
func (*ServiceDiscovery) AddHTTPService ¶
func (sd *ServiceDiscovery) AddHTTPService(name, vip string, port int)
AddHTTPService is a helper to add a service of type http, named 'http-main', with the specified vip and port.
func (*ServiceDiscovery) AddInstance ¶
func (sd *ServiceDiscovery) AddInstance(service host.Name, instance *model.ServiceInstance)
AddInstance adds an in-memory instance.
func (*ServiceDiscovery) AddService ¶
func (sd *ServiceDiscovery) AddService(svc *model.Service)
AddService adds an in-memory service.
func (*ServiceDiscovery) AddWorkload ¶
func (sd *ServiceDiscovery) AddWorkload(ip string, labels labels.Instance)
func (*ServiceDiscovery) GetIstioServiceAccounts ¶
func (sd *ServiceDiscovery) GetIstioServiceAccounts(svc *model.Service, _ []int) []string
GetIstioServiceAccounts gets the Istio service accounts for a service hostname.
func (*ServiceDiscovery) GetProxyServiceInstances ¶
func (sd *ServiceDiscovery) GetProxyServiceInstances(node *model.Proxy) []*model.ServiceInstance
GetProxyServiceInstances returns service instances associated with a node, resulting in 'in' services.
func (*ServiceDiscovery) GetProxyWorkloadLabels ¶
func (sd *ServiceDiscovery) GetProxyWorkloadLabels(proxy *model.Proxy) labels.Instance
func (*ServiceDiscovery) GetService ¶
func (sd *ServiceDiscovery) GetService(hostname host.Name) *model.Service
GetService implements discovery interface Each call to GetService() should return a new *model.Service
func (*ServiceDiscovery) InstancesByPort ¶
func (sd *ServiceDiscovery) InstancesByPort(svc *model.Service, port int, labels labels.Instance) []*model.ServiceInstance
InstancesByPort filters the service instances by labels. This assumes single port, as is used by EDS/ADS.
func (*ServiceDiscovery) MCSServices ¶
func (sd *ServiceDiscovery) MCSServices() []model.MCSServiceInfo
func (*ServiceDiscovery) NetworkGateways ¶
func (sd *ServiceDiscovery) NetworkGateways() []model.NetworkGateway
func (*ServiceDiscovery) RemoveService ¶
func (sd *ServiceDiscovery) RemoveService(name host.Name)
RemoveService removes an in-memory service.
func (*ServiceDiscovery) Services ¶
func (sd *ServiceDiscovery) Services() []*model.Service
Services implements discovery interface Each call to Services() should return a list of new *model.Service
func (*ServiceDiscovery) SetEndpoints ¶
func (sd *ServiceDiscovery) SetEndpoints(service string, namespace string, endpoints []*model.IstioEndpoint)
SetEndpoints update the list of endpoints for a service, similar with K8S controller.