const resyncPeriod … const poolNameIndex … type Controller … type DriverResources … type Pool … type Owner … // StartController constructs a new controller and starts it. // If the owner is a v1.Node, then the NodeName field in the // ResourceSlice objects is set and used to identify objects // managed by the controller. The UID is not needed in that // case, the controller will determine it automatically. // // If a kubeClient is provided, then it synchronizes ResourceSlices // with the resource information provided by plugins. Without it, // the controller is inactive. This can happen when kubelet is run stand-alone // without an apiserver. In that case we can't and don't need to publish // ResourceSlices. func StartController(ctx context.Context, kubeClient kubernetes.Interface, driver string, owner Owner, resources *DriverResources) (*Controller, error) { … } // Stop cancels all background activity and blocks until the controller has stopped. func (c *Controller) Stop() { … } // Update sets the new desired state of the resource information. // // The controller takes over ownership, so these resources must // not get modified after this method returns. func (c *Controller) Update(resources *DriverResources) { … } // newController creates a new controller. func newController(ctx context.Context, kubeClient kubernetes.Interface, driver string, owner Owner, resources *DriverResources) (*Controller, error) { … } // initInformer initializes the informer used to watch for changes to the resources slice. func (c *Controller) initInformer(ctx context.Context) error { … } // run is running in the background. func (c *Controller) run(ctx context.Context) { … } func (c *Controller) processNextWorkItem(ctx context.Context) bool { … } // syncPool processes one pool. Only runs inside a single worker, so there // is no need for locking except when accessing c.resources, which may // be updated at any time by the user of the controller. func (c *Controller) syncPool(ctx context.Context, poolName string) error { … }