-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,12 +24,13 @@ type Device struct { | |
|
|
||
| // ContainerEdits are edits a container runtime must make to the OCI spec to expose the device. | ||
| type ContainerEdits struct { | ||
| Env []string `json:"env,omitempty" yaml:"env,omitempty"` | ||
| DeviceNodes []*DeviceNode `json:"deviceNodes,omitempty" yaml:"deviceNodes,omitempty"` | ||
| Hooks []*Hook `json:"hooks,omitempty" yaml:"hooks,omitempty"` | ||
| Mounts []*Mount `json:"mounts,omitempty" yaml:"mounts,omitempty"` | ||
| IntelRdt *IntelRdt `json:"intelRdt,omitempty" yaml:"intelRdt,omitempty"` // Added in v0.7.0 | ||
| AdditionalGIDs []uint32 `json:"additionalGids,omitempty" yaml:"additionalGids,omitempty"` // Added in v0.7.0 | ||
| Env []string `json:"env,omitempty" yaml:"env,omitempty"` | ||
| DeviceNodes []*DeviceNode `json:"deviceNodes,omitempty" yaml:"deviceNodes,omitempty"` | ||
| NetDevices []*LinuxNetDevice `json:"netDevices,omitempty" yaml:"netDevices,omitempty"` // Added in v1.1.0 | ||
| Hooks []*Hook `json:"hooks,omitempty" yaml:"hooks,omitempty"` | ||
| Mounts []*Mount `json:"mounts,omitempty" yaml:"mounts,omitempty"` | ||
| IntelRdt *IntelRdt `json:"intelRdt,omitempty" yaml:"intelRdt,omitempty"` // Added in v0.7.0 | ||
| AdditionalGIDs []uint32 `json:"additionalGids,omitempty" yaml:"additionalGids,omitempty"` // Added in v0.7.0 | ||
| } | ||
|
|
||
| // DeviceNode represents a device node that needs to be added to the OCI spec. | ||
|
|
@@ -70,3 +71,9 @@ type IntelRdt struct { | |
| Schemata []string `json:"schemata,omitempty" yaml:"schemata,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed the |
||
| EnableMonitoring bool `json:"enableMonitoring,omitempty" yaml:"enableMonitoring,omitempty"` | ||
| } | ||
|
|
||
| // LinuxNetDevice represents an OCI LinuxNetDevice to be added to the OCI Spec. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). |
||
| type LinuxNetDevice struct { | ||
| HostInterfaceName string `json:"hostInterfaceName" yaml:"hostInterfaceName"` | ||
| Name string `json:"name" yaml:"name"` | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ import ( | |
|
|
||
| const ( | ||
| // CurrentVersion is the current version of the Spec. | ||
| CurrentVersion = "1.0.0" | ||
| CurrentVersion = "1.1.0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @marquiz |
||
|
|
||
| // vCurrent is the current version as a semver-comparable type | ||
| vCurrent version = "v" + CurrentVersion | ||
|
|
@@ -150,12 +150,20 @@ func requiresV110(spec *Spec) bool { | |
| } | ||
| } | ||
|
|
||
| if len(spec.ContainerEdits.NetDevices) != 0 { | ||
| return true | ||
| } | ||
|
|
||
| for _, dev := range spec.Devices { | ||
| if i := dev.ContainerEdits.IntelRdt; i != nil { | ||
| if i.Schemata != nil || i.EnableMonitoring { | ||
| return true | ||
| } | ||
| } | ||
|
|
||
| if len(dev.ContainerEdits.NetDevices) != 0 { | ||
| return true | ||
| } | ||
| } | ||
|
|
||
| return false | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.