本文整理汇总了Golang中github.com/openshift/origin/pkg/route/api.Route类的典型用法代码示例。如果您正苦于以下问题:Golang Route类的具体用法?Golang Route怎么用?Golang Route使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Route类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: convert_v1_Route_To_api_Route
func convert_v1_Route_To_api_Route(in *Route, out *newer.Route, s conversion.Scope) error {
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
out.Path = in.Spec.Path
out.Host = in.Spec.Host
if in.Spec.To.Kind == "Service" || len(in.Spec.To.Kind) == 0 {
out.ServiceName = in.Spec.To.Name
}
return s.Convert(&in.Spec.TLS, &out.TLS, 0)
}
开发者ID:cjnygard,项目名称:origin,代码行数:12,代码来源:conversion.go
示例2: 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
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:18,代码来源:strategy.go
注:本文中的github.com/openshift/origin/pkg/route/api.Route类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论