Bug 1953726 - Fix issues related to loading dynamic plugins
Summary: Fix issues related to loading dynamic plugins
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.8
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.8.0
Assignee: Vojtech Szocs
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks: 1953728
TreeView+ depends on / blocked
 
Reported: 2021-04-26 18:21 UTC by Vojtech Szocs
Modified: 2021-07-27 23:04 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1953728 (view as bug list)
Environment:
Last Closed: 2021-07-27 23:04:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 8076 0 None closed Fix issues related to loading plugins via SERVER_FLAGS.consolePlugins 2021-04-26 18:45:40 UTC
Github openshift console pull 8705 0 None closed Support webpack ConcatenatedModule in ExtensionValidator 2021-04-26 18:46:04 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 23:04:20 UTC

Description Vojtech Szocs 2021-04-26 18:21:12 UTC
Description of problem:

Some fixes are needed to ensure Console dynamic plugins are loaded properly in the browser.

Issue details:

(1) loadPluginFromURL function should wait until the plugin is loaded
(2) generated plugin-entry.js file should use /api/plugins/{PluginName}/ to load plugin-specific assets
(3) extension validation should not fail upon plugin's production build (due to webpack module concatenation)

Tech docs reference:

https://github.com/openshift/console/blob/master/frontend/packages/console-dynamic-plugin-sdk/README.md

Comment 1 Yadan Pei 2021-04-29 11:14:01 UTC
1) Clone Console repo and make sure you're on the right branch:
git checkout -b release-4.x origin/release-4.x
For 4.7 branch, apply the changes in PR 8780. (For 4.8 branch, these changes are already there.)
2) Build Bridge backend & Console web frontend:
./build.sh
3) Build Console dynamic demo plugin:
( cd frontend/dynamic-demo-plugin ; yarn ; yarn build )
4) Start local demo plugin asset server:
( cd frontend/dynamic-demo-plugin ; yarn http-server )
5) Start local Bridge server and connect it with above plugin:
source ./contrib/oc-environment.sh && ./bin/bridge -plugins console-demo-plugin=http://localhost:9001/
6) visit localhost:9000

We can see logs in browser console: 
Dynamic plugins: [console-demo-plugin]
Loading plugin manifest from http://localhost:9000/api/plugins/console-demo-plugin/plugin-manifest.json
Loading entry script for plugin console-demo-plugin.0 from http://localhost:9000/api/plugins/console-demo-plugin/plugin-entry.js
Added plugin console-demo-plugin.0
Plugin console-demo-plugin.0 is now enabled


The plugin is loaded and enabled successfully


In another way

1) follow steps in https://github.com/openshift/console/tree/master/frontend/dynamic-demo-plugin#docker-image to build a docker image 2) 2) replace the image in oc-manifest.yaml https://github.com/openshift/console/tree/master/frontend/dynamic-demo-plugin#deployment-on-cluster and create resources defined
3) enable plugin https://github.com/openshift/console/tree/master/frontend/dynamic-demo-plugin#enabling-the-plugin
at last check browser console logs, we should see the same log with above 


Verified on 4.8.0-0.nightly-2021-04-26-151924

Comment 4 errata-xmlrpc 2021-07-27 23:04:01 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


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