-
Notifications
You must be signed in to change notification settings - Fork 617
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
fix(occm/loadbalancer): enable the proxy-protocol only for supported listeners #2368
fix(occm/loadbalancer): enable the proxy-protocol only for supported listeners #2368
Conversation
|
Welcome @Lucasgranet! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @Lucasgranet. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
@Lucasgranet for me this fix looks like a dirty hack. How does QUIC server behave when TCP listener does contain a proxy protocol header, but UDP listener doesn't? |
Hello @kayrus, With the current version of Octavia, the QUIC protocol cannot be enable with the ProxyProtocol indeed. (because he relies on UDP). Whatever is the protocol, Octavia, atm, doesn't support the ProxyProtocol with the UDP (and SCTP) listeners. This PR lead to fix LoadBalancer Service when:
With the current upstream code, the CCM will get this error from the Octavia API: {
"faultcode": "Client",
"faultstring": "Validation failure: The pool protocol 'PROXY' is invalid while the listener protocol is 'UDP'.",
"debuginfo": null
} Lucas, |
var ( | ||
// List based on Octavia documentation https://docs.openstack.org/api-ref/load-balancer/v2/index.html?expanded=create-pool-detail#protocol-combinations-listener-pool | ||
proxyProtocolSupportedListeners = []listeners.Protocol{listeners.ProtocolHTTP, listeners.ProtocolHTTPS, listeners.ProtocolTCP, listeners.ProtocolTerminatedHTTPS} | ||
_ cloudprovider.LoadBalancer = &LbaasV2{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you want to achieve with this string?
var _ cloudprovider.LoadBalancer = &LbaasV2{} | ||
var ( | ||
// List based on Octavia documentation https://docs.openstack.org/api-ref/load-balancer/v2/index.html?expanded=create-pool-detail#protocol-combinations-listener-pool | ||
proxyProtocolSupportedListeners = []listeners.Protocol{listeners.ProtocolHTTP, listeners.ProtocolHTTPS, listeners.ProtocolTCP, listeners.ProtocolTerminatedHTTPS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to define each supported protocol on a separate line. further list updates will look more readable.
// for the pool configuration. In the case of UDP listener, Octavia doesn't support the ProxyProtocol | ||
// and should not be enabled to avoid 403 from Octavia API. | ||
// https://docs.openstack.org/api-ref/load-balancer/v2/index.html?expanded=create-pool-detail#protocol-combinations-listener-pool | ||
func isProtocolProxyProtocolSupported(protocol string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have
cloud-provider-openstack/pkg/util/util.go
Lines 65 to 73 in 5b36a53
// Contains searches if a string list contains the given string or not. | |
func Contains(list []string, strToSearch string) bool { | |
for _, item := range list { | |
if item == strToSearch { | |
return true | |
} | |
} | |
return false | |
} |
func Contains[T comparable](list []T, strToSearch T) bool {
for _, item := range list {
if item == strToSearch {
return true
}
}
return false
}
I think I understand the idea here. However instead of relying on a static list of supported protocols I think I'd prefer to catch the creation error and ignore it if message indicates that the problem is with the combination. Moreover we should only mask the error if the |
is there a way to view these warnings using |
Indeed, this behavior seems better, especially if Octavia will support this combination one day.
I'm agree with this too. We should not allow the ProxyProtocol's annotation set to
An event is returned to the user. Warning SyncLoadBalancerFailed 18s (x5 over 18m) service-controller Error syncing load balancer: failed to ensure load balancer: Bad request with: [POST https://load-balancer.gra9.cloud.ovh.net/v2.0/lbaas/pools], error message: {"faultcode": "Client", "faultstring": "Validation failure: The pool protocol 'PROXY' is invalid while the listener protocol is 'UDP'.", "debuginfo": null} |
Fair point, only errors are logged as Events and I was proposing to not error. I'll try to draft some interface that would allow us to create events, based on how GCP provider does this. |
Please see #2383. It's yet to be tested, but I don't see why it wouldn't work. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Lucasgranet: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Hello @dulek Sorry for the late, I was busy on other subjects. Lucas, |
@Lucasgranet #2383 is just merged, so great timing. ;) |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
I rebased this in #2549. Closing this one. |
What this PR does / why we need it:
This PR fix an issue when trying to activate the ProxyProtocol on a K8S LoadBalancer with, at least, one UDP or SCTP port.
The CCM try, when the proxy-protocol's annotation is set, to enable the proxy-protocols on all pools, whatever the protocol used by the listener.
Octavia doesn't support the proxy protocol with a UDP or SCTP listener: https://docs.openstack.org/api-ref/load-balancer/v2/index.html?expanded=create-pool-detail#protocol-combinations-listener-pool
Which issue this PR fixes(if applicable):
N/A
Special notes for reviewers:
ATM, this service cannot be deployed. This kind of service will be more common due to "new" protocol HTTP/3/QUIC (TCP and UDP usage on the same service).
Without this patch, this will result to a 409 from the Octavia's API.
Release note: