Add NodePort to ServicePort

We prevent it from being set by validation
This commit is contained in:
Justin Santa Barbara
2015-05-22 17:54:19 -04:00
parent 973c2e4819
commit 2197c8da5a
11 changed files with 66 additions and 0 deletions

View File

@@ -1720,6 +1720,22 @@ func TestValidateService(t *testing.T) {
},
numErrs: 0,
},
{
name: "duplicate nodeports",
tweakSvc: func(s *api.Service) {
s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1})
s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "TCP", NodePort: 1})
},
numErrs: 2, // TODO(justinsb): change to 1 when NodePorts enabled
},
{
name: "duplicate nodeports (different protocols)",
tweakSvc: func(s *api.Service) {
s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "q", Port: 1, Protocol: "TCP", NodePort: 1})
s.Spec.Ports = append(s.Spec.Ports, api.ServicePort{Name: "r", Port: 2, Protocol: "UDP", NodePort: 1})
},
numErrs: 1, // TODO(justinsb): change to 0 when NodePorts enabled
},
}
for _, tc := range testCases {