From 9a111fffc89e996fc2525134e34e0476395e7789 Mon Sep 17 00:00:00 2001 From: Sascha Hanse Date: Sat, 13 Aug 2016 02:30:35 +0200 Subject: [PATCH] enables the aws-load-balancer-backend-protocol annotion to be used without a cert to be able to create an HTTP->HTTP ELB --- pkg/cloudprovider/providers/aws/aws.go | 9 +++++++-- pkg/cloudprovider/providers/aws/aws_test.go | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index 37e8078e3eb..c62d8000d14 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -96,11 +96,12 @@ const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports" // ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service -// to specify the protocol spoken by the backend (pod) behind a secure listener. -// Only inspected when `aws-load-balancer-ssl-cert` is used. +// to specify the protocol spoken by the backend (pod) behind a listener. // 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. +// If set to `http` and `aws-load-balancer-ssl-cert` is not used then +// a HTTP listener is used. const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol" // Maps from backend protocol to ELB protocol @@ -2290,7 +2291,11 @@ func buildListener(port api.ServicePort, annotations map[string]string, sslPorts } } listener.SSLCertificateId = &certID + } else if annotationProtocol := annotations[ServiceAnnotationLoadBalancerBEProtocol]; annotationProtocol == "http" { + instanceProtocol = annotationProtocol + protocol = "http" } + listener.Protocol = &protocol listener.InstanceProtocol = &instanceProtocol diff --git a/pkg/cloudprovider/providers/aws/aws_test.go b/pkg/cloudprovider/providers/aws/aws_test.go index c7a52ba7a5a..91d5fb267bd 100644 --- a/pkg/cloudprovider/providers/aws/aws_test.go +++ b/pkg/cloudprovider/providers/aws/aws_test.go @@ -1291,6 +1291,11 @@ func TestBuildListener(t *testing.T) { 443, "", 8011, "tcp", "cert", "foo,bar", false, "tcp", "tcp", "", }, + { + "HTTP->HTTP", + 80, "", 8012, "http", "", "", + false, "http", "http", "", + }, } for _, test := range tests {