Merge pull request #114596 from andrewsykim/cloud-node-ipam

Don't run cloud IPAM controller when cloud provider is not enabled
This commit is contained in:
Kubernetes Prow Robot 2022-12-21 16:33:25 -08:00 committed by GitHub
commit 6e65c98681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -75,6 +75,11 @@ func startNodeIpamController(initContext app.ControllerInitContext, ccmConfig *c
return nil, false, nil
}
// Cannot run cloud ipam controller if cloud provider is nil (--cloud-provider not set or set to 'external')
if cloud == nil && ccmConfig.ComponentConfig.KubeCloudShared.CIDRAllocatorType == string(ipam.CloudAllocatorType) {
return nil, false, errors.New("--cidr-allocator-type is set to 'CloudAllocator' but cloud provider is not configured")
}
// failure: bad cidrs in config
clusterCIDRs, dualStack, err := processCIDRs(ccmConfig.ComponentConfig.KubeCloudShared.ClusterCIDR)
if err != nil {

View File

@ -105,6 +105,11 @@ func startNodeIpamController(ctx context.Context, controllerContext ControllerCo
return nil, false, nil
}
// Cannot run cloud ipam controller if cloud provider is nil (--cloud-provider not set or set to 'external')
if controllerContext.Cloud == nil && controllerContext.ComponentConfig.KubeCloudShared.CIDRAllocatorType == string(ipam.CloudAllocatorType) {
return nil, false, errors.New("--cidr-allocator-type is set to 'CloudAllocator' but cloud provider is not configured")
}
clusterCIDRs, err := validateCIDRs(controllerContext.ComponentConfig.KubeCloudShared.ClusterCIDR)
if err != nil {
return nil, false, err