-
Notifications
You must be signed in to change notification settings - Fork 96
Add support for HTTP/2 listener protocol in OCI Load Balancer #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -146,6 +146,10 @@ const ( | |||||
| // loadbalancer traffic policy("ROUND_ROBIN", "LEAST_CONNECTION", "IP_HASH") | ||||||
| ServiceAnnotationLoadBalancerPolicy = "oci.oraclecloud.com/loadbalancer-policy" | ||||||
|
|
||||||
| // ServiceAnnotationLoadBalancerProtocol is a service annotation for specifying | ||||||
| // the load balancer listener protocol ("HTTP", "HTTP2", "TCP", "GRPC"). | ||||||
| ServiceAnnotationLoadBalancerProtocol = "oci.oraclecloud.com/oci-load-balancer-protocol" | ||||||
|
|
||||||
| // ServiceAnnotationLoadBalancerInitialDefinedTagsOverride is a service annotation for specifying | ||||||
| // defined tags on the LB | ||||||
| ServiceAnnotationLoadBalancerInitialDefinedTagsOverride = "oci.oraclecloud.com/initial-defined-tags-override" | ||||||
|
|
@@ -1092,19 +1096,32 @@ func getListenersOciLoadBalancer(svc *v1.Service, sslCfg *SSLConfig) (map[string | |||||
|
|
||||||
| listeners := make(map[string]client.GenericListener) | ||||||
| for _, servicePort := range svc.Spec.Ports { | ||||||
| protocol := string(servicePort.Protocol) | ||||||
| // Annotation overrides the protocol. | ||||||
| backendProtocol := string(servicePort.Protocol) | ||||||
| // Backend protocol annotation overrides the protocol. | ||||||
| if p, ok := svc.Annotations[ServiceAnnotationLoadBalancerBEProtocol]; ok { | ||||||
| // Default | ||||||
| if p == "" { | ||||||
| p = DefaultLoadBalancerBEProtocol | ||||||
| } | ||||||
| if strings.EqualFold(p, "HTTP") || strings.EqualFold(p, "TCP") || strings.EqualFold(p, "GRPC") { | ||||||
| protocol = p | ||||||
| backendProtocol = p | ||||||
| } else { | ||||||
| return nil, fmt.Errorf("invalid backend protocol %q requested for load balancer listener. Only 'HTTP', 'TCP' and 'GRPC' protocols supported", p) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Listener protocol - starts with backend protocol but can be overridden | ||||||
| listenerProtocol := backendProtocol | ||||||
| if p, ok := svc.Annotations[ServiceAnnotationLoadBalancerProtocol]; ok { | ||||||
| if p != "" { | ||||||
| if strings.EqualFold(p, "HTTP") || strings.EqualFold(p, "HTTP2") || strings.EqualFold(p, "TCP") || strings.EqualFold(p, "GRPC") { | ||||||
| listenerProtocol = p | ||||||
raniellyferreira marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| } else { | ||||||
| return nil, fmt.Errorf("invalid listener protocol %q requested for load balancer listener. Only 'HTTP', 'HTTP2', 'TCP' and 'GRPC' protocols supported", p) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| port := int(servicePort.Port) | ||||||
|
|
||||||
| var secretName string | ||||||
|
|
@@ -1118,21 +1135,21 @@ func getListenersOciLoadBalancer(svc *v1.Service, sslCfg *SSLConfig) (map[string | |||||
| return nil, err | ||||||
| } | ||||||
| } | ||||||
| if strings.EqualFold(protocol, "GRPC") { | ||||||
| protocol = ProtocolGrpc | ||||||
| if strings.EqualFold(listenerProtocol, "GRPC") { | ||||||
| listenerProtocol = ProtocolGrpc | ||||||
| if sslConfiguration == nil { | ||||||
| return nil, fmt.Errorf("SSL configuration cannot be empty for GRPC protocol") | ||||||
| } | ||||||
| if sslConfiguration.CipherSuiteName == nil { | ||||||
| sslConfiguration.CipherSuiteName = common.String(DefaultCipherSuiteForGRPC) | ||||||
| } | ||||||
| } | ||||||
| name := getListenerName(protocol, port) | ||||||
| name := getListenerName(listenerProtocol, port) | ||||||
|
|
||||||
| listener := client.GenericListener{ | ||||||
| Name: &name, | ||||||
| DefaultBackendSetName: common.String(getBackendSetName(string(servicePort.Protocol), int(servicePort.Port))), | ||||||
|
||||||
| DefaultBackendSetName: common.String(getBackendSetName(string(servicePort.Protocol), int(servicePort.Port))), | |
| DefaultBackendSetName: common.String(getBackendSetName(listenerProtocol, int(servicePort.Port))), |
Uh oh!
There was an error while loading. Please reload this page.