Skip to content

Commit

Permalink
formula to choose ip allocation sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
aojea committed Dec 22, 2021
1 parent 6debbd4 commit 9009c87
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions keps/sig-network/3070-reserved-service-ip-range/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,28 +207,31 @@ func (rss randomScanStrategy) AllocateBit(allocated *big.Int, max, count int) (i
### Proposed Services ClusterIPs allocation model
The proposal is to implement a new strategy on the Service IP allocation bitmap that logically subdivide the range
in two bands based on a predefined percentage of the whole range (15%):
in two bands based on the following formula `min(max($min, cidrSize/$step), $max)`, described as ~never less than $min or more than $max, with a graduated step function between them~, with $min = 16, $max = 256 and $step = 16.
- lower band, used preferably for static ip assignment.
- upper band, used preferably for dynamic IP assignment.
Dynamically IP assignment will use the upper band, once this has been exhausted it will use the
Dynamically IP assignment will use the upper band by default, once this has been exhausted it will use the
lower range. This will allow users to define static allocations on the lower band of the predefined
range with a low risk of collision, keeping the implementation backwards compatible.
Example:
- Service IP CIDR: 192.168.0.0/16
- Range Size: 2^16 = 65536
- Band Offset: min(max(16,65536/16),256) = min(4096,256) = 256
- Static band start: 192.168.0.1
- Static band ends: 192.168.1.1
┌─────────────┬─────────────────────────────────────────────┐
│ │ │
│ │ │
│ │ │
│ static │ dynamic │
│ │ │
│ │ │
│ │ │
└─────────────┴─────────────────────────────────────────────┘
◄────────────► ◄────────────────────────────────────────────►
15% 85%
192.168.0.1 192.168.1.1 192.168.255.254
```go
// randomScanReservedStrategy choose a random address from the provided big.Int and then scans
Expand Down

0 comments on commit 9009c87

Please sign in to comment.