k8snetworkplumbingwg / network-attachment-definition-client

A Golang Kubernetes client
Apache License 2.0
11 stars 37 forks source link

Device-info-spec missing in network-status when using the "plugins" filed in the NAD's CNI Spec. #50

Open joelcheison opened 1 year ago

joelcheison commented 1 year ago

The device-info spec appears in the pod's network-status annotation when the NAD config only contains a single plugin using the "type" filed in the cni spec.

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  annotations:
    k8s.v1.cni.cncf.io/resourceName: intel.com/pci_sriov_net_f1
  name: test-net
  namespace: test
spec:
  config: '{
    "cniVersion": "0.3.1",
    "name": "test",
    **"type": "sriov",**

However when the "plugins" list of the cni spec (https://github.com/containernetworking/cni/blob/main/SPEC.md) is used for the NAD to invoke more than one plugin in a NAD, the device-info-spec is missing in the pod network-status annotation

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  annotations:
    k8s.v1.cni.cncf.io/resourceName: intel.com/pci_sriov_net_f1
  name: test-net
  namespace: test
spec:
  config: '{
   "cniVersion" : "0.3.1",
   "name" : "networking-f1c",
   **"plugins" : [**
      {
         "ipam" : {
            "type" : "static"
         },
         "name" : "test",
         **"type" : "sriov",**
         "vlan" : 821,
         "spoofchk": "on",
         "trust":"off",
         "link_state": "auto"
      },
      {
         **"type": "tuning"**,
         "sysctl": { 
            "net.ipv6.conf.test.disable_ipv6": "1"
         }
       }
   ]
}'
phoracek commented 1 year ago

@joelcheison thanks for reporting this. I believe that the annotation is set through Multus, this library serves only as a way to access the API. Correct me if the code impressible of deciding when to set device-info is invoked lives in this repo. Perhaps this should be open on the SR-IOV plugin or Multus itself.

CC @s1061123