Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

virtcontainers: Rely on new interface LinkType field#867

Merged
sboeuf merged 4 commits intokata-containers:masterfrom
sboeuf:iface_type
Nov 5, 2018
Merged

virtcontainers: Rely on new interface LinkType field#867
sboeuf merged 4 commits intokata-containers:masterfrom
sboeuf:iface_type

Conversation

@sboeuf
Copy link
Copy Markdown

@sboeuf sboeuf commented Oct 29, 2018

The logic wants that virtcontainers should be the place where the common packages should be defined. This pull request takes care of defining generic network structures into a new package pkg/types/types.go, which is basically a duplication of what is defined by the agent. But this allows virtcontainers and its consumers (kata-runtime, kata-netmon, kata-containerd-shim) to be independent from the agent.

Based on the new package that define a new field LinkType for the structure Interface, Kata does not need anymore to do any assumption about the type of interface that needs to be added.

Fixes #866
Fixes #876

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Oct 29, 2018

/test

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Oct 29, 2018

/test

@bergwolf
Copy link
Copy Markdown
Member

@sboeuf As I commented here, I think the runtime should define its own types if it needs additional field that is not related to agent grpc.

@sboeuf sboeuf changed the title virtcontainers: Rely on new interface Type field virtcontainers: Rely on new interface LinkType field Oct 31, 2018
@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Oct 31, 2018

/test

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Oct 31, 2018

@bergwolf I have modified this PR according to our discussion here.
Please let me know what you think about it!

@bergwolf
Copy link
Copy Markdown
Member

bergwolf commented Nov 1, 2018

LGTM! Thanks @sboeuf !

Approved with PullApprove

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 1, 2018

@amshinde @jodh-intel PTAL

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 1, 2018

/test

Gateway string `json:"gateway,omitempty"`
Device string `json:"device,omitempty"`
Source string `json:"source,omitempty"`
Scope uint32 `json:"scope,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can remove all json tags "json:"scope,omitempty"" because these types in this file will never be marshaled to json format, agent/pkg/types is the json format data.

So I think it's better to remove these json tags incase it gives code reader wrong hints that it's the json protocol filed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure I'll remove those!

@WeiZhang555
Copy link
Copy Markdown
Member

One comment, other parts LGTM.

I love the new package virtcontainers/pkg/types and convert functions! Thanks for doing this!

Sebastien Boeuf added 4 commits November 2, 2018 08:46
Instead of relying on the kata agent to define generic structures,
the logic is to define those as virtcontainers "types" package.
This way, all consumers of those structures, such as kata-runtime,
kata-netmon, and kata-containerd-shim, don't have to import some
dependency from the kata-agent.

Fixes kata-containers#876

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit replaces every place where the "types" package from the
Kata agent was used, with the new "types" package from virtcontainers.

In order to do so, it introduces a few translation functions between
the agent and virtcontainers types, since this is needed by the kata
agent implementation.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
In order to provide the right information about the interface that
needs to be added, kata-netmon provisions the new field LinkType of
the Interface structure.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Now that Interface structure includes the useful information about
the type of interface, Kata does not need to do any assumption about
the type of interface that needs to be added.

Fixes kata-containers#866

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 2, 2018

/test

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 2, 2018

@WeiZhang555 changes applied :)

@WeiZhang555
Copy link
Copy Markdown
Member

WeiZhang555 commented Nov 3, 2018

LGTM

Ubuntu machine is out of service, needs retrigger

Approved with PullApprove

Copy link
Copy Markdown
Member

@caoruidong caoruidong left a comment

Choose a reason for hiding this comment

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

LGTM!

@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 5, 2018

The metrics CI is down here. Let's move forward and merge this PR as it got 3 approvals already.

@sboeuf sboeuf merged commit abfc61b into kata-containers:master Nov 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants