runtime.HandleError(fmt.Errorf("the cluster IP %s for service %s/%s is not allocated; repairing",svc.Spec.ClusterIP,svc.Name,svc.Namespace))
c.recorder.Eventf(&svc,v1.EventTypeWarning,"ClusterIPNotAllocated","Cluster IP %s is not allocated; repairing",ip)
runtime.HandleError(fmt.Errorf("the cluster IP %s for service %s/%s is not allocated; repairing",ip,svc.Name,svc.Namespace))
}
delete(c.leaks,ip.String())// it is used, so it can't be leaked
caseipallocator.ErrAllocated:
// TODO: send event
// cluster IP is duplicate
c.recorder.Eventf(&svc,v1.EventTypeWarning,"ClusterIPAlreadyAllocated","Cluster IP %s was assigned to multiple services; please recreate service",ip)
runtime.HandleError(fmt.Errorf("the cluster IP %s for service %s/%s was assigned to multiple services; please recreate",ip,svc.Name,svc.Namespace))
caseerr.(*ipallocator.ErrNotInRange):
// TODO: send event
// cluster IP is out of range
c.recorder.Eventf(&svc,v1.EventTypeWarning,"ClusterIPOutOfRange","Cluster IP %s is not within the service CIDR %s; please recreate service",ip,c.network)
runtime.HandleError(fmt.Errorf("the cluster IP %s for service %s/%s is not within the service CIDR %s; please recreate",ip,svc.Name,svc.Namespace,c.network))
caseipallocator.ErrFull:
// TODO: send event
// somehow we are out of IPs
returnfmt.Errorf("the service CIDR %v is full; you must widen the CIDR in order to create new services",rebuilt)
c.recorder.Eventf(&svc,v1.EventTypeWarning,"ServiceCIDRFull","Service CIDR %s is full; you must widen the CIDR in order to create new services",c.network)
returnfmt.Errorf("the service CIDR %s is full; you must widen the CIDR in order to create new services",c.network)
default:
c.recorder.Eventf(&svc,v1.EventTypeWarning,"UnknownError","Unable to allocate cluster IP %s due to an unknown error",ip)
returnfmt.Errorf("unable to allocate cluster IP %s for service %s/%s due to an unknown error, exiting: %v",ip,svc.Name,svc.Namespace,err)
c.recorder.Eventf(svc,v1.EventTypeWarning,"PortNotAllocated","Port %d is not allocated; repairing",port)
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:
// TODO: send event
// port is duplicate, reallocate
c.recorder.Eventf(svc,v1.EventTypeWarning,"PortAlreadyAllocated","Port %d was assigned to multiple services; please recreate service",port)
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):
// TODO: send event
// 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))
c.recorder.Eventf(svc,v1.EventTypeWarning,"PortOutOfRange","Port %d is not within the port range %s; please recreate service",port,c.portRange)
runtime.HandleError(fmt.Errorf("the port %d for service %s/%s is not within the port range %s; please recreate",port,svc.Name,svc.Namespace,c.portRange))
caseportallocator.ErrFull:
// 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)
c.recorder.Eventf(svc,v1.EventTypeWarning,"PortRangeFull","Port range %s is full; you must widen the port range in order to create new services",c.portRange)
returnfmt.Errorf("the port range %s is full; you must widen the port range in order to create new services",c.portRange)
default:
c.recorder.Eventf(svc,v1.EventTypeWarning,"UnknownError","Unable to allocate port %d due to an unknown error",port)
returnfmt.Errorf("unable to allocate port %d for service %s/%s due to an unknown error, exiting: %v",port,svc.Name,svc.Namespace,err)