Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-79964

Service created by virtctl expose lacks ownerReference, causing resource dangling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • CNV Network
    • Quality / Stability / Reliability
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • None

      Description of problem:

      When using virtctl expose to create a Service for a Virtual Machine, the resulting Service resource is created without an ownerReference entry. Consequently, when the VM is deleted, the Service remains dangling in the namespace indefinitely with an empty endpoint and not collected by the garbage collector.

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

      v4.21

      How reproducible:

      100%

      Steps to Reproduce:

      1. Create and start a Virtual Machine.
      2. Expose the VM using the virtctl binary:
      virtctl expose vm vm-test --name=ssh-svc --port=22 --target-port=22
      3. Describe the service - no ownerReferences entry exists.
      endpoints are correct in the service:
      $ oc get endpoints ssh-svc                                                   
      NAME      ENDPOINTS        AGE
      ssh-svc   10.128.1.38:22   6m42s
      
      4. Delete the Virtual Machine:
      oc delete vm vm-test
      5. Check for the existence of the Service and its endpoints.

      Actual results:

      1. The Service ssh-svc remains in the namespace after the VM is deleted.
      2. Endpoints is now none:
      $ oc get endpoints ssh-svc                                                   
      NAME      ENDPOINTS   AGE
      ssh-svc   <none>      103s

      Expected results:

      The Service is not created directly by the user, but rather created as a side effect of the expose command. It should ideally be created with an ownerReference pointing to the VM so that it is automatically cleaned by the Kubernetes Garbage Collector if the VM is deleted.

      Additional info:

       

              ehaas1@redhat.com Edward Haas
              rh-ee-awax Anat Wax
              Yoss Segev Yoss Segev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: