Service port names are required for multi-port

There is no provision for the first port to be unnamed.  I think I
initially allowed that, but then the Subset struct became a sorted
struct, so the first-ness of the port got lost.  If you have a Service
with one named and one unnamed port, what happens is that the
EndpointController fails to create Endpoints (validation error).
This commit is contained in:
Tim Hockin
2015-05-05 11:51:51 -07:00
parent 738f403eea
commit 3aa39d54b6
2 changed files with 17 additions and 10 deletions

View File

@@ -1600,6 +1600,14 @@ func TestValidateService(t *testing.T) {
},
numErrs: 1,
},
{
name: "empty multi-port port[0] name",
tweakSvc: func(s *api.Service) {
s.Spec.Ports[0].Name = ""
s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "p", Protocol: "TCP", Port: 12345})
},
numErrs: 1,
},
{
name: "invalid port name",
tweakSvc: func(s *api.Service) {