func NewIngressSource(kubeClient kubernetes.Interface, namespace, annotationFilter string, fqdnTemplate string, combineFqdnAnnotation bool, ignoreHostnameAnnotation bool) (Source, error) {
	var (
		tmpl *template.Template
		err  error
	)
	if fqdnTemplate != "" {
		tmpl, err = template.New("endpoint").Funcs(template.FuncMap{
			"trimPrefix": strings.TrimPrefix,
		}).Parse(fqdnTemplate)
		if err != nil {
			return nil, err
		}
	}

	// Use shared informer to listen for add/update/delete of ingresses in the specified namespace.
	// Set resync period to 0, to prevent processing when nothing has changed.
	informerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, 0, kubeinformers.WithNamespace(namespace))
	ingressInformer := informerFactory.Extensions().V1beta1().Ingresses()

	// Add default resource event handlers to properly initialize informer.
	ingressInformer.Informer().AddEventHandler(
		cache.ResourceEventHandlerFuncs{
			AddFunc: func(obj interface{}) {
			},
		},
	)

	// TODO informer is not explicitly stopped since controller is not passing in its channel.
	informerFactory.Start(wait.NeverStop)

	// wait for the local cache to be populated.
	err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
		return ingressInformer.Informer().HasSynced() == true, nil
	})
	if err != nil {
		return nil, fmt.Errorf("failed to sync cache: %v", err)
	}

	sc := &ingressSource{
		client:                   kubeClient,
		namespace:                namespace,
		annotationFilter:         annotationFilter,
		fqdnTemplate:             tmpl,
		combineFQDNAnnotation:    combineFqdnAnnotation,
		ignoreHostnameAnnotation: ignoreHostnameAnnotation,
		ingressInformer:          ingressInformer,
	}
	return sc, nil
}
func NewIngressSource(kubeClient kubernetes.Interface, namespace, annotationFilter string, fqdnTemplate string, combineFqdnAnnotation bool, ignoreHostnameAnnotation bool) (Source, error) {
	var (
		tmpl *template.Template
		err  error
	)
	if fqdnTemplate != "" {
		tmpl, err = template.New("endpoint").Funcs(template.FuncMap{
			"trimPrefix": strings.TrimPrefix,
		}).Parse(fqdnTemplate)
		if err != nil {
			return nil, err
		}
	}

	
	
	informerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, 0, kubeinformers.WithNamespace(namespace))
	ingressInformer := informerFactory.Extensions().V1beta1().Ingresses()

	
	ingressInformer.Informer().AddEventHandler(
		cache.ResourceEventHandlerFuncs{
			AddFunc: func(obj interface{}) {
			},
		},
	)

	
	informerFactory.Start(wait.NeverStop)

	
	err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
		return ingressInformer.Informer().HasSynced() == true, nil
	})
	if err != nil {
		return nil, fmt.Errorf("failed to sync cache: %v", err)
	}

	sc := &ingressSource{
		client:                   kubeClient,
		namespace:                namespace,
		annotationFilter:         annotationFilter,
		fqdnTemplate:             tmpl,
		combineFQDNAnnotation:    combineFqdnAnnotation,
		ignoreHostnameAnnotation: ignoreHostnameAnnotation,
		ingressInformer:          ingressInformer,
	}
	return sc, nil
}
func NewIngressSource ( kubeClient kubernetes . Interface , namespace , annotationFilter string , fqdnTemplate string , combineFqdnAnnotation bool , ignoreHostnameAnnotation bool ) ( Source , error ) { var ( tmpl * template . Template err error ) if fqdnTemplate != " " { tmpl , err = template . New ( " " ) . Funcs ( template . FuncMap { " " : strings . TrimPrefix , } ) . Parse ( fqdnTemplate ) if err != nil { return nil , err } } // Use shared informer to listen for add/update/delete of ingresses in the specified namespace. // Set resync period to 0, to prevent processing when nothing has changed. informerFactory := kubeinformers . NewSharedInformerFactoryWithOptions ( kubeClient , 0 , kubeinformers . WithNamespace ( namespace ) ) ingressInformer := informerFactory . Extensions ( ) . V1beta1 ( ) . Ingresses ( ) // Add default resource event handlers to properly initialize informer. ingressInformer . Informer ( ) . AddEventHandler ( cache . ResourceEventHandlerFuncs { AddFunc : func ( obj interface { } ) { } , } , ) // TODO informer is not explicitly stopped since controller is not passing in its channel. informerFactory . Start ( wait . NeverStop ) // wait for the local cache to be populated. err = wait . Poll ( time . Second , 60 * time . Second , func ( ) ( bool , error ) { return ingressInformer . Informer ( ) . HasSynced ( ) == true , nil } ) if err != nil { return nil , fmt . Errorf ( " " , err ) } sc := & ingressSource { client : kubeClient , namespace : namespace , annotationFilter : annotationFilter , fqdnTemplate : tmpl , combineFQDNAnnotation : combineFqdnAnnotation , ignoreHostnameAnnotation : ignoreHostnameAnnotation , ingressInformer : ingressInformer , } return sc , nil }
// NewIngressSource creates a new ingressSource with the given config.
NewIngressSource creates a new ingressSource with the given config .