Skip node cidr mask size check for cloud allocation.

Unittest added for node_ipan_controller.go.
This commit is contained in:
yankaiz
2018-09-21 13:22:29 -07:00
parent f11ea40ed0
commit e3121c1f81
3 changed files with 124 additions and 2 deletions

View File

@@ -110,8 +110,11 @@ func NewNodeIpamController(
glog.Fatal("Controller: Must specify --cluster-cidr if --allocate-node-cidrs is set")
}
mask := clusterCIDR.Mask
if maskSize, _ := mask.Size(); maskSize > nodeCIDRMaskSize {
glog.Fatal("Controller: Invalid --cluster-cidr, mask size of cluster CIDR must be less than --node-cidr-mask-size")
if allocatorType != ipam.CloudAllocatorType {
// Cloud CIDR allocator does not rely on clusterCIDR or nodeCIDRMaskSize for allocation.
if maskSize, _ := mask.Size(); maskSize > nodeCIDRMaskSize {
glog.Fatal("Controller: Invalid --cluster-cidr, mask size of cluster CIDR must be less than --node-cidr-mask-size")
}
}
ic := &Controller{