Bug 1931005

Summary: Related objects page doesn't show the object when its name is empty
Product: OpenShift Container Platform Reporter: Yadan Pei <yapei>
Component: Management ConsoleAssignee: Yadan Pei <yapei>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: low Docs Contact:
Priority: low    
Version: 4.7CC: aos-bugs, cjerolim, jokerman, nmukherj, spadgett, yapei
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:45:37 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:
Attachments:
Description Flags
ingress related objects
none
related objects shows `-` when name is empty none

Description Yadan Pei 2021-02-20 03:42:17 UTC
Description of problem:
when status.relatedObjects['name'] is empty, we didn't show the object on console even the instance can be found

Version-Release number of selected component (if applicable):
4.7.0-0.nightly-2021-02-18-110409

How reproducible:
Always

Steps to Reproduce:
1. Check clusteroperator ingress related objects via CLI:
$ oc get co ingress -o json | jq '.status.relatedObjects'
[
  {
    "group": "",
    "name": "openshift-ingress-operator",
    "resource": "namespaces"
  },
  {
    "group": "operator.openshift.io",
    "name": "",
    "namespace": "openshift-ingress-operator",
    "resource": "IngressController"
  },
  {
    "group": "ingress.operator.openshift.io",
    "name": "",
    "namespace": "openshift-ingress-operator",
    "resource": "DNSRecord"
  },
  {
    "group": "",
    "name": "openshift-ingress",
    "resource": "namespaces"
  },
  {
    "group": "",
    "name": "openshift-ingress-canary",
    "resource": "namespaces"
  }
]

2. goes to clusteroperator related objects page and check the objects shown on the page, we can navigate via Administration -> Cluster Settings -> ClusterOperators -> click on insights -> click 'Related objects' tab


Actual results:
2. On 'Related objects' page, we only show three namespaces, the objects whose name is empty is not shown
    - group: operator.openshift.io
      name: ''
      namespace: openshift-ingress-operator
      resource: IngressController
    - group: ingress.operator.openshift.io
      name: ''
      namespace: openshift-ingress-operator
      resource: DNSRecord

Expected results:
2. For DNSRecord and IngressController, their name is empty but IngressController.operator.openshift.io can be found in openshift-ingress-operator namespace, maybe we should shown its instance and link on related objects page

$ oc get IngressController.operator.openshift.io --all-namespaces
NAMESPACE                    NAME      AGE
openshift-ingress-operator   default   51m
[yapei@New_Mac verification-tests]$ oc get DNSRecord.ingress.operator.openshift.io --all-namespaces
No resources found


Additional info:

Comment 1 Jakub Hadvig 2021-02-22 08:24:27 UTC
Assigning to DevConsole since they have been contributing this piece of code.

Comment 2 Robb Hamilton 2021-02-22 20:30:07 UTC
Ya Dan, we do filter obj.spec.relatedObjects that do not have a name and resource [1], but this filter is not impacting what is displayed on the Related objects tab for the example provided as the only two Related objects in the YAML have both a name and a resource. [2]  I am unclear how we could go about having the Related objects tab display items that aren't in the YAML.  What am I missing?

