type Repair … const numRepairsBeforeLeakCleanup … // NewRepair creates a controller that periodically ensures that all ports are uniquely allocated across the cluster // and generates informational warnings for a cluster that is not in sync. func NewRepair(interval time.Duration, serviceClient corev1client.ServicesGetter, eventClient eventsv1client.EventsV1Interface, portRange net.PortRange, alloc rangeallocation.RangeRegistry) *Repair { … } // RunUntil starts the controller until the provided ch is closed. func (c *Repair) RunUntil(onFirstSuccess func(), stopCh chan struct{ … } // runOnce verifies the state of the port allocations and returns an error if an unrecoverable problem occurs. func (c *Repair) runOnce() error { … } // doRunOnce verifies the state of the port allocations and returns an error if an unrecoverable problem occurs. func (c *Repair) doRunOnce() error { … } // collectServiceNodePorts returns nodePorts specified in the Service. // Please note that: // 1. same nodePort with *same* protocol will be duplicated as it is // 2. same nodePort with *different* protocol will be deduplicated func collectServiceNodePorts(service *corev1.Service) []int { … }