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

ConsolePlugin CRs cannot be garbage collected due to missing spec.i18n.loadType value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • 4.12.z
    • 4.12
    • Management Console
    • None
    • False
    • Hide

      None

      Show
      None

      Description of problem:

      https://github.com/openshift/api/pull/1186 - https://issues.redhat.com/browse/CONSOLE-3069 promoted ConsolePlugin CRD to v1.
      
      The PR introduces also a conversion webhook from v1alpha1 to v1.
      
      In new CRD version I18n ConsolePluginI18n is marked as optional.
      The conversion webhook will not set a default valid ("Lazy"/"Preload") value writing the v1 object and a v1 object completely omitting spec.i18n will be accepted we no valid default value as well.
      
      On the other side, at garbage collection time the object will be stuck forever due to the lack of a valid value for spec.i18n.loadType
      
      Example,
      create a v1 ConsolePlugin object:
      
      cat <<EOF | oc apply -f -
      apiVersion: console.openshift.io/v1
      kind: ConsolePlugin
      metadata:
        name: test472
      spec:
        backend:
          service:
            basePath: /
            name: test472-service
            namespace: kubevirt-hyperconverged
            port: 9443
          type: Service
        displayName: Test 472 Plugin
      EOF
      
      Delete it in foreground mode:
      stirabos@t14s:~$ oc delete consoleplugin test472 --timeout=30s --cascade='foreground' -v 7
      I1011 18:20:03.255605   31610 loader.go:372] Config loaded from file:  /home/stirabos/.kube/config
      I1011 18:20:03.266567   31610 round_trippers.go:463] DELETE https://api.ci-ln-krdzphb-72292.gcp-2.ci.openshift.org:6443/apis/console.openshift.io/v1/consoleplugins/test472
      I1011 18:20:03.266581   31610 round_trippers.go:469] Request Headers:
      I1011 18:20:03.266588   31610 round_trippers.go:473]     Accept: application/json
      I1011 18:20:03.266594   31610 round_trippers.go:473]     Content-Type: application/json
      I1011 18:20:03.266600   31610 round_trippers.go:473]     User-Agent: oc/4.11.0 (linux/amd64) kubernetes/fcf512e
      I1011 18:20:03.266606   31610 round_trippers.go:473]     Authorization: Bearer <masked>
      I1011 18:20:03.688569   31610 round_trippers.go:574] Response Status: 200 OK in 421 milliseconds
      consoleplugin.console.openshift.io "test472" deleted
      I1011 18:20:03.688911   31610 round_trippers.go:463] GET https://api.ci-ln-krdzphb-72292.gcp-2.ci.openshift.org:6443/apis/console.openshift.io/v1/consoleplugins?fieldSelector=metadata.name%3Dtest472
      I1011 18:20:03.688919   31610 round_trippers.go:469] Request Headers:
      I1011 18:20:03.688928   31610 round_trippers.go:473]     Authorization: Bearer <masked>
      I1011 18:20:03.688935   31610 round_trippers.go:473]     Accept: application/json
      I1011 18:20:03.688941   31610 round_trippers.go:473]     User-Agent: oc/4.11.0 (linux/amd64) kubernetes/fcf512e
      I1011 18:20:03.840103   31610 round_trippers.go:574] Response Status: 200 OK in 151 milliseconds
      I1011 18:20:03.840825   31610 round_trippers.go:463] GET https://api.ci-ln-krdzphb-72292.gcp-2.ci.openshift.org:6443/apis/console.openshift.io/v1/consoleplugins?fieldSelector=metadata.name%3Dtest472&resourceVersion=175205&watch=true
      I1011 18:20:03.840848   31610 round_trippers.go:469] Request Headers:
      I1011 18:20:03.840884   31610 round_trippers.go:473]     Accept: application/json
      I1011 18:20:03.840907   31610 round_trippers.go:473]     User-Agent: oc/4.11.0 (linux/amd64) kubernetes/fcf512e
      I1011 18:20:03.840928   31610 round_trippers.go:473]     Authorization: Bearer <masked>
      I1011 18:20:03.972219   31610 round_trippers.go:574] Response Status: 200 OK in 131 milliseconds
      error: timed out waiting for the condition on consoleplugins/test472
      
      and in kube-controller-manager logs we see:
      
      2022-10-11T16:25:32.192864016Z I1011 16:25:32.192788       1 garbagecollector.go:501] "Processing object" object="test472" objectUID=0cc46a01-113b-4bbe-9c7a-829a97d6867c kind="ConsolePlugin" virtual=false
      2022-10-11T16:25:32.282303274Z I1011 16:25:32.282161       1 garbagecollector.go:623] remove DeleteDependents finalizer for item [console.openshift.io/v1/ConsolePlugin, namespace: , name: test472, uid: 0cc46a01-113b-4bbe-9c7a-829a97d6867c]
      2022-10-11T16:25:32.304835330Z E1011 16:25:32.304730       1 garbagecollector.go:379] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"console.openshift.io/v1", Kind:"ConsolePlugin", Name:"test472", UID:"0cc46a01-113b-4bbe-9c7a-829a97d6867c", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:""}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:true, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:true, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference(nil)}: ConsolePlugin.console.openshift.io "test472" is invalid: spec.i18n.loadType: Unsupported value: "": supported values: "Preload", "Lazy"
      
      

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

      OCP 4.12.0 ec4

      How reproducible:

      100% 

      Steps to Reproduce:

      1. cat <<EOF | oc apply -f -
      apiVersion: console.openshift.io/v1
      kind: ConsolePlugin
      metadata:
        name: test472
      spec:
        backend:
          service:
            basePath: /
            name: test472-service
            namespace: kubevirt-hyperconverged
            port: 9443
          type: Service
        displayName: Test 472 Plugin
      EOF
      2. oc delete consoleplugin test472 --timeout=30s --cascade='foreground' -v 7
      

      Actual results:

      2022-10-11T16:25:32.192864016Z I1011 16:25:32.192788       1 garbagecollector.go:501] "Processing object" object="test472" objectUID=0cc46a01-113b-4bbe-9c7a-829a97d6867c kind="ConsolePlugin" virtual=false
      2022-10-11T16:25:32.282303274Z I1011 16:25:32.282161       1 garbagecollector.go:623] remove DeleteDependents finalizer for item [console.openshift.io/v1/ConsolePlugin, namespace: , name: test472, uid: 0cc46a01-113b-4bbe-9c7a-829a97d6867c]
      2022-10-11T16:25:32.304835330Z E1011 16:25:32.304730       1 garbagecollector.go:379] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"console.openshift.io/v1", Kind:"ConsolePlugin", Name:"test472", UID:"0cc46a01-113b-4bbe-9c7a-829a97d6867c", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:""}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:true, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:true, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference(nil)}: ConsolePlugin.console.openshift.io "test472" is invalid: spec.i18n.loadType: Unsupported value: "": supported values: "Preload", "Lazy"

      Expected results:

      Object correctly deleted

      Additional info:

      The issue doesn't happen with --cascade='background' which is the default on the CLI client

            jhadvig@redhat.com Jakub Hadvig
            stirabos Simone Tiraboschi
            YaDan Pei YaDan Pei
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: