Bug 1738433

Summary: [sriov] resourcename is not correct in NetworkAttachmentDefinition
Product: OpenShift Container Platform Reporter: zhaozhanqi <zzhao>
Component: NetworkingAssignee: Peng Liu <pliu>
Status: CLOSED ERRATA QA Contact: zhaozhanqi <zzhao>
Severity: high Docs Contact:
Priority: high    
Version: 4.2.0CC: aos-bugs, wsun
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:35:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhaozhanqi 2019-08-07 07:25:30 UTC
Description of problem:
Creating sriov network resource with 'resourceName: intelnics2', Found the '    k8s.v1.cni.cncf.io/resourceName is 'openshift.com/intelnics'  in NetworkAttachmentDefinition generated by operator.  which should be 

openshift.com/intelnics2 not openshift.com/intelnics

Version-Release number of selected component (if applicable):
quay.io/openshift-release-dev/ocp-v4.0-art-dev:v4.2.0-201908051019-ose-sriov-network-operator

How reproducible:
always

Steps to Reproduce:
1. install sriov operator
2. Create sriovnetworknodepolicy with resourceName is intelnics1
3. Create sriov network resource with resourceName is intelnics1
4. Check the NetworkAttachmentDefinition
5. Check the sriov operator log

Actual results:

# oc get sriovnetworknodepolicies.sriovnetwork.openshift.io -o yaml
apiVersion: v1
items:
- apiVersion: sriovnetwork.openshift.io/v1
  kind: SriovNetworkNodePolicy
  metadata:
    creationTimestamp: "2019-08-07T06:12:29Z"
    generation: 1
    name: default
    namespace: sriov-network-operator
    resourceVersion: "4200161"
    selfLink: /apis/sriovnetwork.openshift.io/v1/namespaces/sriov-network-operator/sriovnetworknodepolicies/default
    uid: 55c21149-b8da-11e9-9e08-2e808f6aa7e1
  spec:
    nicSelector: {}
    nodeSelector: {}
    numVfs: 0
    resourceName: ""
- apiVersion: sriovnetwork.openshift.io/v1
  kind: SriovNetworkNodePolicy
  metadata:
    creationTimestamp: "2019-07-30T08:28:20Z"
    generation: 9
    name: policy-1
    namespace: sriov-network-operator
    resourceVersion: "4191977"
    selfLink: /apis/sriovnetwork.openshift.io/v1/namespaces/sriov-network-operator/sriovnetworknodepolicies/policy-1
    uid: fd1f597a-b2a3-11e9-a8e4-2e808f6aa7e1
  spec:
    deviceType: vfio-pci
    mtu: 1500
    nicSelector:
      pfNames:
      - ens1f0
      rootDevices:
      - 0000:3b:00.0
      vendor: "8086"
    nodeSelector:
      feature.node.kubernetes.io/sriov-capable: "true"
    numVfs: 4
    priority: 99
    resourceName: intelnics2


# oc get sriovnetworks.sriovnetwork.openshift.io sriov-network -o yaml
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
  creationTimestamp: "2019-08-01T03:57:07Z"
  generation: 8
  name: sriov-network
  namespace: sriov-network-operator
  resourceVersion: "4211905"
  selfLink: /apis/sriovnetwork.openshift.io/v1/namespaces/sriov-network-operator/sriovnetworks/sriov-network
  uid: 6e8fcf4a-b410-11e9-9e08-2e808f6aa7e1
spec:
  ipam: |
    {
      "type": "host-local",
      "subnet": "10.11.11.0/24",
      "rangeStart": "10.11.11.171",
      "rangeEnd": "10.11.11.181",
      "routes": [{
        "dst": "0.0.0.0/0"
      }],
      "gateway": "10.11.11.1"
    }
  networkNamespace: z1
  resourceName: intelnics2
  spoofChk: true
  trust: false
  vlan: 0


# oc get networkattachmentdefinition.k8s.cni.cncf.io sriov-network -n z1 -o yaml 
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  annotations:
    k8s.v1.cni.cncf.io/resourceName: openshift.com/intelnics
  creationTimestamp: "2019-08-01T06:05:07Z"
  generation: 3
  name: sriov-network
  namespace: z1
  ownerReferences:
  - apiVersion: sriovnetwork.openshift.io/v1
    blockOwnerDeletion: true
    controller: true
    kind: SriovNetwork
    name: sriov-network
    uid: 6e8fcf4a-b410-11e9-9e08-2e808f6aa7e1
  resourceVersion: "4158984"
  selfLink: /apis/k8s.cni.cncf.io/v1/namespaces/z1/network-attachment-definitions/sriov-network
  uid: 5004d579-b422-11e9-9e08-2e808f6aa7e1
spec:
  config: |
    {"cniVersion":"0.3.1","name":"sriov-net","type":"sriov","spoofchk":"on","trust":"off","vlan":0,"ipam":{"type":"host-local","subnet":"10.11.11.0/24","rangeStart":"10.11.11.171","rangeEnd":"10.11.11.181","routes":[{"dst":"0.0.0.0/0"}],"gateway":"10.11.11.1"}}
status: {}

**********************
see the operator logs,it's using 'k8s.v1.cni.cncf.io/resourceName":"openshift.com/intelnics2'

{"level":"info","ts":1565161966.3849516,"logger":"controller_caconfig","msg":"Reconciling CA config map","Request.Namespace":"sriov-network-operator","Request.Name":"device-plugin-config"}
{"level":"info","ts":1565161966.385101,"logger":"controller_caconfig","msg":"Reconciling CA config map","Request.Namespace":"sriov-network-operator","Request.Name":"openshift-service-ca"}
{"level":"info","ts":1565161966.3852692,"logger":"controller_caconfig","msg":"Reconciling CA config map","Request.Namespace":"sriov-network-operator","Request.Name":"sriov-network-operator-lock"}
{"level":"info","ts":1565161998.7197356,"logger":"controller_sriovnetwork","msg":"Reconciling SriovNetwork","Request.Namespace":"sriov-network-operator","Request.Name":"sriov-network"}
{"level":"info","ts":1565161998.7247148,"logger":"controller_sriovnetwork.renderNetAttDef","msg":"Start to render SRIOV CNI NetworkAttachementDefinition"}
manifest {"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"annotations":{"k8s.v1.cni.cncf.io/resourceName":"openshift.com/intelnics2"},"name":"sriov-network","namespace":"z1"},"spec":{"config":"{\"cniVersion\":\"0.3.1\",\"name\":\"sriov-net\",\"type\":\"sriov\",\"spoofchk\":\"on\",\"trust\":\"off\",\"vlan\":0,\"ipam\":{\"type\":\"host-local\",\"subnet\":\"10.11.11.0/24\",\"rangeStart\":\"10.11.11.171\",\"rangeEnd\":\"10.11.11.181\",\"routes\":[{\"dst\":\"0.0.0.0/0\"}],\"gateway\":\"10.11.11.1\"}}\n"}}
{"level":"info","ts":1565161998.7311783,"logger":"controller_sriovnetwork","msg":"SriovNetworkNodeState already exists, updating","Request.Namespace":"sriov-network-operator","Request.Name":"sriov-network"}
{"level":"info","ts":1565161998.7384472,"logger":"controller_sriovnetwork","msg":"Skip reconcile: NetworkAttachmentDefinition already exists","Request.Namespace":"sriov-network-operator","Request.Name":"sriov-network","Namespace":"z1","Name":"sriov-network"}

Expected results:
NetworkAttachmentDefinition should use correct resource name.


Additional info:

Comment 3 zhaozhanqi 2019-08-12 07:01:06 UTC
Verified this bug with sriov image quay.io/openshift-release-dev/ocp-v4.0-art-dev:v4.2.0-201908090219-ose-sriov-network-operator

Comment 4 errata-xmlrpc 2019-10-16 06:35:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2922