From 0586d866de1b0ca888ad3de53ad41cdb2077dd0e Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 20 Jan 2016 09:30:46 -0500 Subject: [PATCH] AWS: Eliminate assumptions about all load-balancer ports matching It costs us basically nothing to just check all the ports, and protects us against future changes to the controller. --- pkg/cloudprovider/providers/aws/aws.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index d3de323a64b..f5ff10686aa 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -1700,9 +1700,10 @@ func (s *AWSCloud) EnsureLoadBalancer(name, region string, publicIP net.IP, port return nil, fmt.Errorf("requested load balancer with no ports") } - // The service controller verified all the protocols match on the ports, just check and use the first one - if ports[0].Protocol != api.ProtocolTCP { - return nil, fmt.Errorf("Only TCP LoadBalancer is supported for AWS ELB") + for _, port := range ports { + if port.Protocol != api.ProtocolTCP { + return nil, fmt.Errorf("Only TCP LoadBalancer is supported for AWS ELB") + } } if publicIP != nil {