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

add CNI config validation to getDefaultCNINetwork #80482

Merged
merged 1 commit into from Aug 19, 2019

Conversation

mars1024
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

If we use a CNI config file contains plugins ptp and bandwidth, just like

{
  "cniVersion": "0.3.1",
  "name": "mynet",
  "plugins": [
    {
      "type": "ptp",
      "ipam": {
          "type": "host-local",
          "subnet": "10.0.0.0/24"
      }
    },
    {
      "name": "slowdown",
      "type": "bandwidth",
      "capabilities": {
      	"bandwidth": true
      }
    }
  ]
}

and bandwidth plugin is not on disk.

cniNetworkPlugin.SetUpPod will fail because we can't find bandwidth plugin, then cniNetworkPlugin.TearDownPod will be called to recycle container network, we all know plugins are called in reverse order in CNI DEL, so teardown will fail in calling bandwidth plugin without calling ptp plugin, so CNI DEL of ptp plugin is actually not done for container, this leads to some problems, one of these is IP leak.

So I use CNI validation to check the presence of plugins before setup/teardown pods, which can prevent the happening above.

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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 23, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @mars1024. 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/kubelet sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 23, 2019
@dcbw
Copy link
Member

dcbw commented Jul 23, 2019

/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
@dcbw
Copy link
Member

dcbw commented Jul 23, 2019

@squeed

@yue9944882
Copy link
Member

/retest

@squeed
Copy link
Contributor

squeed commented Jul 25, 2019

By the way, thanks a lot for implementing this. I wrote ValidatePluginList() with the intention of adding it to dockershim, then never had time to do it. I'm really glad you did :-).

@mars1024
Copy link
Member Author

By the way, thanks a lot for implementing this. I wrote ValidatePluginList() with the intention of adding it to dockershim, then never had time to do it. I'm really glad you did :-).

My pleasure :), and thanks for your contributions in libcni.

@mars1024 mars1024 changed the title add validation to SetUp/TearDown pod in cniNetworkPlugin add CNI config validation to getDefaultCNINetwork in cniNetworkPlugin Jul 25, 2019
@mars1024 mars1024 changed the title add CNI config validation to getDefaultCNINetwork in cniNetworkPlugin add CNI config validation to getDefaultCNINetwork Jul 25, 2019
@mars1024
Copy link
Member Author

/retest

@mars1024
Copy link
Member Author

Updated! PTAL, thanks ! @dcbw @rramkumar1 cc @squeed

@squeed
Copy link
Contributor

squeed commented Jul 26, 2019

/lgtm

@mars1024
Copy link
Member Author

/assign @dcbw

@mars1024
Copy link
Member Author

mars1024 commented Aug 1, 2019

@dcbw @freehan Do you have time to promote this PR? Thanks

@zuoxiu-antfinancial
Copy link

/retest

@mars1024
Copy link
Member Author

mars1024 commented Aug 8, 2019

@dcbw @freehan Any suggestions or approves? Looking forward to your reply ~

1. add validation for CNI config before loading
2. make some CNI capabilities constants
3. add Capabilities field to cniNetwork struct

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 9, 2019
@mars1024
Copy link
Member Author

mars1024 commented Aug 9, 2019

@squeed Squash make label lgtm removed, could you do me a favor to add it back ? No code changes expect a commits squash.

@squeed
Copy link
Contributor

squeed commented Aug 9, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 9, 2019
@mars1024
Copy link
Member Author

mars1024 commented Aug 9, 2019

/retest

@mars1024
Copy link
Member Author

@dcbw @freehan @thockin Could you help to approve this PR?

@mars1024
Copy link
Member Author

/assign @thockin

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.

Thanks!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mars1024, 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 Aug 19, 2019
@k8s-ci-robot k8s-ci-robot merged commit 29c87cb into kubernetes:master Aug 19, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 19, 2019
benmoss pushed a commit to benmoss/kubo-release-windows that referenced this pull request Aug 20, 2019
It's now required due to
kubernetes/kubernetes#80482 adding CNI
validation to the kubelet

Signed-off-by: Ben Moss <bmoss@pivotal.io>
benmoss pushed a commit to benmoss/kubo-release-windows that referenced this pull request Sep 17, 2019
 It's now required due to
 kubernetes/kubernetes#80482 adding CNI
 validation to the kubelet

Signed-off-by: Ben Moss <bmoss@pivotal.io>
benmoss pushed a commit to benmoss/kubo-release-windows that referenced this pull request Sep 17, 2019
 It's now required due to
 kubernetes/kubernetes#80482 adding CNI
 validation to the kubelet

Signed-off-by: Ben Moss <bmoss@pivotal.io>
mikkeloscar added a commit to zalando-incubator/kubernetes-on-aws that referenced this pull request Dec 16, 2019
Switches to use the newer `conflist` cni configuration. This is required
because Kubernetes v1.16.0 introduces config validation:
kubernetes/kubernetes#80482 which is no longer
able to validate the old configuration. The behavior is the same with
the new configuration.

Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
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/kubelet 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. 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-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants