MCPcopy
hub / github.com/istio/istio / ServiceDiscovery

Interface ServiceDiscovery

pilot/pkg/model/service.go:951–984  ·  view source on GitHub ↗

ServiceDiscovery enumerates Istio service instances. nolint: lll

Source from the content-addressed store, hash-verified

949// ServiceDiscovery enumerates Istio service instances.
950// nolint: lll
951type ServiceDiscovery interface {
952 NetworkGatewaysWatcher
953
954 // Services list declarations of all services in the system
955 Services() []*Service
956
957 // GetService retrieves a service by host name if it exists
958 GetService(hostname host.Name) *Service
959
960 // GetProxyServiceTargets returns the service targets that co-located with a given Proxy
961 //
962 // Co-located generally means running in the same network namespace and security context.
963 //
964 // A Proxy operating as a Sidecar will return a non-empty slice. A stand-alone Proxy
965 // will return an empty slice.
966 //
967 // There are two reasons why this returns multiple ServiceTargets instead of one:
968 // - A ServiceTargets has a single Port. But a Service
969 // may have many ports. So a workload implementing such a Service would need
970 // multiple ServiceTargets, one for each port.
971 // - A single workload may implement multiple logical Services.
972 //
973 // In the second case, multiple services may be implemented by the same physical port number,
974 // though with a different ServicePort and IstioEndpoint for each. If any of these overlapping
975 // services are not HTTP or H2-based, behavior is undefined, since the listener may not be able to
976 // determine the intended destination of a connection without a Host header on the request.
977 GetProxyServiceTargets(*Proxy) []ServiceTarget
978 GetProxyWorkloadLabels(*Proxy) labels.Instance
979
980 // MCSServices returns information about the services that have been exported/imported via the
981 // Kubernetes Multi-Cluster Services (MCS) ServiceExport API. Only applies to services in
982 // Kubernetes clusters.
983 MCSServices() []MCSServiceInfo
984}
985
986type AmbientIndexes interface {
987 ServicesWithWaypoint(key string) []ServiceWaypointInfo

Callers 81

BuildNameTableFunction · 0.65
cleanupClusterMethod · 0.65
SetWaypointForServiceFunction · 0.65
newKubeFunction · 0.65
NewFunction · 0.65
SingleNamespaceViewMethod · 0.65
otelConfigFunction · 0.65

Implementers 6

localServiceDiscoverypilot/pkg/model/push_context_test.go
Controllerpilot/pkg/serviceregistry/serviceentry
ServiceDiscoverypilot/pkg/serviceregistry/memory/disco
Controllerpilot/pkg/serviceregistry/aggregate/co
Controllerpilot/pkg/serviceregistry/kube/control
localServiceDiscoverypilot/pkg/xds/endpoints/endpoint_build

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…