Documentation ¶
Index ¶
- Variables
- func MakeExternalHTTPSService(hostname model.Hostname, isMeshExternal bool, address string) *model.Service
- func MakeExternalHTTPService(hostname model.Hostname, isMeshExternal bool, address string) *model.Service
- func MakeIP(service *model.Service, version int) string
- func MakeInstance(service *model.Service, port *model.Port, version int, az string) *model.ServiceInstance
- func MakeService(hostname model.Hostname, address string) *model.Service
- type ServiceDiscovery
- func (sd *ServiceDiscovery) AddService(name model.Hostname, svc *model.Service)
- func (sd *ServiceDiscovery) ClearErrors()
- func (sd *ServiceDiscovery) GetIstioServiceAccounts(hostname model.Hostname, ports []int) []string
- func (sd *ServiceDiscovery) GetProxyServiceInstances(node *model.Proxy) ([]*model.ServiceInstance, error)
- func (sd *ServiceDiscovery) GetProxyWorkloadLabels(proxy *model.Proxy) (model.LabelsCollection, error)
- func (sd *ServiceDiscovery) GetService(hostname model.Hostname) (*model.Service, error)
- func (sd *ServiceDiscovery) InstancesByPort(hostname model.Hostname, num int, labels model.LabelsCollection) ([]*model.ServiceInstance, error)
- func (sd *ServiceDiscovery) ManagementPorts(addr string) model.PortList
- func (sd *ServiceDiscovery) Services() ([]*model.Service, error)
- func (sd *ServiceDiscovery) WorkloadHealthCheckInfo(addr string) model.ProbeList
Constants ¶
This section is empty.
Variables ¶
var ( // HelloService is a mock service with `hello.default.svc.cluster.local` as // a hostname and `10.1.0.0` for ip HelloService = MakeService("hello.default.svc.cluster.local", "10.1.0.0") // WorldService is a mock service with `world.default.svc.cluster.local` as // a hostname and `10.2.0.0` for ip WorldService = MakeService("world.default.svc.cluster.local", "10.2.0.0") // ExtHTTPService is a mock external HTTP service ExtHTTPService = MakeExternalHTTPService("httpbin.default.svc.cluster.local", true, "") // ExtHTTPSService is a mock external HTTPS service ExtHTTPSService = MakeExternalHTTPSService("httpsbin.default.svc.cluster.local", true, "") // HelloInstanceV0 is a mock IP address for v0 of HelloService HelloInstanceV0 = MakeIP(HelloService, 0) // HelloProxyV0 is a mock proxy v0 of HelloService HelloProxyV0 = model.Proxy{ Type: model.SidecarProxy, IPAddresses: []string{HelloInstanceV0}, ID: "v0.default", DNSDomain: "default.svc.cluster.local", } // MockDiscovery is an in-memory ServiceDiscover with mock services MockDiscovery = &ServiceDiscovery{ services: map[model.Hostname]*model.Service{ HelloService.Hostname: HelloService, WorldService.Hostname: WorldService, ExtHTTPService.Hostname: ExtHTTPService, ExtHTTPSService.Hostname: ExtHTTPSService, }, versions: 2, } )
var (
// PortHTTPName is the HTTP port name
PortHTTPName = "http"
)
Functions ¶
func MakeExternalHTTPSService ¶
func MakeExternalHTTPSService(hostname model.Hostname, isMeshExternal bool, address string) *model.Service
MakeExternalHTTPSService creates memory external service
func MakeExternalHTTPService ¶
func MakeExternalHTTPService(hostname model.Hostname, isMeshExternal bool, address string) *model.Service
MakeExternalHTTPService creates memory external service
func MakeInstance ¶
func MakeInstance(service *model.Service, port *model.Port, version int, az string) *model.ServiceInstance
MakeInstance creates a memory instance, version enumerates endpoints
Types ¶
type ServiceDiscovery ¶
type ServiceDiscovery struct { WantGetProxyServiceInstances []*model.ServiceInstance ServicesError error GetServiceError error InstancesError error GetProxyServiceInstancesError error // contains filtered or unexported fields }
ServiceDiscovery is a memory discovery interface
func NewDiscovery ¶
NewDiscovery builds a memory ServiceDiscovery
func (*ServiceDiscovery) AddService ¶
func (sd *ServiceDiscovery) AddService(name model.Hostname, svc *model.Service)
AddService will add to the registry the provided service
func (*ServiceDiscovery) ClearErrors ¶
func (sd *ServiceDiscovery) ClearErrors()
ClearErrors clear errors used for failures during model.ServiceDiscovery interface methods
func (*ServiceDiscovery) GetIstioServiceAccounts ¶
func (sd *ServiceDiscovery) GetIstioServiceAccounts(hostname model.Hostname, 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, error)
GetProxyServiceInstances implements discovery interface
func (*ServiceDiscovery) GetProxyWorkloadLabels ¶
func (sd *ServiceDiscovery) GetProxyWorkloadLabels(proxy *model.Proxy) (model.LabelsCollection, error)
func (*ServiceDiscovery) GetService ¶
GetService implements discovery interface
func (*ServiceDiscovery) InstancesByPort ¶
func (sd *ServiceDiscovery) InstancesByPort(hostname model.Hostname, num int, labels model.LabelsCollection) ([]*model.ServiceInstance, error)
InstancesByPort implements discovery interface
func (*ServiceDiscovery) ManagementPorts ¶
func (sd *ServiceDiscovery) ManagementPorts(addr string) model.PortList
ManagementPorts implements discovery interface
func (*ServiceDiscovery) Services ¶
func (sd *ServiceDiscovery) Services() ([]*model.Service, error)
Services implements discovery interface
func (*ServiceDiscovery) WorkloadHealthCheckInfo ¶
func (sd *ServiceDiscovery) WorkloadHealthCheckInfo(addr string) model.ProbeList
WorkloadHealthCheckInfo implements discovery interface