mirror of https://github.com/k3s-io/k3s
Merge pull request #30563 from knarz/master
Automatic merge from submit-queue AWS: Support HTTP->HTTP mode for ELB **What this PR does / why we need it**: Right now it is not possible to create an AWS ELB that listens for HTTP and where the backend pod also listens for HTTP. I asked @justinsb in slack and he said that this seems to be an oversight, so I'd like to use this PR as a step towards solving this. **Special notes for your reviewer**: I've only added a simple unit test. Are any integration tests needed? I'm not familiar with the code base. cc @thercpull/6/head
commit
364d696fd5
|
@ -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
|
||||
|
@ -2351,7 +2352,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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue