-
Notifications
You must be signed in to change notification settings - Fork 47
Add support for (Linux) net device injection. #269
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
base: main
Are you sure you want to change the base?
Conversation
658b35b to
9900940
Compare
9900940 to
e95cee0
Compare
|
This PR is stale because it has been open 90 days with no activity. This PR will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label. |
@elezar Not with a tagged version yet, unfortunately.
I think we don't need to wait for this to get merged to tag a new version. We can tag a release without this right away, if everything else has been already merged. But we can't merge #279 yet, for the same reason. |
|
It seems as if the v1.3.0 spec has been tagged. |
Yes, but I think we'll need for opencontainers/runtime-tools#795 (and opencontainers/runtime-tools#797) to get merged. |
65cfa10 to
55029b7
Compare
55029b7 to
fa0e7fd
Compare
|
@klihub lgtm. Do we need to update/add any tests for the new fields? |
fa0e7fd to
0ea4bfd
Compare
9701d09 to
219154a
Compare
@bartosh Added test for injecting and validating net devices. Updated the schema to mark both host and container interface names as required for |
bart0sh
left a comment
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.
/lgtm
142705c to
998d504
Compare
|
Ping @elezar, PTAL. |
998d504 to
a46466e
Compare
specs-go/config.go
Outdated
|
|
||
| // LinuxNetDevice represents an OCI LinuxNetDevice to be added to the OCI Spec. | ||
| type LinuxNetDevice struct { | ||
| HostIf string `json:"hostIf" yaml:"hostIf"` |
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.
Question: Since HostIf is the field that we define, is it descriptive enough? In the OCI runtime spec we have:
// NetDevices are key-value pairs, keyed by network device name on the host, moved to the container's network namespace.
NetDevices map[string]LinuxNetDevice `json:"netDevices,omitempty"`
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.
Yeah, I don't know what would be descriptive enough. I deliberately chose a struct with two fields instead of a map, in the hope of better descriptiveness, because now I have a name for both parameters compared to a string-keyed map.
So maybe a HostInterface and ContainerInterface would be better (would not like to call them devices, because of all the unices it is exactly linux which does not model network devices as unix devices) ? @elezar @bart0sh WDYT ?
Or HostInterface and Name. I only ended up with Name to have it be called the same as the corresponding OCI Spec data. Although now that you spelled this out, I'm not sure if it helps or hurts more...
I was also considering HostInterface/ContainerName and HostName/ContainerName, but I disliked both HostName and ContainerName as they can sound a misleading, at least when out of 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.
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 think Name is fine since this is the corresponding OCI Spec field name. (we do the same for DeviceNode.Path)
What about HostInterfaceName and Name? (I would suggest HostName, but that could also be more confusing).
As a follow-up question: Do we want to allow HostIf == "" and use the value for Name in this case, or are these expected to always be different?
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 think
Nameis fine since this is the corresponding OCI Spec field name. (we do the same forDeviceNode.Path)What about
HostInterfaceNameandName? (I would suggestHostName, but that could also be more confusing).
Okay, I'll update it accordingly.
As a follow-up question: Do we want to allow
HostIf == ""and use the value forNamein this case, or are these expected to always be different?
I don't think there is any expectation regarding those except that they are not empty. I'd probably would not allow HostInterfaceName to be empty. Allowing the other way around (the container interace) Name to be empty and set to the same as HostInterface) would sound intuitively more natural to me, but I would not allow that either.
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.
On inferring information. Let's make them both required in the spec. This makes reasoning about the implementation quite a bit simpler.
2112626 to
7416131
Compare
Signed-off-by: Krisztian Litkey <[email protected]>
Implement OCI Spec (Linux) NetDevice injection. Signed-off-by: Krisztian Litkey <[email protected]>
Bump current version to 1.1.0, include net devices in minimum required version check. Signed-off-by: Krisztian Litkey <[email protected]>
Signed-off-by: Krisztian Litkey <[email protected]>
7d96b13 to
b297834
Compare
| const ( | ||
| // CurrentVersion is the current version of the Spec. | ||
| CurrentVersion = "1.0.0" | ||
| CurrentVersion = "1.1.0" |
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 think we may have missed this for the new / updated RDT fields too, but we should probably have a SPEC.md change as well.
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.
cc @marquiz
| EnableMonitoring bool `json:"enableMonitoring,omitempty" yaml:"enableMonitoring,omitempty"` | ||
| } | ||
|
|
||
| // LinuxNetDevice represents an OCI LinuxNetDevice to be added to the OCI Spec. |
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.
Do we need to add a docstring that describes what the two fields are? (I'm ok to not do so if we feel these are self-explanatory).
| ClosID string `json:"closID,omitempty" yaml:"closID,omitempty"` | ||
| L3CacheSchema string `json:"l3CacheSchema,omitempty" yaml:"l3CacheSchema,omitempty"` | ||
| MemBwSchema string `json:"memBwSchema,omitempty" yaml:"memBwSchema,omitempty"` | ||
| Schemata []string `json:"schemata,omitempty" yaml:"schemata,omitempty"` |
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.
Missed the //added in v1.1.0 suffis to the new fields here: cc @marquiz
elezar
left a comment
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.
@klihub this looks good now.
Some minor questions regarding whether this should include edits to SPEC.md, but I am approving this provisionally.
Note: This PR is stacked on #294.
This PR adds support for injecting Linux NetDevices to an OCI Spec. In particular, the PR
NetDevicestoContainerEditsin the CDI Spec1.1.0cmd/cditest/cli binary