Comments (6)
Sorry, somehow missed this one. Sounds reasonable, go for it!
from cluster-api-ipam-provider-in-cluster.
The allocation behaviour is fixed now.
from cluster-api-ipam-provider-in-cluster.
FYI - We've found an environment where we can obtain blocks of contiguous IPs, so we're delaying our work on this. We'd still like to contribute it, but it has fallen in priority for us.
from cluster-api-ipam-provider-in-cluster.
If this feature request is reasonable/acceptable to the powers that be, we would like to contribute the implementation.
Is more discussion needed?
from cluster-api-ipam-provider-in-cluster.
Hi @schrej, we think we found an inconsistency in the behavior of First and Last.
Suppose the pool spec were to look something like this:
spec:
prefix: 24
subnet: 10.0.0.0/24
First and Last would be defaulted to 10.0.0.1 and 10.0.0.254.
The FindFreeAddress function calls .Next() on the first IP in the range and the first ip provided would be 10.0.0.2. This seems good, the gateway is typically the 10.0.0.1.
Side note: it could be another address in the range. (citation needed)
The last address (10.0.0.254) would never be provided because the guard prevents the last address from being provided. We assume the intention was not to provide the 255 address, but we aren't sure.
Next lets consider when the user specifies First and Last:
spec:
prefix: 24
subnet: 10.0.0.0/24
first: 10.0.0.10
last: 10.0.0.15
First and last would not be defaulted and would stay as specified.
The FindFreeAddress() function would first try First.Next() resulting 10.0.0.11. The code would never return 10.0.0.15 because of the guard that prevents the last address from being provided.
We propose that we change the logic so that the First and Last be provided. The only exceptions being that First or Last was the network address (10.0.0.0), the gateway address (10.0.0.1 or whatever was provided), or the broadcast address (10.0.0.255). This would be a significant change in the behavior, so we'd like to hear if you think this would be problematic. Hopefully that makes sense.
from cluster-api-ipam-provider-in-cluster.
Calling First.Next()
in FindFreeAddress
is just a implementation mistake. I think I didn't have first and last in the beginning and was just using the Subnet, which would be Subnet().From().Next()
in that function, which would be correct if you want to skip the network address. It should also hand out the To
Address, so that's a mistake as well. Not sure how to handle this properly though. Maybe we can just add a check there to see if To is used. Otherwise we need to compare whether we've passed To
, and the complexity for that might not be worth it just to have a cleaner loop.
The gateway isn't handed out already, since it's part of the existing
IPSet
that's passed to FindFreeAddress
.
In summary: First and Last should always be used. Gateway should be excluded. If the user messes up and sets the network address as First, that's on them, same for broadcast. If the user just sets a subnet, defaulting takes care of excluding the first and last address of that subnet.
from cluster-api-ipam-provider-in-cluster.
Related Issues (20)
- Addressing downscaling pools with addresses in range HOT 6
- IPAddressClaim controller should detect cluster paused consistently HOT 1
- clusterctl move fails because of delete webhook
- Claims with cluster label should not be reconciled when cluster cannot be retrieved
- Adopt the CNCF CLA bot, merge bot and Kubernetes PR commands/bots.
- Controller shouldn't allocate IP addresses that are "reserved" for the subnet HOT 4
- Gateway should be validated to be within inferred subnet when pool is IPv4 HOT 4
- The provider configuration to add to clusterctl.yaml is wrong HOT 1
- :bug: GlobalInClusterIPPool does not guarantee the unique IP across multiple k8s namespaces HOT 1
- Misconfigured webhooks with the new api version HOT 3
- Claims that are stuck waiting for an address when a pool has no free addresses should be re-reconciled when addresses become available HOT 3
- Handle reserved Ips withing an IP range HOT 8
- clusterctl move fails due to IPAddresses Exists HOT 4
- clusterctl init fails if wrong version of cert-manager is already installed HOT 2
- in a "clusterctl move" the IPAM resources are not migrated to the new cluster HOT 3
- unknown field "spec.excludedAddresses" HOT 6
- ipam provider does not support capi v1.6.0 HOT 2
- Any plan to cut a v0.1.0 release? HOT 4
- Add support for IPAddressClaim spec.clusterName once CAPI 1.8 is released HOT 1
- Clusterctl move not moving globalinclusterippools
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cluster-api-ipam-provider-in-cluster.