示例#1
0
文件: osdn.go 项目: ncantor/origin
func newSDNService(kServ *kapi.Service, namespace string, port kapi.ServicePort) osdnapi.Service {
	return osdnapi.Service{
		Name:      kServ.ObjectMeta.Name,
		Namespace: namespace,
		IP:        kServ.Spec.ClusterIP,
		Protocol:  osdnapi.ServiceProtocol(port.Protocol),
		Port:      uint(port.Port),
	}
}
示例#2
0
文件: osdn.go 项目: kimsh92/origin
func newSDNService(kServ *kapi.Service) osdnapi.Service {
	ports := make([]osdnapi.ServicePort, len(kServ.Spec.Ports))
	for i, port := range kServ.Spec.Ports {
		ports[i] = osdnapi.ServicePort{osdnapi.ServiceProtocol(port.Protocol), uint(port.Port)}
	}

	return osdnapi.Service{
		Name:      kServ.ObjectMeta.Name,
		Namespace: kServ.ObjectMeta.Namespace,
		UID:       string(kServ.ObjectMeta.UID),
		IP:        kServ.Spec.ClusterIP,
		Ports:     ports,
	}
}