Bug 1826808 - Need an endpoint in console to access Knative Event Source CRDs
Summary: Need an endpoint in console to access Knative Event Source CRDs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.5.0
Assignee: Abhishek K N
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-22 15:18 UTC by Abhishek K N
Modified: 2020-07-13 17:30 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-13 17:30:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 4945 0 None closed Bug 1826808: added endpoint to fetch duck typed knative event source crds 2020-06-23 10:16:20 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:30:39 UTC

Description Abhishek K N 2020-04-22 15:18:54 UTC
Description of problem:
Need a new end point in console that specifically returns the metadata for all duck typed Knative event source CRDs. This shall allow an unprivileged user to get this information without read access to CRDs.

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

How reproducible:

Prerequisites:
  Install 'OpenShift Serverless Operator' & 'Knative Eventing Operator'

Steps to Reproduce:
1. Fire following API using curl/REST client/browser https://<openshift host name>/api/console/knative-event-sources 
2. Try logging with Admin as well as basic user credentials

Actual results:
API returns 404 as it's not implemented. 

Expected results:
API shall return all duck typed Knative event sources

Additional info:
Even if operators mentioned in prerequisite are not installed, API shall return empty list of 'items'

Comment 3 Yanping Zhang 2020-04-29 11:15:32 UTC
@Abhishek, I'm not sure the steps to verified the bug, we should install Knative Eventing Operator first, right? 
I tried to install it in project, but failed.
Failed
CustomResourceDefinition.apiextensions.k8s.io "knativeeventings.eventing.knative.dev" is invalid: spec.validation.openAPIV3Schema.type: Required value: must not be empty at the root

Comment 4 Abhishek K N 2020-04-29 12:02:15 UTC
@yanpzhan I've updated the description with additional details. Operator installation failure might be due to issue https://bugzilla.redhat.com/show_bug.cgi?id=1825330. Since PR related to this issue is merged we don't observe any issue with operator installation on latest CI builds.

Comment 5 Yanping Zhang 2020-04-30 07:29:50 UTC
Checked on ocp 4.5 cluster with payload: 4.5.0-0.nightly-2020-04-29-223453.

1. When 'OpenShift Serverless Operator' and 'Knative Eventing Operator' are not install, with Admin as well as basic user credentials, access from browser: https://<openshift host name>/api/console/knative-event-sources,
 it returns items with empty context: 
{"kind":"CustomResourceDefinitionList","apiVersion":"apiextensions.k8s.io/v1","metadata":{"selfLink":"/apis/apiextensions.k8s.io/v1/customresourcedefinitions","resourceVersion":"73794"},"items":[]}


