Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func EndpointsForHostname(hostname string, targets endpoint.Targets, ttl endpoin
return endpoints
}

// EndpointTargetsFromServices retrieves endpoint targets from services in a given namespace
// that match the specified selector. It returns external IPs or load balancer addresses.
//
// TODO: add support for service.Spec.Ports (type NodePort) and service.Spec.ClusterIPs (type ClusterIP)
func EndpointTargetsFromServices(svcInformer coreinformers.ServiceInformer, namespace string, selector map[string]string) (endpoint.Targets, error) {
targets := endpoint.Targets{}

Expand Down
10 changes: 5 additions & 5 deletions source/istio_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (sc *gatewaySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, e

log.Debugf("Processing gateway '%s/%s.%s' and hosts %q", gateway.Namespace, gateway.APIVersion, gateway.Name, strings.Join(gwHostnames, ","))

gwEndpoints, err := sc.endpointsFromGateway(ctx, gwHostnames, gateway)
gwEndpoints, err := sc.endpointsFromGateway(gwHostnames, gateway)
if err != nil {
return nil, err
}
Expand All @@ -183,7 +183,7 @@ func (sc *gatewaySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, e
if err != nil {
return nil, err
}
return sc.endpointsFromGateway(ctx, hostnames, gateway)
return sc.endpointsFromGateway(hostnames, gateway)
},
)
if err != nil {
Expand Down Expand Up @@ -240,7 +240,7 @@ func (sc *gatewaySource) targetsFromIngress(ingressStr string, gateway *networki
return targets, nil
}

func (sc *gatewaySource) targetsFromGateway(ctx context.Context, gateway *networkingv1beta1.Gateway) (endpoint.Targets, error) {
func (sc *gatewaySource) targetsFromGateway(gateway *networkingv1beta1.Gateway) (endpoint.Targets, error) {
targets := annotations.TargetsFromTargetAnnotation(gateway.Annotations)
if len(targets) > 0 {
return targets, nil
Expand All @@ -255,11 +255,11 @@ func (sc *gatewaySource) targetsFromGateway(ctx context.Context, gateway *networ
}

// endpointsFromGatewayConfig extracts the endpoints from an Istio Gateway Config object
func (sc *gatewaySource) endpointsFromGateway(ctx context.Context, hostnames []string, gateway *networkingv1beta1.Gateway) ([]*endpoint.Endpoint, error) {
func (sc *gatewaySource) endpointsFromGateway(hostnames []string, gateway *networkingv1beta1.Gateway) ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint
var err error

targets, err := sc.targetsFromGateway(ctx, gateway)
targets, err := sc.targetsFromGateway(gateway)
if err != nil {
return nil, err
}
Expand Down
Loading
Loading