func New(ctx *controllerpkg.Context) *Controller {
	ctrl := &Controller{Context: ctx}
	ctrl.syncHandler = ctrl.processNextWorkItem
	ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*2, time.Minute*1), "certificates")
	// Create a scheduled work queue that calls the ctrl.queue.Add method for
	// each object in the queue. This is used to schedule re-checks of
	// Certificate resources when they get near to expiry
	ctrl.scheduledWorkQueue = scheduler.NewScheduledWorkQueue(ctrl.queue.AddRateLimited)

	certificateInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Certificates()
	certificateInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue})
	ctrl.certificateLister = certificateInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, certificateInformer.Informer().HasSynced)

	issuerInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Issuers()
	ctrl.issuerLister = issuerInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, issuerInformer.Informer().HasSynced)

	clusterIssuerInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().ClusterIssuers()
	ctrl.clusterIssuerLister = clusterIssuerInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, clusterIssuerInformer.Informer().HasSynced)

	secretsInformer := ctrl.KubeSharedInformerFactory.Core().V1().Secrets()
	secretsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
		DeleteFunc: ctrl.secretDeleted,
	})
	ctrl.secretLister = secretsInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, secretsInformer.Informer().HasSynced)

	// We add pod, service and ingress informers to the list of informers to sync.
	// They are not actually used directly by the Certificates controller,
	// however the ACME HTTP challenge solver *does* require a Pod and Secret
	// lister, and due to the way the instantiation of issuers is performed it
	// is far more performant to perform the sync here.
	// This will be refactored into a dedicated 'challenges' controller in future.
	ingressInformer := ctrl.KubeSharedInformerFactory.Extensions().V1beta1().Ingresses()
	podsInformer := ctrl.KubeSharedInformerFactory.Core().V1().Pods()
	serviceInformer := ctrl.KubeSharedInformerFactory.Core().V1().Services()

	ctrl.syncedFuncs = append(ctrl.syncedFuncs, ingressInformer.Informer().HasSynced)
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, podsInformer.Informer().HasSynced)
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, serviceInformer.Informer().HasSynced)

	return ctrl
}
// New returns a new Certificates controller. It sets up the informer handler
// functions for all the types it watches.
New returns a new Certificates controller. It sets up the informer handler
functions for all the types it watches.
// New returns a new Certificates controller . It sets up the informer handler // functions for all the types it watches .
func New(ctx *controllerpkg.Context) *Controller {
	ctrl := &Controller{Context: ctx}
	ctrl.syncHandler = ctrl.processNextWorkItem
	ctrl.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*2, time.Minute*1), "certificates")
	ctrl.scheduledWorkQueue = scheduler.NewScheduledWorkQueue(ctrl.queue.AddRateLimited)
	certificateInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Certificates()
	certificateInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: ctrl.queue})
	ctrl.certificateLister = certificateInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, certificateInformer.Informer().HasSynced)
	issuerInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().Issuers()
	ctrl.issuerLister = issuerInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, issuerInformer.Informer().HasSynced)
	clusterIssuerInformer := ctrl.SharedInformerFactory.Certmanager().V1alpha1().ClusterIssuers()
	ctrl.clusterIssuerLister = clusterIssuerInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, clusterIssuerInformer.Informer().HasSynced)
	secretsInformer := ctrl.KubeSharedInformerFactory.Core().V1().Secrets()
	secretsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
		DeleteFunc: ctrl.secretDeleted,
	})
	ctrl.secretLister = secretsInformer.Lister()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, secretsInformer.Informer().HasSynced)
	ingressInformer := ctrl.KubeSharedInformerFactory.Extensions().V1beta1().Ingresses()
	podsInformer := ctrl.KubeSharedInformerFactory.Core().V1().Pods()
	serviceInformer := ctrl.KubeSharedInformerFactory.Core().V1().Services()
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, ingressInformer.Informer().HasSynced)
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, podsInformer.Informer().HasSynced)
	ctrl.syncedFuncs = append(ctrl.syncedFuncs, serviceInformer.Informer().HasSynced)
	return ctrl
}
func New ( ctx * controllerpkg . Context ) * Controller { ctrl := & Controller { Context : ctx } ctrl . syncHandler = ctrl . processNextWorkItem ctrl . queue = workqueue . NewNamedRateLimitingQueue ( workqueue . NewItemExponentialFailureRateLimiter ( time . Second * 2 , time . Minute * 1 ) , " " ) ctrl . scheduledWorkQueue = scheduler . NewScheduledWorkQueue ( ctrl . queue . AddRateLimited ) certificateInformer := ctrl . SharedInformerFactory . Certmanager ( ) . V1alpha1 ( ) . Certificates ( ) certificateInformer . Informer ( ) . AddEventHandler ( & controllerpkg . QueuingEventHandler { Queue : ctrl . queue } ) ctrl . certificateLister = certificateInformer . Lister ( ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , certificateInformer . Informer ( ) . HasSynced ) issuerInformer := ctrl . SharedInformerFactory . Certmanager ( ) . V1alpha1 ( ) . Issuers ( ) ctrl . issuerLister = issuerInformer . Lister ( ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , issuerInformer . Informer ( ) . HasSynced ) clusterIssuerInformer := ctrl . SharedInformerFactory . Certmanager ( ) . V1alpha1 ( ) . ClusterIssuers ( ) ctrl . clusterIssuerLister = clusterIssuerInformer . Lister ( ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , clusterIssuerInformer . Informer ( ) . HasSynced ) secretsInformer := ctrl . KubeSharedInformerFactory . Core ( ) . V1 ( ) . Secrets ( ) secretsInformer . Informer ( ) . AddEventHandler ( cache . ResourceEventHandlerFuncs { DeleteFunc : ctrl . secretDeleted , } ) ctrl . secretLister = secretsInformer . Lister ( ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , secretsInformer . Informer ( ) . HasSynced ) ingressInformer := ctrl . KubeSharedInformerFactory . Extensions ( ) . V1beta1 ( ) . Ingresses ( ) podsInformer := ctrl . KubeSharedInformerFactory . Core ( ) . V1 ( ) . Pods ( ) serviceInformer := ctrl . KubeSharedInformerFactory . Core ( ) . V1 ( ) . Services ( ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , ingressInformer . Informer ( ) . HasSynced ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , podsInformer . Informer ( ) . HasSynced ) ctrl . syncedFuncs = append ( ctrl . syncedFuncs , serviceInformer . Informer ( ) . HasSynced ) return ctrl }
New returns a new Certificates controller.
New returns a new Certificates controller .
// Create a scheduled work queue that calls the ctrl.queue.Add method for // each object in the queue. This is used to schedule re-checks of // Certificate resources when they get near to expiry // We add pod, service and ingress informers to the list of informers to sync. // They are not actually used directly by the Certificates controller, // however the ACME HTTP challenge solver *does* require a Pod and Secret // lister, and due to the way the instantiation of issuers is performed it // is far more performant to perform the sync here. // This will be refactored into a dedicated 'challenges' controller in future.