kubevirt icon indicating copy to clipboard operation
kubevirt copied to clipboard

multus, annotations, Move methods to new package

Open RamLavi opened this issue 2 years ago • 2 comments

What this PR does / why we need it: This PR creates a new package multus under pkg/network. Since network names given in k8s.v1.cni.cncf.io/networks annotation by virt-controller are given by index, and later used by other places in the code, there is a need to keep the naming logic consistent. We do this by moving methods related to multus annotations to a separate package.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #

Special notes for your reviewer:

Release note:

NONE

RamLavi avatar Aug 09 '22 06:08 RamLavi

Thank you for the PR @RamLavi. Is it possible to please make the change gradually over more commits? I personally find the change too big for me to fully understand.

@orelmisan I'ved broken it up

RamLavi avatar Aug 10 '22 10:08 RamLavi

Thank you for the PR @RamLavi. Is it possible to please make the change gradually over more commits? I personally find the change too big for me to fully understand.

@orelmisan I'ved broken it up

Thank you for the change, I find it helpful in reducing the cognitive load.

orelmisan avatar Aug 10 '22 10:08 orelmisan

First commit message:

This commit creates a new Multus package for annotation related methods,
and only moves filterMultusNonDefaultNetworks function to it.

Can you please reason why only this function was moved and not the whole pkg/virt-controller/services/multus_annotations.go file?

The reason it was moved is because it was needed to be used in other places. The other functions there could go into "multus/annotations.go". We should do it in a separate PR, wdyt?

RamLavi avatar Aug 11 '22 10:08 RamLavi

/test pull-kubevirt-e2e-k8s-1.22-sig-network /test pull-kubevirt-e2e-k8s-1.23-sig-network /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 11 '22 11:08 RamLavi

First commit message:

This commit creates a new Multus package for annotation related methods,
and only moves filterMultusNonDefaultNetworks function to it.

Can you please reason why only this function was moved and not the whole pkg/virt-controller/services/multus_annotations.go file?

The reason it was moved is because it was needed to be used in other places. The other functions there could go into "multus/annotations.go". We should do it in a separate PR, wdyt?

I there's no reason to use those funcs from outside the virt-controller template package I see no reason to change their scope or move them around.

maiqueb avatar Aug 11 '22 11:08 maiqueb

/test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-unit-test

RamLavi avatar Aug 11 '22 11:08 RamLavi

@RamLavi what you think about using the VMI spec.device.interfaces names instead of the current scheme (net1, net2 ..)? (by specifying them in the k8s.v1.cni.cncf.io/networks annotation)

ormergi avatar Aug 11 '22 12:08 ormergi

First commit message:

This commit creates a new Multus package for annotation related methods,
and only moves filterMultusNonDefaultNetworks function to it.

Can you please reason why only this function was moved and not the whole pkg/virt-controller/services/multus_annotations.go file?

The reason it was moved is because it was needed to be used in other places. The other functions there could go into "multus/annotations.go". We should do it in a separate PR, wdyt?

I there's no reason to use those funcs from outside the virt-controller template package I see no reason to change their scope or move them around.

But after this change we will have two packages in two different directories with roughly the same subject, thus spreading the logic to more places. As the commit message states: This commit creates a new Multus package for annotation related methods, which is what pkg/virt-controller/services/multus_annotations.go is doing at the moment.

orelmisan avatar Aug 11 '22 12:08 orelmisan

@RamLavi what you think about using the VMI spec.device.interfaces names instead of the current scheme (net1, net2 ..)? (by specifying them in the k8s.v1.cni.cncf.io/networks annotation)

@ormergi AFAIU these names are supposed to be the interface names inside the virt-launcher Pod. IIRC they are limited in length. Besides, I think it is a change that may break backwards compatibility because other code is relying on that scheme.

orelmisan avatar Aug 11 '22 12:08 orelmisan

@ormergi fixed and addressed comments

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 11 '22 12:08 RamLavi

First commit message:

This commit creates a new Multus package for annotation related methods,
and only moves filterMultusNonDefaultNetworks function to it.

Can you please reason why only this function was moved and not the whole pkg/virt-controller/services/multus_annotations.go file?

The reason it was moved is because it was needed to be used in other places. The other functions there could go into "multus/annotations.go". We should do it in a separate PR, wdyt?

I there's no reason to use those funcs from outside the virt-controller template package I see no reason to change their scope or move them around.

But after this change we will have two packages in two different directories with roughly the same subject, thus spreading the logic to more places. As the commit message states: This commit creates a new Multus package for annotation related methods, which is what pkg/virt-controller/services/multus_annotations.go is doing at the moment.

