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

Allow multiple node cidr masks in kube-controller-manager #79993

Merged

Conversation

aramase
Copy link
Member

@aramase aramase commented Jul 10, 2019

What type of PR is this?

/kind feature

What this PR does / why we need it:
Currently the default node cidr mask size is /24 for ipv4 and ipv6. Now that ipv6 dual stack feature has been merged, the user should have an option to configure a different mask size for each ip family. If the user doesn't define the mask sizes explicitly, then the default mask size will be /24 for ipv4 and /64 for ipv6.

Related PRs:
#73977
#79386

Changes implemented -

  • Add new flags --node-cidr-mask-size-ipv4 and --node-cidr-mask-size-ipv6 which can be used for dual-stack clusters.
  • Set the default mask size based on CIDR family - /24 for IPv4 and /64 for IPv6

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

kube-controller-manager
--node-cidr-mask-size-ipv4 int32     Default: 24. Mask size for IPv4 node-cidr in dual-stack cluster.
--node-cidr-mask-size-ipv6 int32     Default: 64. Mask size for IPv6 node-cidr in dual-stack cluster.

These 2 flags can be used only for dual-stack clusters. For non dual-stack clusters, continue to use
--node-cidr-mask-size flag to configure the mask size.

The default node cidr mask size for IPv6 was 24 which is now changed to 64.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/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 Jul 10, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @aramase. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. 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 Jul 10, 2019
@aramase aramase changed the title [WIP] Allow multiple node cidr masks in controller-manager [WIP] Allow multiple node cidr masks in kube-controller-manager Jul 10, 2019
@aojea
Copy link
Member

aojea commented Jul 10, 2019

/cc

@k8s-ci-robot k8s-ci-robot requested a review from aojea July 10, 2019 20:41
@neolit123
Copy link
Member

--node-cidr-mask-size string Default: 24 for ipv4 and 98 for ipv6
Mask sizes for node cidr in cluster.

^ probably best to add kube-controller-manager in the release note.

@roycaihw
Copy link
Member

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jul 11, 2019
@roycaihw
Copy link
Member

/sig cloud-provider

@k8s-ci-robot k8s-ci-robot added the sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. label Jul 11, 2019
@aramase aramase force-pushed the controller-manager-multiple-cidr branch from f4b0837 to 41b4ee1 Compare July 18, 2019 00:25
@BenTheElder
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 23, 2019
@aramase aramase force-pushed the controller-manager-multiple-cidr branch from 59221d8 to 5d66338 Compare July 23, 2019 19:07
@aramase
Copy link
Member Author

aramase commented Nov 7, 2019

/retest

1 similar comment
@aramase
Copy link
Member Author

aramase commented Nov 7, 2019

/retest

@aramase
Copy link
Member Author

aramase commented Nov 7, 2019

@thockin @bowei PTAL when you get a chance.

@lachie83
Copy link
Member

/milestone v1.17

@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Nov 14, 2019
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

I am missing documentation on compat and precedence. Will approve, but please follow up ASAP.

Thanks!

/lgtm
/approve

@@ -279,7 +281,9 @@ func TestAddFlags(t *testing.T) {
},
NodeIPAMController: &NodeIPAMControllerOptions{
&nodeipamconfig.NodeIPAMControllerConfiguration{
NodeCIDRMaskSize: 48,
NodeCIDRMaskSize: 48,
Copy link
Member

Choose a reason for hiding this comment

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

We should spec and test what happens when these disagree

@@ -22,6 +22,10 @@ type NodeIPAMControllerConfiguration struct {
ServiceCIDR string
// secondaryServiceCIDR is CIDR Range for Services in cluster. This is used in dual stack clusters. SecondaryServiceCIDR must be of different IP family than ServiceCIDR
SecondaryServiceCIDR string
// NodeCIDRMaskSize is the mask size for node cidr in cluster.
// NodeCIDRMaskSize is the mask size for node cidr in single-stack cluster.
Copy link
Member

Choose a reason for hiding this comment

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

Document how these all interact - are they compatible, mutually exclusive, or does the older form take precedence?

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin I've documented that they are mutually exclusive in the PR description. But will add those as comments in the follow up.

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aramase, thockin

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 Nov 15, 2019
@aramase
Copy link
Member Author

aramase commented Nov 15, 2019

/retest

update tests

add comment

amend var name

update comment

add check for empty slice

fix tests

fix mask size in test

review feedback

add ipv4 and ipv6 flag for mask sizes

add to violation exception list

remove import alias

run update-openapi-spec

review feedback

run update-bazel

review feedback

review feedback
@aramase aramase force-pushed the controller-manager-multiple-cidr branch from 5076264 to 796faba Compare November 15, 2019 04:04
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 15, 2019
@aramase
Copy link
Member Author

aramase commented Nov 15, 2019

@thockin Had to rebase the PR as new unit tests were added in the master to range_allocator_test.go. Can you PTAL and add lgtm again?

@aramase
Copy link
Member Author

aramase commented Nov 15, 2019

/test pull-kubernetes-node-e2e-containerd

1 similar comment
@aramase
Copy link
Member Author

aramase commented Nov 15, 2019

/test pull-kubernetes-node-e2e-containerd

@k8s-ci-robot
Copy link
Contributor

@aramase: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-node-e2e-containerd 796faba link /test pull-kubernetes-node-e2e-containerd

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

I don't see the extra docs I want, but I approved before, so still willing to take a folowup

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2019
@k8s-ci-robot k8s-ci-robot merged commit ded6ee9 into kubernetes:master Nov 15, 2019
@aramase aramase deleted the controller-manager-multiple-cidr branch November 15, 2019 07:23
// getNodeCIDRMaskSizes is a helper function that helps the generate the node cidr mask
// sizes slice based on the cluster cidr slice
func getNodeCIDRMaskSizes(clusterCIDRs []*net.IPNet, maskSizeIPv4, maskSizeIPv6 int) []int {
nodeMaskCIDRs := []int{}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this can be presized to the length of clusterCIDRs

@sftim
Copy link
Contributor

sftim commented Nov 27, 2019

I don't see the extra docs I want, but I approved before, so still willing to take a folowup

@thockin / @aramase Can I help with those extra docs? Is that tracked anywhere?

@aramase
Copy link
Member Author

aramase commented Nov 27, 2019

Thank you for checking @sftim. I've added the comments detailing the changes in a follow up PR which has been merged. The docs PR has already been merged.

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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.