[1] https://github.com/openshift/console/blob/master/frontend/public/components/cluster-settings/related-objects.tsx#L91
[2]
```
apiVersion: config.openshift.io/v1
kind: ClusterOperator
metadata:
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: 'true'
    include.release.openshift.io/self-managed-high-availability: 'true'
    include.release.openshift.io/single-node-developer: 'true'
  creationTimestamp: '2021-02-22T13:35:15Z'
  generation: 1
  managedFields:
    - apiVersion: config.openshift.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            .: {}
            'f:exclude.release.openshift.io/internal-openshift-hosted': {}
            'f:include.release.openshift.io/self-managed-high-availability': {}
            'f:include.release.openshift.io/single-node-developer': {}
        'f:spec': {}
        'f:status':
          .: {}
          'f:extension': {}
      manager: cluster-version-operator
      operation: Update
      time: '2021-02-22T13:35:15Z'
    - apiVersion: config.openshift.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        'f:status':
          'f:conditions': {}
          'f:extension':
            'f:lastReportTime': {}
          'f:relatedObjects': {}
          'f:versions': {}
      manager: insights-operator
      operation: Update
      time: '2021-02-22T13:48:57Z'
  name: insights
  resourceVersion: '464772'
  uid: 1fc1df29-1cc1-413a-a488-49cd058b3abb
spec: {}
status:
  conditions:
    - lastTransitionTime: '2021-02-22T13:48:57Z'
      reason: AsExpected
      status: 'False'
      type: Degraded
    - lastTransitionTime: '2021-02-22T13:48:57Z'
      reason: AsExpected
      status: 'True'
      type: Available
    - lastTransitionTime: '2021-02-22T13:52:57Z'
      message: Monitoring the cluster
      reason: AsExpected
      status: 'False'
      type: Progressing
    - lastTransitionTime: '2021-02-22T13:52:57Z'
      reason: AsExpected
      status: 'False'
      type: Disabled
  extension:
    lastReportTime: '2021-02-22T20:12:15Z'
  relatedObjects:
    - group: ''
      name: openshift-insights
      resource: namespaces
    - group: apps
      name: insights-operator
      namespace: openshift-insights
      resource: deployments
  versions:
    - name: operator
      version: 4.8.0-0.nightly-2021-02-22-092321
```

Comment 3 Robb Hamilton 2021-02-24 15:47:25 UTC
Waiting on info from bug filer.

Comment 4 Yadan Pei 2021-03-02 02:24:05 UTC
Created attachment 1760133 [details]
ingress related objects

Robb, I'm sorry for late reply and the unclear description 

The described issue is: when co has both name and resource we show it on 'Related objects' tab, however when co has only resource field and name empty ('') it is not shown on the tab, pls check the screenshot

This is relatedObjects for co/ingress
$ oc get co ingress -o json | jq '.status.relatedObjects'
[
  {
    "group": "",
    "name": "openshift-ingress-operator",
    "resource": "namespaces"
  },
  {
    "group": "operator.openshift.io",
    "name": "",
    "namespace": "openshift-ingress-operator",
    "resource": "IngressController"
  },
  {
    "group": "ingress.operator.openshift.io",
    "name": "",
    "namespace": "openshift-ingress-operator",
    "resource": "DNSRecord"
  },
  {
    "group": "",
    "name": "openshift-ingress",
    "resource": "namespaces"
  },
  {
    "group": "",
    "name": "openshift-ingress-canary",
    "resource": "namespaces"
  }
]

On the 'Related objects' tab now we only show namespace/openshift-ingress-operator, namespace/openshift-ingress, namespace/openshift-ingress-canary.  Shall we also show IngressController && DNSRecord?

Comment 5 Yadan Pei 2021-03-02 06:15:09 UTC
For IngressController and DNSRecord, one of them has instance in `openshift-ingress-operator` namespace

$ oc get IngressController.operator.openshift.io --all-namespaces
NAMESPACE                    NAME      AGE
openshift-ingress-operator   default   51m

$ oc get DNSRecord.ingress.operator.openshift.io --all-namespaces
No resources found

my concern is if we should show IngressController in the table

Comment 6 Robb Hamilton 2021-03-08 19:07:13 UTC
Thanks for clarifying, Ya Dan.  I've put up https://github.com/openshift/console/pull/8329 to address.

Comment 8 Yadan Pei 2021-03-11 07:21:50 UTC
Created attachment 1762546 [details]
related objects shows `-` when name is empty

Now for relatedObjects without a name, we simple show `-` indicator, this is acceptable

Verified on 4.8.0-0.nightly-2021-03-10-142839

Comment 11 errata-xmlrpc 2021-07-27 22:45:37 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 (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), 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/RHSA-2021:2438