openshift / openshift-sdn

Apache License 2.0
69 stars 63 forks source link

Subnet allocation fixes #227

Closed danwinship closed 8 years ago

danwinship commented 8 years ago

Given ClusterNetworkCIDR "10.1.0.0/16" and HostSubnetLength 7, the current git master algorithm would allocate subnets in the order:

and then when you see a pod IP like "10.1.0.130", you have to stop and think to figure out which node it's on. Lame!

This branch fixes it so that the allocation order becomes:

meaning that if you have fewer than 256 nodes, then every node will have a unique 3rd octet, just like with the HostSubnetLength=8 case.

Oh, and then there's also a mostly-unrelated change to registry.go that removes the redundant validation of ClusterNetwork changes so that https://github.com/openshift/origin/pull/6349 will work.

@openshift/networking

danwinship commented 8 years ago

Oh, and then there's also a mostly-unrelated change to registry.go that removes the redundant validation of ClusterNetwork changes so that openshift/origin#6349 will work.

split out into its own PR. Now this is just the subnet numbering fix

danwinship commented 8 years ago

t.Fatalf

fixed

  hostBits uint 

can we make this uint32?

It's not a 32-bit number, it's a number from 1 to 31, so plain uint seems more appropriate. (I renamed it from "capacity" to try to make it clearer that it's "the number of bits in the address that are reserved for the host", but maybe "hostBits" isn't the best name?)

Likewise with leftShift/rightShift.

danwinship commented 8 years ago

@pravisankar can you re-review?

eparis commented 8 years ago

[merge]

eparis commented 8 years ago

wrong tree :)