Skip to content
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

Codereorg: Part 5, state #1492

Merged
merged 31 commits into from
Sep 19, 2023
Merged

Codereorg: Part 5, state #1492

merged 31 commits into from
Sep 19, 2023

Commits on Sep 11, 2023

  1. format with prettier 3.0

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    a885e1f View commit details
    Browse the repository at this point in the history
  2. Replace the timestamp based state system

    This commit replaces the timestamp based state system with a new
    one that has update channels directly to the connected nodes. It
    will send an update to all listening clients via the polling
    mechanism.
    
    It introduces a new package notifier, which has a concurrency safe
    manager for all our channels to the connected nodes.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    2f7cbc8 View commit details
    Browse the repository at this point in the history
  3. Split up MapResponse

    This commits extends the mapper with functions for creating "delta"
    MapResponses for different purposes (peer changed, peer removed, derp).
    
    This wires up the new state management with a new StateUpdate struct
    letting the poll worker know what kind of update to send to the
    connected nodes.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    47a75db View commit details
    Browse the repository at this point in the history
  4. Add missing return in shutdown

    Co-Authored-By: Jason <[email protected]>
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby and armooo committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    a52db30 View commit details
    Browse the repository at this point in the history
  5. add script to run integration tests

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    8e973f4 View commit details
    Browse the repository at this point in the history
  6. rearrange channel closing defers

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    b6593dc View commit details
    Browse the repository at this point in the history
  7. add annoying linter to golangci

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    3b8c4c9 View commit details
    Browse the repository at this point in the history
  8. add less/jq to hs debug container

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    809db0c View commit details
    Browse the repository at this point in the history
  9. add debug option to save all map responses

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    1013e5f View commit details
    Browse the repository at this point in the history
  10. disable online map by default for now

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    3ee0179 View commit details
    Browse the repository at this point in the history
  11. introduce rw lock for db, ish...

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    3bfc123 View commit details
    Browse the repository at this point in the history
  12. additional debug logging, use mapper pointer

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    c054fb5 View commit details
    Browse the repository at this point in the history
  13. only send lite map responses when omitpeers

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    52a85bc View commit details
    Browse the repository at this point in the history
  14. fix lint

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    eb1a556 View commit details
    Browse the repository at this point in the history
  15. add maprequest to all mapper calls

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    d84ea0e View commit details
    Browse the repository at this point in the history
  16. remove retries for pings in tsic

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    6b620ca View commit details
    Browse the repository at this point in the history
  17. filter out peers without endpoints

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    6b49dad View commit details
    Browse the repository at this point in the history
  18. rearrange poll, lock, notify

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    841e3c5 View commit details
    Browse the repository at this point in the history
  19. Update packetfilter when peers change

    Previously we did not update the packet filter
    when nodes changed, which would cause new nodes
    to be missing from packet filters of old nodes.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    7c2c9b0 View commit details
    Browse the repository at this point in the history
  20. Remove database from Mapper

    This commit changes the internals of the mapper to
    track all the changes to peers over its lifetime.
    
    This means that it no longer depends on the database
    and this should hopefully help with locks and timing issues.
    When the mapper is created, it needs the current list of peers,
    the world view, when the polling session was started. Then as
    update changes are called, it tracks the changes and generates
    responses based on its internal list.
    
    As a side, the types.Machines and types.MachinesP, as well as
    types.Machine being passed as a full struct and pointer has been
    changed to always be pointers, everywhere.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    1e74117 View commit details
    Browse the repository at this point in the history
  21. move MapResponse peer logic into function and reuse

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    fdaf9da View commit details
    Browse the repository at this point in the history
  22. give ci more tollerance for timeouts

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    db5864d View commit details
    Browse the repository at this point in the history
  23. Upgrade go and debian in headscale docker

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    df1f4b3 View commit details
    Browse the repository at this point in the history
  24. add lock around saving ts clients

    Closes juanfont#1544
    
    Co-Authored-By: Patrick Huang <[email protected]>
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby and PatrickHuang888 committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    b6d64e1 View commit details
    Browse the repository at this point in the history
  25. gitignore infolder tailscale

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    8882825 View commit details
    Browse the repository at this point in the history
  26. order path

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    4b4b032 View commit details
    Browse the repository at this point in the history
  27. add pprof endpoint

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    db8761f View commit details
    Browse the repository at this point in the history
  28. Remove LastSuccessfulUpdate from Machine

    This field is no longer used, it was used in our old state
    "algorithm" to determine if we should send an update.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    ec39145 View commit details
    Browse the repository at this point in the history
  29. improve debug logging, rw lock for notifier

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    decbeb7 View commit details
    Browse the repository at this point in the history
  30. Return simple responses immediatly

    This commit rearranges the poll handler to immediatly accept
    updates and notify its peers and return, not travel down the
    function for a bit. This reduces the DB calls and other
    holdups that isnt necessary to send a "lite response", a
    map response without peers, or accepting an endpoint update.
    
    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    1f4d51d View commit details
    Browse the repository at this point in the history
  31. handle route updates correctly

    Signed-off-by: Kristoffer Dalby <[email protected]>
    kradalby committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    bc9fc67 View commit details
    Browse the repository at this point in the history