memory

package
v1.0.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceController

type ServiceController struct {
	sync.RWMutex
	// 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(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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL