Implement device-info-spec in app-netutil#24
Conversation
|
/hold Need to get k8snetworkplumbingwg/network-attachment-definition-client#30 merged first. |
6360b08 to
6fd56fa
Compare
|
/hold cancel |
zshi-redhat
left a comment
There was a problem hiding this comment.
Billy, I added a few comments to see if I understand the logic correctly.
| glog.Infof("%s is the \"default\" interface, mark as \"%s\"", | ||
| ifaceData.NetworkStatus.Interface, ifaceData.DeviceType) | ||
| } else if pciIndex < len(pciAddressSlice) { | ||
| if ifaceData.NetworkStatus.DeviceInfo == nil { |
There was a problem hiding this comment.
If it's a device set in PCIDEVICE_ env var, but DeviceInfo doesn't exist, mark it as SR-IOV type
There was a problem hiding this comment.
Yes, because I think only SR-IOV is using that env var. This would be the case where a newer app-netutil is running with older SR-IOV DP and older Multus.
| ifaceData.NetworkStatus.Interface, ifaceData.DeviceType) | ||
| } else { | ||
| glog.Warningf("More SR-IOV interfaces detected than PCI addresses - %s", interfaceData.IfName) | ||
| glog.Warningf("%s was \"unknown\", but DeviceInfo exists with type \"%s\"", |
There was a problem hiding this comment.
If it's a device set in PCIDEVICE_ env var, but doesn't match with DeviceInfo PCI address, leave the device type as unknown.
There was a problem hiding this comment.
This should not happen. It's really the case where the type is "unknown", but DeviceInfo struct was created. This is for debugging to catch invalid config or errors in the code where the NetworkStatus annotation was parsed.
| ifaceData.NetworkStatus.Interface, ifaceData.NetworkStatus.DeviceInfo.Type) | ||
| } | ||
| } else { | ||
| ifaceData.DeviceType = types.INTERFACE_TYPE_HOST |
There was a problem hiding this comment.
If device doesn't exist in PCIDEVICE_ && device doesn't have a deviceInfo, mark it as a HOST type device.
There was a problem hiding this comment.
Yes. We don't know what it is. I guess we could leave as unknown and let the consumer of the API decide?
|
|
||
| // PCI Address found that did not match an existing interface in the | ||
| // NetworkStatus annotation so add to list. | ||
| if pciIndex < len(pciAddressSlice) { |
There was a problem hiding this comment.
If a device set in PCIDEVICE_ env var, but still has unknown type, mark it as SR-IOV type.
There was a problem hiding this comment.
There are PCI Addresses in the PCIDEVICE_ env var but no associated NetworkStatus annotation. The only time I hit this was working a POC that wasn't using Multus.
| glog.Infof("RESPONSE:") | ||
| for _, interfaceData := range response.Interface { | ||
| glog.Infof("%v", interfaceData) | ||
| for _, ifaceData := range response.Interface { |
There was a problem hiding this comment.
I think there might still be devices that have empty type at this point, right? it would be the device that has a deviceInfo but DeviceInfo.Type is not configured.
There was a problem hiding this comment.
Yes, what should I do with those? Invalid config.
There was a problem hiding this comment.
nothing need to change, I just make sure understand it correctly.
|
btw, is there any device plugin patch required to make this work? |
|
Move repository to point to the latest network-attachment-definition-client. This required an update to userspace-cni-network-plugin, so also move to latest version of that repository as well. Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
The multusplugin pkg was used to pull in the NetworkStatus map from the multus-cni code base and parse the NetworkStatus annotation. Turns out that map was outdated and the map that was being pushed in annotations was from the network-attachment-definition-client library. So moved to pull from there and remove references to Multus. Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Multus deprecated networks-status annotation in favor of network-status. Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
To support SR-IOV Device Plugin, volume mount for directory DPDeviceInfoFile is created in needs to be added to the pod.spec for SR-IOV DP. Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Add support to app-netutil to implement the device-info-spec. Primarily, it consists of pull additional data fron the DeviceInfo field in the NetworkStatus. As part of supporting the device-info-spec, migrate app-netutil to use network-attachment-definition-client data structs. app-netutil redefined some of the data structs from Multus and Userspace CNI. Since network-attachment-definition-client is now the location for these data structs, migrate to app-netutil to use these instead of defining it's own. Since app-netutil is not GA yet, the data structure returned by GetInterfaces() changed. Once this package is moved to GA, the API will need to be backwards compatible. Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
6fd56fa to
72333ff
Compare
|
@zshi-redhat Sorry, had some comments "pending" that I thought I submitted early last week. Let me know if you have any more comments. I pushed a small change up last week to count the number of "unknown" interfaces and take that into consideration when applying the PCIDEVICE_ interfaces. |
@Billy99, I don't have further comments, shall I merge it now or wait until DP/Multus PRs be merged? |
Yes. I have other changes coming for exposing hugepages via DownwardAPI. So let's get this in and build on it. |
Add support to app-netutil to implement the device-info-spec. Primarily, it consists of pull additional data from the DeviceInfo field in the NetworkStatus.
As part of supporting the device-info-spec, migrate app-netutil to use network-attachment-definition-client data structs. app-netutil redefined some of the data structs from Multus and Userspace CNI. Since network-attachment-definition-client is now the location for these data structs, migrate to app-netutil to use these instead of defining it's own.