I tend to agree with @orelmisan , just for the sake of keeping things together in the same place. Having said that - again I think this is out of the scope of this PR, so I would suggest we move this suggestion (and it's important discussion over it) to another PR.

RamLavi avatar Aug 11 '22 12:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 11 '22 13:08 RamLavi

@ormergi AFAIU these names are supposed to be the interface names inside the virt-launcher Pod. IIRC they are limited in length.

Correct, the CNI will set the interfaces with these names (net1, net2..), the limitation is actually a limitation of the Linux kernel (15 character max IIRC). I am not saying it won't require a change to Kubevirt admission webhook (on the VMI interfaces length)..

Besides, I think it is a change that may break backwards compatibility because other code is relying on that scheme.

How is it different from introducing any other feature that requires changing more than one component?

ormergi avatar Aug 15 '22 08:08 ormergi

@ormergi AFAIU these names are supposed to be the interface names inside the virt-launcher Pod. IIRC they are limited in length.

Correct, the CNI will set the interfaces with these names (net1, net2..), the limitation is actually a limitation of the Linux kernel (15 character max IIRC). I am not saying it won't require a change to Kubevirt admission webhook (on the VMI interfaces length)..

Besides, I think it is a change that may break backwards compatibility because other code is relying on that scheme.

How is it different from introducing any other feature that requires changing more than one component?

I think it would make things easier, but I don't think it should be done as part of the design. This kind of change deserves a design of its own.

RamLavi avatar Aug 15 '22 11:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 15 '22 16:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 16 '22 07:08 RamLavi

addressed comments here

RamLavi avatar Aug 17 '22 07:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 17 '22 07:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 17 '22 08:08 RamLavi

@ormergi fixed here Thanks! :)

RamLavi avatar Aug 18 '22 06:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 18 '22 06:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 18 '22 06:08 RamLavi

/test pull-kubevirt-unit-test /test pull-kubevirt-generate /test pull-kubevirt-build /test pull-kubevirt-e2e-k8s-1.24-sig-network

RamLavi avatar Aug 18 '22 06:08 RamLavi

@maiqueb fixed here

RamLavi avatar Aug 18 '22 11:08 RamLavi

/retest-required

RamLavi avatar Aug 21 '22 06:08 RamLavi

/approve

AlonaKaplan avatar Aug 21 '22 12:08 AlonaKaplan

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlonaKaplan

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

kubevirt-bot avatar Aug 21 '22 12:08 kubevirt-bot

/hold Let's wait for @maiqueb to say if it's good with him

RamLavi avatar Aug 21 '22 12:08 RamLavi

/retest-required

RamLavi avatar Aug 22 '22 04:08 RamLavi

/unhold

RamLavi avatar Aug 22 '22 07:08 RamLavi

/retest-required

RamLavi avatar Aug 22 '22 12:08 RamLavi

@RamLavi: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-fossa 764ae8d1cacc580f2037ab46d8ce9a4ec2826504 link false /test pull-kubevirt-fossa

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.

kubevirt-bot avatar Aug 22 '22 18:08 kubevirt-bot

/retest-required This bot automatically retries required jobs that failed/flaked on approved PRs. Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

kubevirt-commenter-bot avatar Aug 22 '22 23:08 kubevirt-commenter-bot

/cherry-pick release-0.56

RamLavi avatar Sep 06 '22 06:09 RamLavi

@RamLavi: #8263 failed to apply on top of branch "release-0.56":

Applying: network, vmispec: Move multus network filtering helper
Using index info to reconstruct a base tree...
M	pkg/network/vmispec/network.go
M	pkg/virt-controller/services/BUILD.bazel
Falling back to patching base and 3-way merge...
Auto-merging pkg/virt-controller/services/BUILD.bazel
CONFLICT (content): Merge conflict in pkg/virt-controller/services/BUILD.bazel
Auto-merging pkg/network/vmispec/network.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 network, vmispec: Move multus network filtering helper
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-0.56

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.

kubevirt-bot avatar Sep 06 '22 06:09 kubevirt-bot

failed on release-0.56, but doesn't hurt to try on release-0.55 :)
/cherry-pick release-0.55

RamLavi avatar Sep 06 '22 07:09 RamLavi

@RamLavi: #8263 failed to apply on top of branch "release-0.55":

Applying: network, vmispec: Move multus network filtering helper
Using index info to reconstruct a base tree...
M	pkg/network/vmispec/network.go
M	pkg/virt-controller/services/BUILD.bazel
Falling back to patching base and 3-way merge...
Auto-merging pkg/virt-controller/services/BUILD.bazel
CONFLICT (content): Merge conflict in pkg/virt-controller/services/BUILD.bazel
Auto-merging pkg/network/vmispec/network.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 network, vmispec: Move multus network filtering helper
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

failed on release-0.56, but doesn't hurt to try on release-0.55 :)
/cherry-pick release-0.55

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.

kubevirt-bot avatar Sep 06 '22 07:09 kubevirt-bot