Conversation
Using string ip causes wrong sorting order and wrong last assigned ip definition. Because in this case ip address 172.19.0.10 is put before 172.19.0.2. And after allocation of 9 addresses, netns always tries to allocate 172.19.0.10 even it is already allocated. Using ping to check if ip is in use helps in this case but leads to race condition when same address can be assigned to different containers. In this case lastip variable is reset instead of ip variable. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
In case of ip overflows subnet address space, "ip" variable should be reset instead of "lastip". Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
In current design last allocated ip is defined as last record in db. But when ip address overflows subnet address space and starts from the begining, last allocated ip will point to last db entry. The patch stores last allocated ip in the dedicated row with key equals "0". Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Iterate through all subnet address space from last allocated ip. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Add skipping non unicast and already assigned to the bridge addresses. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Codecov Report
@@ Coverage Diff @@
## master #5 +/- ##
========================================
- Coverage 2.98% 2.8% -0.18%
========================================
Files 5 5
Lines 335 356 +21
========================================
Hits 10 10
- Misses 324 345 +21
Partials 1 1
Continue to review full report at Codecov.
|
Collaborator
|
wow awesome thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current ipallocator has following issues:
This pull request contains commits which intend to solve above issues.