Skip to content

Can Envoy allow changing address in a listener config update? #15907

Closed

Description

@lambdai

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.

What's the drawback?

What can be done in control plane?

Also see the failure in istio/istio#32053 (comment) why it's nice to have in Envoy

Activity

  1. added
    enhancement
    triage
    on Apr 9, 2021
  2. snowp commented on Apr 9, 2021

    @snowp
    Contributor

    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

  3. added and removed
    enhancement
    triage
    on Apr 9, 2021
  4. mattklein123 commented on Apr 9, 2021

    @mattklein123
    Member

    @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?

  5. mattklein123 commented on Apr 9, 2021

    @mattklein123
    Member

    @lambdai if we end up deciding to change this, can you also fix #15562 please? It's in the same code area.

  6. lambdai commented on Apr 9, 2021

    @lambdai
    ContributorAuthor

    @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

    1. 10.0.0.1 is not a valid nic ip
    2. port 22 is used by another process.
    3. 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.

  7. 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
  8. mattklein123 commented on Apr 10, 2021

    @mattklein123
    Member

    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.

  9. soulxu commented on Apr 14, 2021

    @soulxu
    Member

    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

    1. 10.0.0.1 is not a valid nic ip
    2. port 22 is used by another process.
    3. 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.

  10. lambdai commented on Apr 14, 2021

    @lambdai
    ContributorAuthor

    @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 :)

  11. soulxu commented on Apr 15, 2021

    @soulxu
    Member

    @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 :)

    copy that, thanks for the explanation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions