// allocateHost allocates a host name ONLY if the host name on the route is empty and an allocator // is configured. It must first allocate the shard and may return an error if shard allocation // fails. func (s routeStrategy) allocateHost(route *api.Route) error { if len(route.Spec.Host) == 0 && s.RouteAllocator != nil { // TODO: this does not belong here, and should be removed shard, err := s.RouteAllocator.AllocateRouterShard(route) if err != nil { return errors.NewInternalError(fmt.Errorf("allocation error: %v for route: %#v", err, route)) } route.Spec.Host = s.RouteAllocator.GenerateHostname(route, shard) if route.Annotations == nil { route.Annotations = map[string]string{} } route.Annotations[HostGeneratedAnnotationKey] = "true" } return nil }