mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 06:01:50 +00:00
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 @therc
This commit is contained in:
@@ -96,11 +96,12 @@ const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws
|
|||||||
const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports"
|
const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports"
|
||||||
|
|
||||||
// ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service
|
// ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service
|
||||||
// to specify the protocol spoken by the backend (pod) behind a secure listener.
|
// to specify the protocol spoken by the backend (pod) behind a listener.
|
||||||
// Only inspected when `aws-load-balancer-ssl-cert` is used.
|
|
||||||
// If `http` (default) or `https`, an HTTPS listener that terminates the
|
// If `http` (default) or `https`, an HTTPS listener that terminates the
|
||||||
// connection and parses headers is created.
|
// connection and parses headers is created.
|
||||||
// If set to `ssl` or `tcp`, a "raw" SSL listener is used.
|
// 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"
|
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"
|
||||||
|
|
||||||
// Maps from backend protocol to ELB 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
|
listener.SSLCertificateId = &certID
|
||||||
|
} else if annotationProtocol := annotations[ServiceAnnotationLoadBalancerBEProtocol]; annotationProtocol == "http" {
|
||||||
|
instanceProtocol = annotationProtocol
|
||||||
|
protocol = "http"
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.Protocol = &protocol
|
listener.Protocol = &protocol
|
||||||
listener.InstanceProtocol = &instanceProtocol
|
listener.InstanceProtocol = &instanceProtocol
|
||||||
|
|
||||||
|
@@ -1291,6 +1291,11 @@ func TestBuildListener(t *testing.T) {
|
|||||||
443, "", 8011, "tcp", "cert", "foo,bar",
|
443, "", 8011, "tcp", "cert", "foo,bar",
|
||||||
false, "tcp", "tcp", "",
|
false, "tcp", "tcp", "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"HTTP->HTTP",
|
||||||
|
80, "", 8012, "http", "", "",
|
||||||
|
false, "http", "http", "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
Reference in New Issue
Block a user