This section is empty.


This section is empty.


This section is empty.


type ServiceController

type ServiceController struct {
	// contains filtered or unexported fields

    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(f 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 {
            	WantGetProxyServiceInstances  []*model.ServiceInstance
            	ServicesError                 error
            	GetServiceError               error
            	InstancesError                error
            	GetProxyServiceInstancesError error
            	Controller                    model.Controller
            	ClusterID                     string
            	// 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) 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(name host.Name, 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, ports []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.Collection

                            func (*ServiceDiscovery) GetService

                            func (sd *ServiceDiscovery) GetService(hostname host.Name) (*model.Service, error)

                              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.Collection) []*model.ServiceInstance

                                InstancesByPort filters the service instances by labels. This assumes single port, as is used by EDS/ADS.

                                func (*ServiceDiscovery) NetworkGateways

                                func (sd *ServiceDiscovery) NetworkGateways() map[string][]*model.Gateway

                                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, error)

                                    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.

                                      func (*ServiceDiscovery) SetGatewaysForNetwork

                                      func (sd *ServiceDiscovery) SetGatewaysForNetwork(nw string, gws ...*model.Gateway)

                                      Source Files