You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can Envoy allow changing address in a listener config update? #15907
Description:
The current listener update reject the new config if the new address of the same listener name is different.
It's safe: new reuse the socket.
Can we relax a little bit to support 127.0.0.1 <-> 0.0.0.0 address update? With proper socket options
this behavior should be safe and avoid service interruption.
@lambdai sorry I can't really parse the issue text. Can you clarify your various points?
At this point I honestly don't remember why I/we originally blocked address changes. I think it's probably fine to allow address changes and just correctly handle the case where we make a new socket for the new listener and correctly drain the old listener (which I guess would happen anyway).
Is there any case which wouldn't work that I am forgetting?
@lambdai sorry I can't really parse the issue text. Can you clarify your various points?
At this point I honestly don't remember why I/we originally blocked address changes. I think it's probably fine to allow address changes and just correctly handle the case where we make a new socket for the new listener and correctly drain the old listener (which I guess would happen anyway).
Is there any case which wouldn't work that I am forgetting?
I am less ambitious: I wish we can start with allow update from wildcard ip to unicast ip.
I don't have the use case of changing from a unicast ip to another unicast ip. Although literally the code path should be exactly
the same as "wildcard ip" to "unicast ip" update, IMO unicast ip to unicast ip update is more likely a config error.
My major concern is that the listener update is not yet revertible on error. For example, if the new listener config want to listen
"10.0.0.1:22". The new update can pass the validation, but can fail on work thread because
10.0.0.1 is not a valid nic ip
port 22 is used by another process.
Envoy process is not privileged.
If we allows address update, the old listener will be drained, and the new listener fails to bind. And the old listener won't come back.
changed the title [-]Can Envoy allow changing address during listener update?[/-][+]Can Envoy allow changing address in a listener config update?[/+]on Apr 9, 2021
FWIW, as part of fixing #15818 I'm going to change it so that all sockets are allocated ahead of time on the main thread (even for SO_REUSEPORT). This will fix a bunch of the corner cases you are talking about and make the logic much simpler to understand. I don't know when I will get to finish that PR though.
In terms of only allowing wildcard IP to unicast IP I don't feel that strongly about it. We can discuss in code review.
I am less ambitious: I wish we can start with allow update from wildcard ip to unicast ip.
I don't have the use case of changing from a unicast ip to another unicast ip. Although literally the code path should be exactly
the same as "wildcard ip" to "unicast ip" update, IMO unicast ip to unicast ip update is more likely a config error.
My major concern is that the listener update is not yet revertible on error. For example, if the new listener config want to listen
"10.0.0.1:22". The new update can pass the validation, but can fail on work thread because
10.0.0.1 is not a valid nic ip
port 22 is used by another process.
Envoy process is not privileged.
If we allows address update, the old listener will be drained, and the new listener fails to bind. And the old listener won't come back.
a question for the preference of envoy between 'update a listener' and 'add a new listener and delete the old one'. Looks like add a new listener and delete the old one can avoid the trouble (by need the control-plane to ensure the new one works before delete the old one), or we have a preference of update a listener.
@soulxu Is your high level goal that only updating address?
If the listener update involves changes other than address, the huge advantage of updating the listener is that your new tcp request never lost. Also, if you have multiple filter chains living in the listener.
Even if the goal is address only update, ideally if you are changing from wildcard address to nic address. the "update" path guarantees no tcp new request lost, if the update is implemented properly :)
@soulxu Is your high level goal that only updating address?
yes
If the listener update involves changes other than address, the huge advantage of updating the listener is that your new tcp request never lost. Also, if you have multiple filter chains living in the listener.
Even if the goal is address only update, ideally if you are changing from wildcard address to nic address. the "update" path guarantees no tcp new request lost, if the update is implemented properly :)
Activity
snowp commentedon Apr 9, 2021
I think this has come up before and iirc there is no fundamental reason why this can't be supported, @mattklein123 might recall the details
mattklein123 commentedon Apr 9, 2021
@lambdai sorry I can't really parse the issue text. Can you clarify your various points?
At this point I honestly don't remember why I/we originally blocked address changes. I think it's probably fine to allow address changes and just correctly handle the case where we make a new socket for the new listener and correctly drain the old listener (which I guess would happen anyway).
Is there any case which wouldn't work that I am forgetting?
mattklein123 commentedon Apr 9, 2021
@lambdai if we end up deciding to change this, can you also fix #15562 please? It's in the same code area.
lambdai commentedon Apr 9, 2021
I am less ambitious: I wish we can start with allow update from wildcard ip to unicast ip.
I don't have the use case of changing from a unicast ip to another unicast ip. Although literally the code path should be exactly
the same as "wildcard ip" to "unicast ip" update, IMO unicast ip to unicast ip update is more likely a config error.
My major concern is that the listener update is not yet revertible on error. For example, if the new listener config want to listen
"10.0.0.1:22". The new update can pass the validation, but can fail on work thread because
If we allows address update, the old listener will be drained, and the new listener fails to bind. And the old listener won't come back.
[-]Can Envoy allow changing address during listener update?[/-][+]Can Envoy allow changing address in a listener config update?[/+]mattklein123 commentedon Apr 10, 2021
FWIW, as part of fixing #15818 I'm going to change it so that all sockets are allocated ahead of time on the main thread (even for SO_REUSEPORT). This will fix a bunch of the corner cases you are talking about and make the logic much simpler to understand. I don't know when I will get to finish that PR though.
In terms of only allowing wildcard IP to unicast IP I don't feel that strongly about it. We can discuss in code review.
soulxu commentedon Apr 14, 2021
a question for the preference of envoy between 'update a listener' and 'add a new listener and delete the old one'. Looks like add a new listener and delete the old one can avoid the trouble (by need the control-plane to ensure the new one works before delete the old one), or we have a preference of
update a listener.lambdai commentedon Apr 14, 2021
@soulxu Is your high level goal that only updating address?
If the listener update involves changes other than address, the huge advantage of updating the listener is that your new tcp request never lost. Also, if you have multiple filter chains living in the listener.
Even if the goal is address only update, ideally if you are changing from wildcard address to nic address. the "update" path guarantees no tcp new request lost, if the update is implemented properly :)
soulxu commentedon Apr 15, 2021
yes
copy that, thanks for the explanation :)