Add comment, rename getListener to buildListener

This commit is contained in:
Rudi Chiarito 2016-05-10 11:40:34 -04:00
parent 898df1f52b
commit e19c069b9d
2 changed files with 5 additions and 4 deletions

View File

@ -78,7 +78,6 @@ const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws
// Only inspected when `aws-load-balancer-ssl-cert` is used.
// If `http` (default) or `https`, an HTTPS listener that terminates the connection and parses headers is created.
// If set to `ssl` or `tcp`, a "raw" SSL listener is used.
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"
// Maps from backend protocol to ELB protocol
@ -2119,7 +2118,9 @@ func isSubnetPublic(rt []*ec2.RouteTable, subnetID string) (bool, error) {
return false, nil
}
func getListener(port api.ServicePort, annotations map[string]string) (*elb.Listener, error) {
// buildListener creates a new listener from the given port, adding an SSL certificate
// if indicated by the appropriate annotations.
func buildListener(port api.ServicePort, annotations map[string]string) (*elb.Listener, error) {
loadBalancerPort := int64(port.Port)
instancePort := int64(port.NodePort)
protocol := strings.ToLower(string(port.Protocol))
@ -2172,7 +2173,7 @@ func (s *AWSCloud) EnsureLoadBalancer(apiService *api.Service, hosts []string, a
glog.Errorf("Ignoring port without NodePort defined: %v", port)
continue
}
listener, err := getListener(port, annotations)
listener, err := buildListener(port, annotations)
if err != nil {
return nil, err
}

View File

@ -1200,7 +1200,7 @@ func TestDescribeLoadBalancerOnEnsure(t *testing.T) {
c.EnsureLoadBalancer(&api.Service{ObjectMeta: api.ObjectMeta{Name: "myservice", UID: "id"}}, []string{}, map[string]string{})
}
func TestGetListener(t *testing.T) {
func TestBuildListener(t *testing.T) {
tests := []struct {
name string