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

kindnetd remove wrong routes #2941

Merged

Conversation

chrischdi
Copy link
Member

This adds logic to kindnetd to remove routes which do not match the expected gateway address for an (Pod)CIDR.

I'm currently working at

Cluster API uses kindnetd as CNI for lots of e2e tests.

As of today, kindnetd only adds new routes and does never delete orphaned routes.

This could lead to the following situation in the workload Cluster created by Cluster API when kindnetd is used as CNI:

  • a new Node joins the cluster which:
    • re-uses a PodCIDR of a deleted node
    • but has a different internal IP address compared to the deleted node
  • All nodes which already had the route via the old node won't get the new route and pod to pod communication is broken

Broken pod to pod communication may include kube-apiserver to webhook communication, which is the case I detected during my tests.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 26, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 26, 2022
@neolit123
Copy link
Member

i was not aware capi uses kindnet for e2e.
node rotation is out of scope for kind, but for kubeadm e2e (also uses kindnet) we wanted to eventually test node addition / removal mainly around stacked etcd sustainability.

in any case, unclear if this is desired.

/cc @aojea

@k8s-ci-robot k8s-ci-robot requested a review from aojea September 26, 2022 13:05
@chrischdi chrischdi force-pushed the pr-kindnetd-iproute-cleanup branch from 81cede9 to 3d1376f Compare September 26, 2022 13:29
@chrischdi chrischdi force-pushed the pr-kindnetd-iproute-cleanup branch from 3d1376f to ab13987 Compare September 26, 2022 14:44
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 26, 2022
@chrischdi
Copy link
Member Author

Thank you very much for your review and guidance @aojea 👍

I also inlined the func again because as you outlined correctly, we can't just do an early return.

@chrischdi chrischdi force-pushed the pr-kindnetd-iproute-cleanup branch from ab13987 to 5f0e3c3 Compare September 26, 2022 15:03
@aojea
Copy link
Contributor

aojea commented Sep 26, 2022

/lgtm
/hold

because we have to build the image to run it in the CI, this code is not being exercised right now on the CI

@BenTheElder can you PTAL

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 26, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2022
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

kind is generally -1 on adding code paths to support things we don't support (a tautology if you will!) but this change is small and seems reasonable and useful for multiple projects in-org.

+1 to antonio's review thus far :-)
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, chrischdi

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 Sep 26, 2022
@chrischdi
Copy link
Member Author

/test pull-kind-e2e-kubernetes-1-23

@BenTheElder
Copy link
Member

/assign
rebasing, bumping kindneted

@BenTheElder BenTheElder force-pushed the pr-kindnetd-iproute-cleanup branch from 5f0e3c3 to eb00dc0 Compare September 27, 2022 19:08
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2022
@BenTheElder
Copy link
Member

OK, all of the prow CI jobs (not github actions) should run with this now.

@aojea
Copy link
Contributor

aojea commented Sep 27, 2022

/lgtm
/hold cancel
Thanks

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Sep 27, 2022
@k8s-ci-robot k8s-ci-robot merged commit d5d1b53 into kubernetes-sigs:main Sep 27, 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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants