Пример #1
0
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
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,
	}
}