Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip node cidr mask size check for cloud allocation #68952

Merged
merged 1 commit into from
Oct 17, 2018

Conversation

grayluck
Copy link
Contributor

@grayluck grayluck commented Sep 21, 2018

What this PR does / why we need it:
For IPAM: Do not check if maskSize per node (flag --node-cidr-mask-size) is smaller or equals to cluster cidr (--cluster-cidr), if the secondary ranges are allocated by the cloud.

When allocatorType == CloudAllocatorType, nodeCIDRMaskSize is actually not used in creating CIDR range allocator. See:

// New creates a new CIDR range allocator.
func New(kubeClient clientset.Interface, cloud cloudprovider.Interface, nodeInformer informers.NodeInformer, allocatorType CIDRAllocatorType, clusterCIDR, serviceCIDR *net.IPNet, nodeCIDRMaskSize int) (CIDRAllocator, error) {
nodeList, err := listNodes(kubeClient)
if err != nil {
return nil, err
}
switch allocatorType {
case RangeAllocatorType:
return NewCIDRRangeAllocator(kubeClient, nodeInformer, clusterCIDR, serviceCIDR, nodeCIDRMaskSize, nodeList)
case CloudAllocatorType:
return NewCloudCIDRAllocator(kubeClient, cloud, nodeInformer)
default:
return nil, fmt.Errorf("Invalid CIDR allocator type: %v", allocatorType)
}
}

This check is impeding nodepools from having different pod cidr sizes.

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 21, 2018
@grayluck
Copy link
Contributor Author

/assign @bowei

@grayluck
Copy link
Contributor Author

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Sep 22, 2018
@grayluck
Copy link
Contributor Author

Tested. We can now create ip alias clusters with pod cidr range smaller than /24.
/sig network

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 22, 2018
@grayluck
Copy link
Contributor Author

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 22, 2018
@@ -110,7 +110,7 @@ func NewNodeIpamController(
glog.Fatal("Controller: Must specify --cluster-cidr if --allocate-node-cidrs is set")
}
mask := clusterCIDR.Mask
if maskSize, _ := mask.Size(); maskSize > nodeCIDRMaskSize {
if maskSize, _ := mask.Size(); allocatorType != ipam.CloudAllocatorType && maskSize > nodeCIDRMaskSize {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's clearer reading the code to do this:

if allocatorType != ipam.CloudAllocatorType {
  // Note: CloudAllocatorType does not rely on clusterCIDR or nodeCIDRMaskSize for allocation.
  if maskSize, _ := mask.Size(); maskSize > nodeCIDRMaskSize {
    ... 
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see your updates? Can you put the comment at least.

Copy link
Contributor Author

@grayluck grayluck Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Please take another look. Thx.

@grayluck grayluck force-pushed the node-cidr-size branch 2 times, most recently from 2545a70 to 3c1763d Compare September 24, 2018 19:38
@bowei
Copy link
Member

bowei commented Sep 24, 2018

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 24, 2018
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 2, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 2, 2018
@grayluck
Copy link
Contributor Author

grayluck commented Oct 8, 2018

/retest

Unittest added for node_ipan_controller.go.
@bowei
Copy link
Member

bowei commented Oct 17, 2018

/ok-to-test
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 17, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bowei, grayluck

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2018
@grayluck
Copy link
Contributor Author

Thanks for review, Bowei!

@grayluck
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce-big

@k8s-ci-robot k8s-ci-robot merged commit feb6475 into kubernetes:master Oct 17, 2018
k8s-ci-robot added a commit that referenced this pull request Oct 19, 2018
…52-upstream-release-1.11

Automated cherry pick of #68952: Skip node cidr mask size check for cloud allocation.
k8s-ci-robot added a commit that referenced this pull request Oct 23, 2018
…52-upstream-release-1.12

Automated cherry pick of #68952: Skip node cidr mask size check for cloud allocation.
k8s-ci-robot added a commit that referenced this pull request Nov 1, 2018
…52-upstream-release-1.10

Automated cherry pick of #68952: Skip node cidr mask size check for cloud allocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants