Skip to content

Commit 47b9f3b

Browse files
committed
add tests for cloud_allocator
1 parent 05da19f commit 47b9f3b

File tree

5 files changed

+812
-2
lines changed

5 files changed

+812
-2
lines changed

cloud/linode/nodeipamcontroller.go

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func startNodeIpamController(stopCh <-chan struct{}, cloud cloudprovider.Interfa
6464
return fmt.Errorf("too many clusterCIDRs specified for ipv4, max allowed is %d", maxAllowedNodeCIDRsIPv4)
6565
}
6666

67+
if clusterCIDRs[0].IP.To4() == nil {
68+
return fmt.Errorf("clusterCIDR %s is not ipv4", clusterCIDRs[0].String())
69+
}
70+
6771
/* TODO: uncomment and fix if we want to support service cidr overlap with nodecidr
6872
// service cidr processing
6973
if len(strings.TrimSpace(nodeIPAMConfig.ServiceCIDR)) != 0 {

cloud/linode/nodeipamcontroller_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ func Test_startNodeIpamController(t *testing.T) {
163163
},
164164
wantErr: true,
165165
},
166+
{
167+
name: "ipv6 cidr specified",
168+
args: args{
169+
stopCh: make(<-chan struct{}),
170+
cloud: nil,
171+
nodeInformer: nil,
172+
kubeclient: nil,
173+
allocateNodeCIDRs: true,
174+
clusterCIDR: "fd00::/80",
175+
},
176+
wantErr: true,
177+
},
166178
{
167179
name: "more than one cidr specified",
168180
args: args{

cloud/nodeipam/ipam/cloud_allocator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ func (c *cloudAllocator) Run(ctx context.Context) {
183183

184184
defer c.queue.ShutDown()
185185

186-
logger.Info("Starting range CIDR allocator")
187-
defer logger.Info("Shutting down range CIDR allocator")
186+
logger.Info("Starting linode's cloud CIDR allocator")
187+
defer logger.Info("Shutting down linode's cloud CIDR allocator")
188188

189189
if !cache.WaitForNamedCacheSync("cidrallocator", ctx.Done(), c.nodesSynced) {
190190
return

0 commit comments

Comments
 (0)