source/gateway.go
func (sc *gatewaySource) Endpoints() ([]*endpoint.Endpoint, error) {
	configs, err := sc.istioClient.List(istiomodel.Gateway.Type, sc.namespace)
	if err != nil {
		return nil, err
	}

	configs, err = sc.filterByAnnotations(configs)
	if err != nil {
		return nil, err
	}

	endpoints := []*endpoint.Endpoint{}

	for _, config := range configs {
		// Check controller annotation to see if we are responsible.
		controller, ok := config.Annotations[controllerAnnotationKey]
		if ok && controller != controllerAnnotationValue {
			log.Debugf("Skipping gateway %s/%s because controller value does not match, found: %s, required: %s",
				config.Namespace, config.Name, controller, controllerAnnotationValue)
			continue
		}

		gwEndpoints, err := sc.endpointsFromGatewayConfig(config)
		if err != nil {
			return nil, err
		}

		// apply template if host is missing on gateway
		if (sc.combineFQDNAnnotation || len(gwEndpoints) == 0) && sc.fqdnTemplate != nil {
			iEndpoints, err := sc.endpointsFromTemplate(&config)
			if err != nil {
				return nil, err
			}

			if sc.combineFQDNAnnotation {
				gwEndpoints = append(gwEndpoints, iEndpoints...)
			} else {
				gwEndpoints = iEndpoints
			}
		}

		if len(gwEndpoints) == 0 {
			log.Debugf("No endpoints could be generated from gateway %s/%s", config.Namespace, config.Name)
			continue
		}

		log.Debugf("Endpoints generated from gateway: %s/%s: %v", config.Namespace, config.Name, gwEndpoints)
		sc.setResourceLabel(config, gwEndpoints)
		endpoints = append(endpoints, gwEndpoints...)
	}

	for _, ep := range endpoints {
		sort.Sort(ep.Targets)
	}

	return endpoints, nil
}
func (sc *gatewaySource) Endpoints() ([]*endpoint.Endpoint, error) {
	configs, err := sc.istioClient.List(istiomodel.Gateway.Type, sc.namespace)
	if err != nil {
		return nil, err
	}

	configs, err = sc.filterByAnnotations(configs)
	if err != nil {
		return nil, err
	}

	endpoints := []*endpoint.Endpoint{}

	for _, config := range configs {
		// Check controller annotation to see if we are responsible.
		controller, ok := config.Annotations[controllerAnnotationKey]
		if ok && controller != controllerAnnotationValue {
			log.Debugf("Skipping gateway %s/%s because controller value does not match, found: %s, required: %s",
				config.Namespace, config.Name, controller, controllerAnnotationValue)
			continue
		}

		gwEndpoints, err := sc.endpointsFromGatewayConfig(config)
		if err != nil {
			return nil, err
		}

		// apply template if host is missing on gateway
		if (sc.combineFQDNAnnotation || len(gwEndpoints) == 0) && sc.fqdnTemplate != nil {
			iEndpoints, err := sc.endpointsFromTemplate(&config)
			if err != nil {
				return nil, err
			}

			if sc.combineFQDNAnnotation {
				gwEndpoints = append(gwEndpoints, iEndpoints...)
			} else {
				gwEndpoints = iEndpoints
			}
		}

		if len(gwEndpoints) == 0 {
			log.Debugf("No endpoints could be generated from gateway %s/%s", config.Namespace, config.Name)
			continue
		}

		log.Debugf("Endpoints generated from gateway: %s/%s: %v", config.Namespace, config.Name, gwEndpoints)
		sc.setResourceLabel(config, gwEndpoints)
		endpoints = append(endpoints, gwEndpoints...)
	}

	for _, ep := range endpoints {
		sort.Sort(ep.Targets)
	}

	return endpoints, nil
}
func ( sc * gatewaySource ) Endpoints ( ) ( [ ] * endpoint . Endpoint , error ) { configs , err := sc . istioClient . List ( istiomodel . Gateway . Type , sc . namespace ) if err != nil { return nil , err } configs , err = sc . filterByAnnotations ( configs ) if err != nil { return nil , err } endpoints := [ ] * endpoint . Endpoint { } for _ , config := range configs { // Check controller annotation to see if we are responsible. controller , ok := config . Annotations [ controllerAnnotationKey ] if ok && controller != controllerAnnotationValue { log . Debugf ( " " , config . Namespace , config . Name , controller , controllerAnnotationValue ) continue } gwEndpoints , err := sc . endpointsFromGatewayConfig ( config ) if err != nil { return nil , err } // apply template if host is missing on gateway if ( sc . combineFQDNAnnotation || len ( gwEndpoints ) == 0 ) && sc . fqdnTemplate != nil { iEndpoints , err := sc . endpointsFromTemplate ( & config ) if err != nil { return nil , err } if sc . combineFQDNAnnotation { gwEndpoints = append ( gwEndpoints , iEndpoints ... ) } else { gwEndpoints = iEndpoints } } if len ( gwEndpoints ) == 0 { log . Debugf ( " " , config . Namespace , config . Name ) continue } log . Debugf ( " " , config . Namespace , config . Name , gwEndpoints ) sc . setResourceLabel ( config , gwEndpoints ) endpoints = append ( endpoints , gwEndpoints ... ) } for _ , ep := range endpoints { sort . Sort ( ep . Targets ) } return endpoints , nil }
// Endpoints returns endpoint objects for each host-target combination that should be processed.
// Retrieves all gateway resources in the source's namespace(s).
Endpoints returns endpoint objects for each host - target combination that should be processed . Retrieves all gateway resources in the source s namespace ( s ) .