Rename Service.ContainerPort to TargetPort in v1b3

Fix all callers and examples.  Part of multi-port service cleanup.
This commit is contained in:
Tim Hockin
2015-03-20 13:50:06 -07:00
parent a8f2cee8c5
commit 4375376e9c
28 changed files with 77 additions and 73 deletions

View File

@@ -68,7 +68,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
for _, pod := range pods.Items {
// TODO: Once v1beta1 and v1beta2 are EOL'ed, this can
// assume that service.Spec.ContainerPort is populated.
// assume that service.Spec.TargetPort is populated.
_ = v1beta1.Dependency
_ = v1beta2.Dependency
port, err := findPort(&pod, &service)
@@ -196,7 +196,7 @@ func findDefaultPort(pod *api.Pod, servicePort int) (int, bool) {
// findPort locates the container port for the given manifest and portName.
func findPort(pod *api.Pod, service *api.Service) (int, error) {
portName := service.Spec.ContainerPort
portName := service.Spec.TargetPort
switch portName.Kind {
case util.IntstrString:
if len(portName.StrVal) == 0 {

View File

@@ -213,7 +213,7 @@ func TestFindPort(t *testing.T) {
},
}
for _, test := range tests {
port, err := findPort(&test.pod, &api.Service{Spec: api.ServiceSpec{Port: servicePort, ContainerPort: test.portName}})
port, err := findPort(&test.pod, &api.Service{Spec: api.ServiceSpec{Port: servicePort, TargetPort: test.portName}})
if port != test.wport {
t.Errorf("Expected port %d, Got %d", test.wport, port)
}