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

libnetwork/ipamutils: various cleanups and refactor #42509

Closed
wants to merge 5 commits into from

Conversation

thaJeztah
Copy link
Member

Migrated from moby/libnetwork#2593
closes moby/libnetwork#2593

Created using:

curl -fsSL https://patch-diff.githubusercontent.com/raw/moby/libnetwork/pull/2593.patch | git am --3way -S --directory=libnetwork
  • ipamutils: use RWMutex to allow concurrent reads
  • ipamutils: reformat for readability, and improve godoc
  • ipamutils: un-export global variables, and use accessors instead
    The GetLocalScopeDefaultNetworks() and GetGlobalScopeDefaultNetworks() protect these variables with a lock, but various parts in the code were directly accessing the variables without locks.
  • ipamutils: generate default pools on first use, instead of init()
    This package defines the NetworkToSplit type. Curently importing the package also initializes the default address pools (which may not be needed, e.g., when used in the client.
    This patch changes initialization to happen on first use, instead of init(), to allow the package to be imported without initializing these pools.

@thaJeztah thaJeztah added status/2-code-review area/networking kind/refactor PR's that refactor, or clean-up code labels Jun 10, 2021
@thaJeztah thaJeztah marked this pull request as draft June 10, 2021 15:03
@thaJeztah thaJeztah marked this pull request as ready for review June 16, 2021 17:05
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The `GetLocalScopeDefaultNetworks()` and `GetGlobalScopeDefaultNetworks()`
protect these variables with a lock, but various parts in the code
were directly accessing the variables without locks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This package defines the `NetworkToSplit` type. Curently importing
the package also initializes the default address pools (which may
not be needed, e.g., when used in the client.

This patch changes initialization to happen on first use, instead
of `init()`, to allow the package to be imported without initializing
these pools.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@corhere
Copy link
Contributor

corhere commented Mar 31, 2023

@corhere corhere closed this Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants