// remove it from the old set, so we can find leaks
stored.Release(port)
}else{
// doesn't seem to be allocated
runtime.HandleError(fmt.Errorf("the node port %d for service %s/%s is not allocated; repairing",port,svc.Name,svc.Namespace))
}
delete(c.leaks,port)// it is used, so it can't be leaked
caseportallocator.ErrAllocated:
caseportallocator.ErrAllocated:
// TODO: send event
// TODO: send event
// port is broken, reallocate
// port is duplicate, reallocate
runtime.HandleError(fmt.Errorf("the port %d for service %s/%s was assigned to multiple services; please recreate",port,svc.Name,svc.Namespace))
runtime.HandleError(fmt.Errorf("the node port %d for service %s/%s was assigned to multiple services; please recreate",port,svc.Name,svc.Namespace))
caseerr.(*portallocator.ErrNotInRange):
caseerr.(*portallocator.ErrNotInRange):
// TODO: send event
// TODO: send event
// port is broken, reallocate
// port is out of range, reallocate
runtime.HandleError(fmt.Errorf("the port %d for service %s/%s is not within the port range %v; please recreate",port,svc.Name,svc.Namespace,c.portRange))
runtime.HandleError(fmt.Errorf("the port %d for service %s/%s is not within the port range %v; please recreate",port,svc.Name,svc.Namespace,c.portRange))
caseportallocator.ErrFull:
caseportallocator.ErrFull:
// TODO: send event
// TODO: send event
// somehow we are out of ports
returnfmt.Errorf("the port range %v is full; you must widen the port range in order to create new services",c.portRange)
returnfmt.Errorf("the port range %v is full; you must widen the port range in order to create new services",c.portRange)
default:
default:
returnfmt.Errorf("unable to allocate port %d for service %s/%s due to an unknown error, exiting: %v",port,svc.Name,svc.Namespace,err)
returnfmt.Errorf("unable to allocate port %d for service %s/%s due to an unknown error, exiting: %v",port,svc.Name,svc.Namespace,err)