Skip to content

Add NodeIPAM Controller to CCM #247

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

Merged
merged 3 commits into from
Aug 27, 2021
Merged

Conversation

cici37
Copy link
Contributor

@cici37 cici37 commented Jul 13, 2021

This PR is to add NodeIPAM controller into CCM.

Following work:

  • A following PR for NodeIPAM controller configuration switch.
  • Further customize the code regarding with legacycloud

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 13, 2021
@k8s-ci-robot k8s-ci-robot requested review from jpbetz and saad-ali July 13, 2021 21:53
@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Jul 13, 2021
@cici37 cici37 force-pushed the nodeipam branch 2 times, most recently from 18e8ff0 to 52566ce Compare July 14, 2021 22:29
@cici37 cici37 changed the title [WIP]Add NodeIPAM Controller to CCM Add NodeIPAM Controller to CCM Jul 15, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2021
@cici37
Copy link
Contributor Author

cici37 commented Jul 15, 2021

/test cloud-provider-gcp-e2e-full

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 19, 2021
@k8s-ci-robot k8s-ci-robot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. labels Jul 21, 2021
@cici37
Copy link
Contributor Author

cici37 commented Jul 21, 2021

/assign @jpbetz

Copy link
Contributor

@jpbetz jpbetz left a comment

Choose a reason for hiding this comment

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

Generally looks good. A couple details:

Can we split the vendor changes into their commit? Ideally we would have one commit for vendor and another for the code copy, and another for any hand written changes.

Do we need to copy over https://github.com/kubernetes/kubernetes/blob/master/test/integration/ipamperf/ipam_test.go to somewhere appropriate? I don't see any e2e tests that run for nodeIPAM, but let me know if I missed anything. It would be good ensure we're running them in our presubmits for cloud-provider-gcp if there are any.

I suspect we don't need both legacyprovider.go and nolegacyprovider.go. Can we simplify this down? Ideally we'd drop "legacy" from anything we're going to keep long term.

limitations under the License.
*/

package v1alpha1
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're out-of-tree, I'm a bit unclear on what the stability graduation criteria is going to be. But I think keeping this as v1alpha1 makes sense.

@cheftako @bowei feel free to weigh in if you have any thoughts about stability level for the out-of-tree IPAM controller.

Copy link
Member

Choose a reason for hiding this comment

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

I think its probably appropriate for now. Lets get it moved. Then clean it up for our use (If possible), then move it to Beta.

@cici37
Copy link
Contributor Author

cici37 commented Jul 21, 2021

@jpbetz Hi Joe, thank you for your review. Regarding with your suggestion:

  1. I have split the commits based on your suggestion. Please feel free to take a look now.
  2. Currently we don't have the mechanism in cloud-provider-gcp to run integration tests. For the current e2e test, it will run all the available e2e test from k/k so if there is any e2e tests related with NodeIPAM controller, it will not be missed(there might not be e2e test highly related with nodeipam controller).
  3. For current nodeIPAM controller in //pkg/controller/nodeipam, it would be a directly copy over from k/k which will make the review process easier. We sure could customize based on what we need. It could go with the next pr and I will update the following step to reflect.

@jpbetz
Copy link
Contributor

jpbetz commented Jul 21, 2021

/lgtm
Code migration looks good mechanically. I'd like to get a review from someone on networking (@bowei?) to make sure we get everything we need from a networking perspective.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 21, 2021
@cici37
Copy link
Contributor Author

cici37 commented Jul 21, 2021

cc @sdmodi

Copy link

@sdmodi sdmodi left a comment

Choose a reason for hiding this comment

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

It looks like you have copied all of the code under https://github.com/kubernetes/kubernetes/tree/master/pkg/controller/nodeipam except the legacyprovider.go file. I think this is fine. I think it would have been ok to not port over ipam/controller_legacyprovider.go as well.

I am no expert but this looks good to me and it has the code that IPv6 feature needs.

@sdmodi
Copy link

sdmodi commented Jul 23, 2021

/assign @bowei

@cici37
Copy link
Contributor Author

cici37 commented Jul 26, 2021

/assign @cheftako

@cici37
Copy link
Contributor Author

cici37 commented Aug 17, 2021

@bowei Thanks for reviewing. I have updated commit message with source file info(No changes except commit message update). Please have a look when you have time. Thank you

@sdmodi
Copy link

sdmodi commented Aug 19, 2021

Cici, it looks like my patch caused merge conflicts for you. Would you please update this patch. Thanks!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2021
// e.g. remove the cloud-node-lifecycle controller which current cloud provider does not need.
//delete(controllerInitializers, "cloud-node-lifecycle")

// Here is an example to add an controller(NodeIpamController) which will be used by cloud provider
Copy link
Member

Choose a reason for hiding this comment

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

Ditto this is no longer an example, this is actually using said controller.

if len(strings.TrimSpace(nodeIPAMConfig.ServiceCIDR)) != 0 {
_, serviceCIDR, err = net.ParseCIDR(nodeIPAMConfig.ServiceCIDR)
if err != nil {
klog.Warningf("Unsuccessful parsing of service CIDR %v: %v", nodeIPAMConfig.ServiceCIDR, err)
Copy link
Member

Choose a reason for hiding this comment

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

If we can't parse our configuration is starting the right thing to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the current logic KCM starts nodeipam controller. I am not sure if some sort of default values will be used when met parsing issue?

Copy link
Member

Choose a reason for hiding this comment

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

In the interest of getting this in with minimal changes lets go ahead merge with this. However we should probably have at least a tracking bug. My guess is the controller does not do what we want in this case but that having it "start" means that its failing quietly, which is bad.

# See the OWNERS docs at https://go.k8s.io/owners

approvers:
- bowei
Copy link
Member

Choose a reason for hiding this comment

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

Can we get a second approver? Dislike having a SPF.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you have any suggestions on who could be added here? cc @bowei

"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/kube-controller-manager/config/v1alpha1:go_default_library",
Copy link
Member

Choose a reason for hiding this comment

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

Need to work out how to break this dependency.

klog.V(0).Infof("Sending events to api server.")
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")})

gceCloud, ok := cloud.(*gce.Cloud)
Copy link
Member

@cheftako cheftako Aug 22, 2021

Choose a reason for hiding this comment

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

Good for this checkin. Might be interesting to see if we need to keep this in a follow on.

"k8s.io/api/core/v1"
)

// TaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

Is this really a cloud-provider-gcp utility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used when creates a new cloud CIDR allocator here

Copy link
Member

Choose a reason for hiding this comment

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

Not complaining about it being a utility or our using it. My through was this seems like a generic K/K utility for taint detection. There seems to be nothing GCP specific to this code.

@cheftako
Copy link
Member

/lgtm
Couple of minor nits before approval and of course resolve the merge conflict.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 22, 2021
cici37 added 3 commits August 22, 2021 22:42
Copy source code files from k8s.io/kubernetes
Githash:a013c6a2db54c59b78de974b181586723e088246
Repo: https://github.com/kubernetes/kubernetes
Paths: //pkg/controller/nodeipam
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 23, 2021
@sdmodi
Copy link

sdmodi commented Aug 25, 2021

Thanks Cici for the quick turnaround on the comments. Walter, would you please take a look at this. This patch is blocking IPv6 support in GKE. Thanks!

@bowei
Copy link
Member

bowei commented Aug 26, 2021

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2021
@cheftako
Copy link
Member

/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 Aug 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bowei, cheftako, cici37, sdmodi

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 merged commit 5262c7b into kubernetes:master Aug 27, 2021
@cici37 cici37 added the sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. label Sep 15, 2022
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants