func NewController(
	kubeClient clientset.Interface,
	podInformer coreinformers.PodInformer,
	pvcInformer coreinformers.PersistentVolumeClaimInformer) (Controller, error) {

	ec := &ephemeralController{
		kubeClient: kubeClient,
		podLister:  podInformer.Lister(),
		podIndexer: podInformer.Informer().GetIndexer(),
		podSynced:  podInformer.Informer().HasSynced,
		pvcLister:  pvcInformer.Lister(),
		pvcsSynced: pvcInformer.Informer().HasSynced,
		queue:      workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "ephemeral_volume"),
	}

	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(klog.Infof)
	eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
	ec.recorder = eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "ephemeral_volume"})

	podInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{
		AddFunc: ec.enqueuePod,
		// The pod spec is immutable. Therefore the controller can ignore pod updates
		// because there cannot be any changes that have to be copied into the generated
		// PVC.
		// Deletion of the PVC is handled through the owner reference and garbage collection.
		// Therefore pod deletions also can be ignored.
	})
	pvcInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{
		DeleteFunc: ec.onPVCDelete,
	})
	if err := common.AddPodPVCIndexerIfNotPresent(ec.podIndexer); err != nil {
		return nil, fmt.Errorf("Could not initialize pvc protection controller: %v", err)
	}

	return ec, nil
}
// NewController creates an ephemeral volume controller.
NewController creates an ephemeral volume controller.
// NewController creates an ephemeral volume controller .
func NewController(
	kubeClient clientset.Interface,
	podInformer coreinformers.PodInformer,
	pvcInformer coreinformers.PersistentVolumeClaimInformer) (Controller, error) {
	ec := &ephemeralController{
		kubeClient: kubeClient,
		podLister:  podInformer.Lister(),
		podIndexer: podInformer.Informer().GetIndexer(),
		podSynced:  podInformer.Informer().HasSynced,
		pvcLister:  pvcInformer.Lister(),
		pvcsSynced: pvcInformer.Informer().HasSynced,
		queue:      workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "ephemeral_volume"),
	}
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(klog.Infof)
	eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
	ec.recorder = eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "ephemeral_volume"})
	podInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{
		AddFunc: ec.enqueuePod,
	})
	pvcInformer.Informer().AddEventHandler(kcache.ResourceEventHandlerFuncs{
		DeleteFunc: ec.onPVCDelete,
	})
	if err := common.AddPodPVCIndexerIfNotPresent(ec.podIndexer); err != nil {
		return nil, fmt.Errorf("Could not initialize pvc protection controller: %v", err)
	}
	return ec, nil
}
func NewController ( kubeClient clientset . Interface , podInformer coreinformers . PodInformer , pvcInformer coreinformers . PersistentVolumeClaimInformer ) ( Controller , error ) { ec := & ephemeralController { kubeClient : kubeClient , podLister : podInformer . Lister ( ) , podIndexer : podInformer . Informer ( ) . GetIndexer ( ) , podSynced : podInformer . Informer ( ) . HasSynced , pvcLister : pvcInformer . Lister ( ) , pvcsSynced : pvcInformer . Informer ( ) . HasSynced , queue : workqueue . NewNamedRateLimitingQueue ( workqueue . DefaultControllerRateLimiter ( ) , " " ) , } eventBroadcaster := record . NewBroadcaster ( ) eventBroadcaster . StartLogging ( klog . Infof ) eventBroadcaster . StartRecordingToSink ( & v1core . EventSinkImpl { Interface : kubeClient . CoreV1 ( ) . Events ( " " ) } ) ec . recorder = eventBroadcaster . NewRecorder ( scheme . Scheme , v1 . EventSource { Component : " " } ) podInformer . Informer ( ) . AddEventHandler ( kcache . ResourceEventHandlerFuncs { AddFunc : ec . enqueuePod , } ) pvcInformer . Informer ( ) . AddEventHandler ( kcache . ResourceEventHandlerFuncs { DeleteFunc : ec . onPVCDelete , } ) if err := common . AddPodPVCIndexerIfNotPresent ( ec . podIndexer ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return ec , nil }
NewController creates an ephemeral volume controller.
NewController creates an ephemeral volume controller .
// The pod spec is immutable. Therefore the controller can ignore pod updates // because there cannot be any changes that have to be copied into the generated // PVC. // Deletion of the PVC is handled through the owner reference and garbage collection. // Therefore pod deletions also can be ignored.