const maxRetries … const defaultSyncBackOff … const maxSyncBackOff … const controllerName … // NewController creates and initializes a new Controller func NewController(ctx context.Context, endpointsInformer coreinformers.EndpointsInformer, endpointSliceInformer discoveryinformers.EndpointSliceInformer, serviceInformer coreinformers.ServiceInformer, maxEndpointsPerSubset int32, client clientset.Interface, endpointUpdatesBatchPeriod time.Duration, ) *Controller { … } type Controller … // Run will not return until stopCh is closed. func (c *Controller) Run(ctx context.Context, workers int) { … } // worker runs a worker thread that just dequeues items, processes them, and // marks them done. You may run as many of these in parallel as you wish; the // workqueue guarantees that they will not end up processing the same service // at the same time func (c *Controller) worker(logger klog.Logger) { … } func (c *Controller) processNextWorkItem(logger klog.Logger) bool { … } func (c *Controller) handleErr(logger klog.Logger, err error, key string) { … } func (c *Controller) syncEndpoints(logger klog.Logger, key string) error { … } // queueEndpoints queues the Endpoints resource for processing. func (c *Controller) queueEndpoints(obj interface{ … } // shouldMirror returns true if an Endpoints resource should be mirrored by this // controller. This will be false if: // - the Endpoints resource is nil. // - the Endpoints resource has a skip-mirror label. // - the Endpoints resource has a leader election annotation. // This does not ensure that a corresponding Service exists with a nil selector. // That check should be performed separately. func (c *Controller) shouldMirror(endpoints *v1.Endpoints) bool { … } // onServiceAdd queues a sync for the relevant Endpoints resource. func (c *Controller) onServiceAdd(obj interface{ … } // onServiceUpdate queues a sync for the relevant Endpoints resource. func (c *Controller) onServiceUpdate(prevObj, obj interface{ … } // onServiceDelete queues a sync for the relevant Endpoints resource. func (c *Controller) onServiceDelete(obj interface{ … } // onEndpointsAdd queues a sync for the relevant Endpoints resource. func (c *Controller) onEndpointsAdd(logger klog.Logger, obj interface{ … } // onEndpointsUpdate queues a sync for the relevant Endpoints resource. func (c *Controller) onEndpointsUpdate(logger klog.Logger, prevObj, obj interface{ … } // onEndpointsDelete queues a sync for the relevant Endpoints resource. func (c *Controller) onEndpointsDelete(logger klog.Logger, obj interface{ … } // onEndpointSliceAdd queues a sync for the relevant Endpoints resource for a // sync if the EndpointSlice resource version does not match the expected // version in the endpointSliceTracker. func (c *Controller) onEndpointSliceAdd(obj interface{ … } // onEndpointSliceUpdate queues a sync for the relevant Endpoints resource for a // sync if the EndpointSlice resource version does not match the expected // version in the endpointSliceTracker or the managed-by value of the // EndpointSlice has changed from or to this controller. func (c *Controller) onEndpointSliceUpdate(logger klog.Logger, prevObj, obj interface{ … } // onEndpointSliceDelete queues a sync for the relevant Endpoints resource for a // sync if the EndpointSlice resource version does not match the expected // version in the endpointSliceTracker. func (c *Controller) onEndpointSliceDelete(obj interface{ … } // queueEndpointsForEndpointSlice attempts to queue the corresponding Endpoints // resource for the provided EndpointSlice. func (c *Controller) queueEndpointsForEndpointSlice(endpointSlice *discovery.EndpointSlice) { … } // deleteMirroredSlices will delete and EndpointSlices that have been mirrored // for Endpoints with this namespace and name. func (c *Controller) deleteMirroredSlices(namespace, name string) error { … } // endpointSlicesMirroredForService returns the EndpointSlices that have been // mirrored for a Service by this controller. func endpointSlicesMirroredForService(endpointSliceLister discoverylisters.EndpointSliceLister, namespace, name string) ([]*discovery.EndpointSlice, error) { … }