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

check version incompatibility #762

Merged
merged 3 commits into from
Feb 28, 2022
Merged

Conversation

bn222
Copy link
Contributor

@bn222 bn222 commented Nov 19, 2021

When nested CNI version is 0.3.1 or less while the top level CNI version
is 0.4.0, error out. Version 0.3.1 or less doesn't support the CHECK
command. This closes issue #737.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1481899134

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 70.885%

Totals Coverage Status
Change from base Build 1480949645: 0.0%
Covered Lines: 1322
Relevant Lines: 1865

💛 - Coveralls

@coveralls
Copy link

coveralls commented Nov 19, 2021

Coverage Status

Changes unknown
when pulling 5b51db5 on bn222:master
into ** on k8snetworkplumbingwg:master**.

@dougbtv
Copy link
Member

dougbtv commented Nov 19, 2021

Hey @bn222 ! Thanks for the contribution.

We'll also need to take care of this in the next generation configuration generation, which can be found approximately here:

https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/cmd/controller/main.go
https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/cmd/config-generation/kubeconfig.go

@bn222
Copy link
Contributor Author

bn222 commented Nov 22, 2021

Hi @dougbtv, I'm not sure what I should change in the two files you mention. I guess you might actually mean the following file:

https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/pkg/config/generator.go#L37

I could enforce checking that the delegate configurations are using a compatible CNI version, although that would require me to change the type of Delegates in MultusConf if we want to avoid converting to json and checking the cni version in json.

Let me know what you think!

@dougbtv
Copy link
Member

dougbtv commented Dec 1, 2021

Hey Balazs, what I mean is that we have two methods for entrypoint as we're in a transition (which will be superceded by the go code, making the bash script obsolete)

So, in two different modes, either the bash runs, or the go runs (the files I linked)

Meaning that you'll have to implement the equivalent logic in the the go code as well as the bash 👍

@bn222 bn222 force-pushed the master branch 2 times, most recently from 65c153a to 69d8dd7 Compare December 14, 2021 16:58
@bn222
Copy link
Contributor Author

bn222 commented Dec 14, 2021

@dougbtv afaict, this covers the code path that goes through the thick plugin. Let me know if more paths need patching.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 14, 2021

This pull request introduces 1 alert when merging 69d8dd7 into 4d9731b - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@bn222 bn222 force-pushed the master branch 2 times, most recently from 038c6f8 to e5ac226 Compare December 15, 2021 10:17
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Other than the comments I'm providing in the code, I can't help to notice that the new functionality is not being unit tested; you'll have to provide these tests as well.

I also disagree with your choice of where to implement this: I think it should be done in the configuration generator constructor, not in its generate method.

pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
@bn222 bn222 force-pushed the master branch 3 times, most recently from c210048 to 895905b Compare January 4, 2022 16:34
@bn222 bn222 changed the title multus: disallow using cni version <= 0.3.1 with >= 0.4.0 on top level check version incompatibility Jan 4, 2022
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

It feels a bit weird to not check the error on newMultusConfigWithDelegates now that it can return one.

Unfortunately, I don't have a good alternative to doing that: either check it on the test's body, or introduce another helper for it.

Pretty much everything else is opinionated.

cmd/controller/main.go Outdated Show resolved Hide resolved
cmd/controller/main.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Outdated Show resolved Hide resolved
pkg/config/generator.go Show resolved Hide resolved
pkg/config/generator_test.go Outdated Show resolved Hide resolved
pkg/config/generator_test.go Outdated Show resolved Hide resolved
pkg/config/generator_test.go Outdated Show resolved Hide resolved
bn222 added 3 commits January 13, 2022 11:02
When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue k8snetworkplumbingwg#737.

Signed-off-by: Balazs Nemeth <[email protected]>
Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Thanks for the patience, and for the patch.

@dougbtv I've only reviewed the golang related code.

@s1061123
Copy link
Member

It looks good to me. Apologize that the PR takes a very long time. Let me merge into master. Thank you so much!

@s1061123 s1061123 merged commit 450e1d3 into k8snetworkplumbingwg:master Feb 28, 2022
s1061123 pushed a commit to s1061123/multus-cni that referenced this pull request Feb 28, 2022
* multus: entrypoint: disallow incompatible cni versions

When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue k8snetworkplumbingwg#737.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: thick: disallow incompatible cni versions

Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: add unit test for incompatible cni versions

Signed-off-by: Balazs Nemeth <[email protected]>
s1061123 added a commit that referenced this pull request Feb 28, 2022
* multus: entrypoint: disallow incompatible cni versions

When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue #737.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: thick: disallow incompatible cni versions

Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: add unit test for incompatible cni versions

Signed-off-by: Balazs Nemeth <[email protected]>

Co-authored-by: Balazs Nemeth <[email protected]>
s1061123 added a commit that referenced this pull request Apr 5, 2022
* multus: entrypoint: disallow incompatible cni versions

When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue #737.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: thick: disallow incompatible cni versions

Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: add unit test for incompatible cni versions

Signed-off-by: Balazs Nemeth <[email protected]>

Co-authored-by: Balazs Nemeth <[email protected]>
cruizen pushed a commit to platform9/multus-cni that referenced this pull request Apr 11, 2024
* multus: entrypoint: disallow incompatible cni versions

When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue k8snetworkplumbingwg#737.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: thick: disallow incompatible cni versions

Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: add unit test for incompatible cni versions

Signed-off-by: Balazs Nemeth <[email protected]>
cruizen pushed a commit to platform9/multus-cni that referenced this pull request Apr 11, 2024
…lumbingwg#798)

* multus: entrypoint: disallow incompatible cni versions

When top level CNI version is 0.4.0 or more, nested CNI version
can't be less than 0.4.0 since these are incompatible. This
closes issue k8snetworkplumbingwg#737.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: thick: disallow incompatible cni versions

Similarly to disallowing incompatible versions in entrypoint.sh,
add the same logic in go for the thick plugin.

Signed-off-by: Balazs Nemeth <[email protected]>

* multus: add unit test for incompatible cni versions

Signed-off-by: Balazs Nemeth <[email protected]>

Co-authored-by: Balazs Nemeth <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants