本文整理匯總了Golang中github.com/openshift/origin/pkg/route/api.Route.Annotations方法的典型用法代碼示例。如果您正苦於以下問題:Golang Route.Annotations方法的具體用法?Golang Route.Annotations怎麽用?Golang Route.Annotations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/route/api.Route
的用法示例。
在下文中一共展示了Route.Annotations方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: allocateHost
// 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
}