2. After 'OpenShift Serverless Operator' and 'Knative Eventing Operator' are installed, with Admin as well as basic user credentials, access from browser: https://<openshift host name>/api/console/knative-event-sources,
 it returns items:
{"kind":"CustomResourceDefinitionList","apiVersion":"apiextensions.k8s.io/v1","metadata":{"selfLink":"/apis/apiextensions.k8s.io/v1/customresourcedefinitions","resourceVersion":"223955"},"items":[{"metadata":{"name":"apiserversources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"apiserversources","singular":"apiserversource","kind":"ApiServerSource","listKind":"ApiServerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"apiserversources.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"apiserversources","singular":"apiserversource","kind":"ApiServerSource","listKind":"ApiServerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":false,"storage":false}]}},{"metadata":{"name":"containersources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"containersources","singular":"containersource","kind":"ContainerSource","listKind":"ContainerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"cronjobsources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"cronjobsources","singular":"cronjobsource","kind":"CronJobSource","listKind":"CronJobSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"pingsources.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"pingsources","singular":"pingsource","kind":"PingSource","listKind":"PingSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":true,"storage":false}]}},{"metadata":{"name":"sinkbindings.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"sinkbindings","singular":"sinkbinding","kind":"SinkBinding","listKind":"SinkBindingList","categories":["all","knative","eventing","sources","bindings"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"sinkbindings.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"sinkbindings","singular":"sinkbinding","kind":"SinkBinding","listKind":"SinkBindingList","categories":["all","knative","eventing","sources","bindings"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":true,"storage":false}]}}]}

3. (Operators are installed)Try curl the api, it return nothing.
[root@MiWiFi-R1CM ~]# curl -k -H "Authorization: Bearer eAATrr-rM92wHGfobqrBOXucDCXVywhPwxL2KqNH6DE" https://console-openshift-console.apps.qe-groupd1-0430.qe.devcluster.openshift.com/api/console/knative-event-sources
[root@MiWiFi-R1CM ~]# curl -k -H "Authorization: Bearer eAATrr-rM92wHGfobqrBOXucDCXVywhPwxL2KqNH6DE" https://console-openshift-console.apps.qe-groupd1-0430.qe.devcluster.openshift.com/api/console/version
[root@MiWiFi-R1CM ~]# 

@Abhishek, thanks for you help info, from the above info, I think the api entry works from console. But curl from client get nothing, not only the /api/console/knative-event-sources, but also /api/console/version didn't return anything. Could you help to check if the client step is not correct?

Comment 6 Abhishek K N 2020-04-30 09:18:12 UTC
@yanpzhan Try to add -v option to curl & you might see 401 Unauthorized error. If so the Bearer token used is incorrect. Try to use 'openshift-session-token' from browser & set it using -b option.

Comment 7 Yanping Zhang 2020-05-06 05:36:59 UTC
Tested again on 4.5 cluster with payload 4.5.0-0.nightly-2020-05-04-113741

Before 'OpenShift Serverless Operator' and 'Knative Eventing Operator' are installed:
[zyp@MiWiFi-R1CM ~]$ curl -k -b "openshift-session-token=DzrhZSufNfA_tiNCM89rOXlL9aQ2TuIJ7eRRdefPB3w" https://console-openshift-console.apps.qe-groupd-0506.qe.devcluster.openshift.com/api/console/knative-event-sources
{"kind":"CustomResourceDefinitionList","apiVersion":"apiextensions.k8s.io/v1","metadata":{"selfLink":"/apis/apiextensions.k8s.io/v1/customresourcedefinitions","resourceVersion":"109241"},"items":[]}

After 'OpenShift Serverless Operator' and 'Knative Eventing Operator' are installed:
[zyp@MiWiFi-R1CM ~]$ curl -k -b "openshift-session-token=DzrhZSufNfA_tiNCM89rOXlL9aQ2TuIJ7eRRdefPB3w" https://console-openshift-console.apps.uster.openshift.com/api/console/knative-event-sources
{"kind":"CustomResourceDefinitionList","apiVersion":"apiextensions.k8s.io/v1","metadata":{"selfLink":"/apis/apiextensions.k8s.io/v1/customresourcedefinitions","resourceVersion":"155911"},"items":[{"metadata":{"name":"apiserversources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"apiserversources","singular":"apiserversource","kind":"ApiServerSource","listKind":"ApiServerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"apiserversources.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"apiserversources","singular":"apiserversource","kind":"ApiServerSource","listKind":"ApiServerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":false,"storage":false}]}},{"metadata":{"name":"containersources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"containersources","singular":"containersource","kind":"ContainerSource","listKind":"ContainerSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"cronjobsources.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"cronjobsources","singular":"cronjobsource","kind":"CronJobSource","listKind":"CronJobSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"pingsources.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"pingsources","singular":"pingsource","kind":"PingSource","listKind":"PingSourceList","categories":["all","knative","eventing","sources"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":true,"storage":false}]}},{"metadata":{"name":"sinkbindings.sources.eventing.knative.dev"},"spec":{"group":"sources.eventing.knative.dev","names":{"plural":"sinkbindings","singular":"sinkbinding","kind":"SinkBinding","listKind":"SinkBindingList","categories":["all","knative","eventing","sources","bindings"]},"versions":[{"name":"v1alpha1","served":true,"storage":true}]}},{"metadata":{"name":"sinkbindings.sources.knative.dev"},"spec":{"group":"sources.knative.dev","names":{"plural":"sinkbindings","singular":"sinkbinding","kind":"SinkBinding","listKind":"SinkBindingList","categories":["all","knative","eventing","sources","bindings"]},"versions":[{"name":"v1alpha1","served":true,"storage":true},{"name":"v1alpha2","served":true,"storage":false}]}}]}

The bug is fixed, so move it to Verified.
Thank @Abhishek for helping!

Comment 8 errata-xmlrpc 2020-07-13 17:30:21 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-2020:2409


Note You need to log in before you can comment on or make changes to this bug.