Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-41352

SriovNetwork annotations get removed if the SriovNetwork is created before the operator acquired the lease

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.17
    • Networking / SR-IOV
    • None
    • Important
    • None
    • CNF Network Sprint 259, CNF Network Sprint 260
    • 2
    • False
    • Hide

      None

      Show
      None
    • Hide
      Cause: The SR-IOV operator overrides all the annotations of SriovNetwork resource
      Consequence: If the user sets a custom annotation on those resources, they are likely to be overwritten.
      Fix: With the new release, the operator only manages the annotation it needs to work
      Show
      Cause: The SR-IOV operator overrides all the annotations of SriovNetwork resource Consequence: If the user sets a custom annotation on those resources, they are likely to be overwritten. Fix: With the new release, the operator only manages the annotation it needs to work
    • Bug Fix
    • Proposed

      Description of problem:

      SriovNetwork annotations get removed if the SriovNetwork is created before the operator acquired the lease.

      Version-Release number of selected component (if applicable):

      sriov-network-operator.v4.17.0-202408271906    

      How reproducible:

       100%   

      Steps to Reproduce:

          1. Remove any existing SriovNetworks and SriovNetworkNodePolicy
      
          2. Restart the sriov operator so that it waits to aquire the lease:
      
      oc -n openshift-sriov-network-operator edit csv sriov-network-operator.v4.17.0-202408271906 # set sriov-network-operator replicas to 0
      
      oc -n openshift-sriov-network-operator edit csv sriov-network-operator.v4.17.0-202408271906 # set sriov-network-operator replicas to 1
      
           3. Check the operator logs and make sure it's waiting to acquire the lease
      
      oc -n openshift-sriov-network-operator logs deploy/sriov-network-operator -f
      
      2024-09-06T12:48:43.248620961Z    INFO    host/manager.go:55    infiniband.New(): ib guid config doesn't exist, continuing without it    {"config path": "/etc/sriov-operator/infiniband/guids"}
      2024-09-06T12:48:43.249417226Z    INFO    setup    runtime/asm_amd64.s:1695    starting leader election manager
      2024-09-06T12:48:43.249577433Z    INFO    manager/runnable_group.go:223    starting server    {"kind": "health probe", "addr": "[::]:8081"}
      I0906 12:48:43.249688       1 leaderelection.go:250] attempting to acquire leader lease openshift-sriov-network-operator/a56def2a.openshift.io...
           
          4. Before the operator acquires the lease create an SriovNetwork and policy, e.g.
      
      ---
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovNetwork
      metadata:
        annotations:
          test: test
        name: sriov-nw-du-fh
        namespace: openshift-sriov-network-operator
      spec:
        logLevel: info
        networkNamespace: openshift-sriov-network-operator
        resourceName: du_fh
        vlan: 140
      ---
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovNetworkNodePolicy
      metadata:
        name: sriov-nnp-du-fh
        namespace: openshift-sriov-network-operator
      spec:
        deviceType: vfio-pci
        isRdma: false
        nicSelector:
          pfNames:
          - ens2f0#16-31
        nodeSelector:
          node-role.kubernetes.io/master: ""
        numVfs: 48
        priority: 10
        resourceName: du_fh
      
      
      5. Check created SriovNetwork:
      
      oc -n openshift-sriov-network-operator get sriovnetwork  -o yaml
      apiVersion: v1
      items:
      - apiVersion: sriovnetwork.openshift.io/v1
        kind: SriovNetwork
        metadata:
          annotations:
            kubectl.kubernetes.io/last-applied-configuration: |
              {"apiVersion":"sriovnetwork.openshift.io/v1","kind":"SriovNetwork","metadata":{"annotations":{"test":"test"},"name":"sriov-nw-du-fh","namespace":"openshift-sriov-network-operator"},"spec":{"logLevel":"info","networkNamespace":"openshift-sriov-network-operator","resourceName":"du_fh","vlan":140}}
            test: test
          creationTimestamp: "2024-09-06T12:48:53Z"
          generation: 1
          name: sriov-nw-du-fh
          namespace: openshift-sriov-network-operator
          resourceVersion: "915936"
          uid: 15b1b325-27e7-4621-9db4-3edb5600b505
        spec:
          logLevel: info
          networkNamespace: openshift-sriov-network-operator
          resourceName: du_fh
          vlan: 140
      kind: List
      metadata:
        resourceVersion: ""
      
      
      6. Wait until the operator acquires the lease:
      
       oc -n openshift-sriov-network-operator logs deploy/sriov-network-operator -f
      2024-09-06T12:48:43.248620961Z    INFO    host/manager.go:55    infiniband.New(): ib guid config doesn't exist, continuing without it    {"config path": "/etc/sriov-operator/infiniband/guids"}
      2024-09-06T12:48:43.249417226Z    INFO    setup    runtime/asm_amd64.s:1695    starting leader election manager
      2024-09-06T12:48:43.249577433Z    INFO    manager/runnable_group.go:223    starting server    {"kind": "health probe", "addr": "[::]:8081"}
      I0906 12:48:43.249688       1 leaderelection.go:250] attempting to acquire leader lease openshift-sriov-network-operator/a56def2a.openshift.io...
      I0906 12:54:29.705028       1 leaderelection.go:260] successfully acquired lease openshift-sriov-network-operator/a56def2a.openshift.io
      2024-09-06T12:54:29.705246795Z    INFO    setup    runtime/proc.go:271    acquired lease
      2024-09-06T12:54:29.705388733Z    INFO    setup    runtime/asm_amd64.s:1695    starting namespaced manager
      
      7. Check again the SriovNetwork:
      
      oc -n openshift-sriov-network-operator get sriovnetwork  -o yaml
      apiVersion: v1
      items:
      - apiVersion: sriovnetwork.openshift.io/v1
        kind: SriovNetwork
        metadata:
          annotations:
            operator.sriovnetwork.openshift.io/last-network-namespace: openshift-sriov-network-operator
          creationTimestamp: "2024-09-06T12:48:53Z"
          finalizers:
          - netattdef.finalizers.sriovnetwork.openshift.io
          generation: 1
          name: sriov-nw-du-fh
          namespace: openshift-sriov-network-operator
          resourceVersion: "916880"
          uid: 15b1b325-27e7-4621-9db4-3edb5600b505
        spec:
          logLevel: info
          networkNamespace: openshift-sriov-network-operator
          resourceName: du_fh
          vlan: 140
      

      Actual results:

      We can notice the `test: test` annotation got removed.    

      Expected results:

      `test: test` annotation does not get removed after its creation.

      Additional info:

          

              apanatto@redhat.com Andrea Panattoni
              mcornea@redhat.com Marius Cornea
              Marius Cornea Marius Cornea
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: