-
Notifications
You must be signed in to change notification settings - Fork 374
Network interface removal and decoupling #1181
Network interface removal and decoupling #1181
Conversation
28dffb0
to
0725738
Compare
There's only one real implementer of the network interface and no real need to implement anything else. We can just go ahead and remove this abstraction. Fixes: kata-containers#1179 Signed-off-by: Samuel Ortiz <[email protected]>
In order to fix kata-containers#1059, we want to create a hypervisor package. Some of the hypervisor implementations (qemu) depend on the network and endpoint interfaces. We can not have a virtcontainers -> hypervisor -> network, endpoint -> virtcontainers cyclic dependency. So before creating the hypervisor package, we need to decouple the network API from the virtcontainers one. Fixes: kata-containers#1180 Signed-off-by: Samuel Ortiz <[email protected]>
0725738
to
18dcd2c
Compare
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sameo I'm not against the removal of the Go interface since, as you mentioned it, we're only using one single implementation. But I'm concerned about the unit tests, because the noop implementation is pretty convenient to test a bunch of code that would be complex to test if we had to mimic the real network behavior. WDYT?
FWIW all the unit tests are passing with the default network implementation. When first thinking about doing this I thought they will all fail but they don't. I get CI errors here but there not UT related. |
@sboeuf @mcastelino b39cb1d#diff-bca2c2b5b04e0e74533b492fd23a3cc8R784 is what makes several unit tests pass with this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sameo just a couple of questions. LGTM otherwise.
type Network struct { | ||
} | ||
|
||
func (n *Network) trace(ctx context.Context, name string) (opentracing.Span, context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sameo This is code moved mostly unmodified from virtcontainers/default_network.go?
Were there any changes needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No functional changes, no.
@@ -206,7 +205,7 @@ type Sandbox struct { | |||
hypervisor hypervisor | |||
agent agent | |||
storage resourceStorage | |||
network network | |||
network Network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sameo why did this need to be made public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm preparing for moving the network code into its own package.
@sameo Change looks good overall, its just the noop implementation has been useful in mocking our network behaviour in unit tests. |
noop is useful for sure, but:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough :)
LGTM
@sameo If thats the case |
/retest |
/retest |
@chavafg which of those CI results can be ignored? |
@sboeuf here it is the page where it says the |
thanks @GabyCT |
This PR does 2 things: