本文整理汇总了Golang中k8s/io/kubernetes/pkg/api.ServiceSpec.Ports方法的典型用法代码示例。如果您正苦于以下问题:Golang ServiceSpec.Ports方法的具体用法?Golang ServiceSpec.Ports怎么用?Golang ServiceSpec.Ports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/pkg/api.ServiceSpec
的用法示例。
在下文中一共展示了ServiceSpec.Ports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: convert_v1beta3_ServiceSpec_To_api_ServiceSpec
func convert_v1beta3_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.ServiceSpec, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ServiceSpec))(in)
}
if in.Ports != nil {
out.Ports = make([]api.ServicePort, len(in.Ports))
for i := range in.Ports {
if err := convert_v1beta3_ServicePort_To_api_ServicePort(&in.Ports[i], &out.Ports[i], s); err != nil {
return err
}
}
} else {
out.Ports = nil
}
if in.Selector != nil {
out.Selector = make(map[string]string)
for key, val := range in.Selector {
out.Selector[key] = val
}
} else {
out.Selector = nil
}
out.ClusterIP = in.PortalIP
typeIn := in.Type
if typeIn == "" {
if in.CreateExternalLoadBalancer {
typeIn = ServiceTypeLoadBalancer
} else {
typeIn = ServiceTypeClusterIP
}
}
if err := s.Convert(&typeIn, &out.Type, 0); err != nil {
return err
}
if in.PublicIPs != nil {
out.ExternalIPs = make([]string, len(in.PublicIPs))
for i := range in.PublicIPs {
out.ExternalIPs[i] = in.PublicIPs[i]
}
} else {
out.ExternalIPs = nil
}
out.SessionAffinity = api.ServiceAffinity(in.SessionAffinity)
out.LoadBalancerIP = in.LoadBalancerIP
return nil
}