func NewIstioGatewaySource(
	kubeClient kubernetes.Interface,
	istioClient istiomodel.ConfigStore,
	istioIngressGatewayServices []string,
	namespace string,
	annotationFilter string,
	fqdnTemplate string,
	combineFqdnAnnotation bool,
	ignoreHostnameAnnotation bool,
) (Source, error) {
	var (
		tmpl *template.Template
		err  error
	)
	for _, lbService := range istioIngressGatewayServices {
		if _, _, err = parseIngressGateway(lbService); err != nil {
			return nil, err
		}
	}

	if fqdnTemplate != "" {
		tmpl, err = template.New("endpoint").Funcs(template.FuncMap{
			"trimPrefix": strings.TrimPrefix,
		}).Parse(fqdnTemplate)
		if err != nil {
			return nil, err
		}
	}

	return &gatewaySource{
		kubeClient:                  kubeClient,
		istioClient:                 istioClient,
		istioIngressGatewayServices: istioIngressGatewayServices,
		namespace:                   namespace,
		annotationFilter:            annotationFilter,
		fqdnTemplate:                tmpl,
		combineFQDNAnnotation:       combineFqdnAnnotation,
		ignoreHostnameAnnotation:    ignoreHostnameAnnotation,
	}, nil
}
func NewIstioGatewaySource(
	kubeClient kubernetes.Interface,
	istioClient istiomodel.ConfigStore,
	istioIngressGatewayServices []string,
	namespace string,
	annotationFilter string,
	fqdnTemplate string,
	combineFqdnAnnotation bool,
	ignoreHostnameAnnotation bool,
) (Source, error) {
	var (
		tmpl *template.Template
		err  error
	)
	for _, lbService := range istioIngressGatewayServices {
		if _, _, err = parseIngressGateway(lbService); err != nil {
			return nil, err
		}
	}

	if fqdnTemplate != "" {
		tmpl, err = template.New("endpoint").Funcs(template.FuncMap{
			"trimPrefix": strings.TrimPrefix,
		}).Parse(fqdnTemplate)
		if err != nil {
			return nil, err
		}
	}

	return &gatewaySource{
		kubeClient:                  kubeClient,
		istioClient:                 istioClient,
		istioIngressGatewayServices: istioIngressGatewayServices,
		namespace:                   namespace,
		annotationFilter:            annotationFilter,
		fqdnTemplate:                tmpl,
		combineFQDNAnnotation:       combineFqdnAnnotation,
		ignoreHostnameAnnotation:    ignoreHostnameAnnotation,
	}, nil
}
func NewIstioGatewaySource ( kubeClient kubernetes . Interface , istioClient istiomodel . ConfigStore , istioIngressGatewayServices [ ] string , namespace string , annotationFilter string , fqdnTemplate string , combineFqdnAnnotation bool , ignoreHostnameAnnotation bool , ) ( Source , error ) { var ( tmpl * template . Template err error ) for _ , lbService := range istioIngressGatewayServices { if _ , _ , err = parseIngressGateway ( lbService ) ; err != nil { return nil , err } } if fqdnTemplate != " " { tmpl , err = template . New ( " " ) . Funcs ( template . FuncMap { " " : strings . TrimPrefix , } ) . Parse ( fqdnTemplate ) if err != nil { return nil , err } } return & gatewaySource { kubeClient : kubeClient , istioClient : istioClient , istioIngressGatewayServices : istioIngressGatewayServices , namespace : namespace , annotationFilter : annotationFilter , fqdnTemplate : tmpl , combineFQDNAnnotation : combineFqdnAnnotation , ignoreHostnameAnnotation : ignoreHostnameAnnotation , } , nil }
// NewIstioGatewaySource creates a new gatewaySource with the given config.
NewIstioGatewaySource creates a new gatewaySource with the given config .