// New creates a new controller.
New creates a new controller.
// New creates a new controller .
func New(conf Config) (*Operator, error) {
	cfg, err := k8sutil.NewClusterConfig(conf.Host, conf.TLSInsecure, &conf.TLSConfig)
	if err != nil {
		return nil, err
	}
	client, err := kubernetes.NewForConfig(cfg)
	if err != nil {
		return nil, err
	}
	mclient, err := v1alpha1.NewForConfig(cfg)
	if err != nil {
		return nil, err
	}
	c := &Operator{
		kclient: client,
		mclient: mclient,
		host:    cfg.Host,
		config:  conf,
		queue:   workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "persistence"),
	}
	c.persistenceActionInf = cache.NewSharedIndexInformer(
		&cache.ListWatch{
			ListFunc:  mclient.PersistenceActions(api.NamespaceAll).List,
			WatchFunc: mclient.PersistenceActions(api.NamespaceAll).Watch,
		},
		&v1alpha1.PersistenceAction{}, resyncPeriod, cache.Indexers{},
	)
	c.persistenceActionInf.AddEventHandler(cache.ResourceEventHandlerFuncs{
		AddFunc:    c.handlePersistenceActionAdd,
		DeleteFunc: c.handlePersistenceActionDelete,
		UpdateFunc: c.handlePersistenceActionUpdate,
	})
	return c, nil
}
func New ( conf Config ) ( * Operator , error ) { cfg , err := k8sutil . NewClusterConfig ( conf . Host , conf . TLSInsecure , & conf . TLSConfig ) if err != nil { return nil , err } client , err := kubernetes . NewForConfig ( cfg ) if err != nil { return nil , err } mclient , err := v1alpha1 . NewForConfig ( cfg ) if err != nil { return nil , err } c := & Operator { kclient : client , mclient : mclient , host : cfg . Host , config : conf , queue : workqueue . NewNamedRateLimitingQueue ( workqueue . DefaultControllerRateLimiter ( ) , " " ) , } c . persistenceActionInf = cache . NewSharedIndexInformer ( & cache . ListWatch { ListFunc : mclient . PersistenceActions ( api . NamespaceAll ) . List , WatchFunc : mclient . PersistenceActions ( api . NamespaceAll ) . Watch , } , & v1alpha1 . PersistenceAction { } , resyncPeriod , cache . Indexers { } , ) c . persistenceActionInf . AddEventHandler ( cache . ResourceEventHandlerFuncs { AddFunc : c . handlePersistenceActionAdd , DeleteFunc : c . handlePersistenceActionDelete , UpdateFunc : c . handlePersistenceActionUpdate , } ) return c , nil }
New creates a new controller.
New creates a new controller .