Bug 2021297

Summary: Dynamic Plugins: Console isn't honoring declared `@console/pluginAPI` dependency
Product: OpenShift Container Platform Reporter: Samuel Padgett <spadgett>
Component: Management ConsoleAssignee: Vojtech Szocs <vszocs>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.10CC: aos-bugs, jhadvig, yapei
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
No end user impact.
Story Points: ---
Clone Of:
: 2102335 (view as bug list) Environment:
Last Closed: 2023-01-17 19:46:45 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:
Bug Depends On:    
Bug Blocks: 2102335    

Description Samuel Padgett 2021-11-08 18:28:03 UTC
The console doesn't honor the `@console/pluginAPI` version range declared in the plugin manifest. This means console can load incompatible plugins, causing runtime errors and possibly breaking console functionality.

https://github.com/openshift/enhancements/blob/master/enhancements/console/dynamic-plugins.md#plugin-manifest-properties

Console should inspect the version range and compare it to the OpenShift console version. If the versions don't match, the plugin should not be loaded. Likely this will require operator to pass the version to console on startup.

This is important for 4.10 since some operators might need to deliver multiple plugins and enable only the compatible versions as internal APIs have changed from 4.9 to 4.10.

Comment 2 Vojtech Szocs 2022-06-02 13:10:46 UTC
Note that the associated PR also covers resolving dependencies on other plugins, in addition to resolving dependency on Console itself (@console/pluginAPI).

Comment 4 Yadan Pei 2022-07-22 08:55:25 UTC
1. update console-demo-plugin manifest dependencies.@console/pluginAPI to semver version "~4.9.0"
$ git diff dynamic-demo-plugin/package.json
diff --git a/dynamic-demo-plugin/package.json b/dynamic-demo-plugin/package.json
index dd0e3a1436..01f985f454 100644
--- a/dynamic-demo-plugin/package.json
+++ b/dynamic-demo-plugin/package.json
@@ -66,7 +66,7 @@
       "projectOverview": "./utils/project-overview"
     },
     "dependencies": {
-      "@console/pluginAPI": "*"
+      "@console/pluginAPI": "~4.9.0"
     },
     "disableStaticPlugins": [
       "@console/demo-plugin"

2. deploy and enable console-demo-plugin on a 4.12.0-0.nightly-2022-07-21-144610 cluster which has releaseVersion also set to 4.12.0-0.nightly-2022-07-21-144610
$ oc get cm console-config -n openshift-console -o yaml | grep releaseVersion
      releaseVersion: 4.12.0-0.nightly-2022-07-21-144610
3. monitor the logs in javascript console, we can see error messages:
Error while loading plugin console-demo-plugin from /api/plugins/console-demo-plugin/ u: Unmet dependency on Console plugin API:
@console/pluginAPI: required ~4.9.0, current 4.12.0-0.nightly-2022-07-21-144610

when `@console/pluingAPI` doesn't match openshift console version, the plugin will not be loaded




when we defines some dependencies not existing
$ git diff dynamic-demo-plugin/package.json
diff --git a/dynamic-demo-plugin/package.json b/dynamic-demo-plugin/package.json
index dd0e3a1436..34ff180eda 100644
--- a/dynamic-demo-plugin/package.json
+++ b/dynamic-demo-plugin/package.json
@@ -66,7 +66,8 @@
       "projectOverview": "./utils/project-overview"
     },
     "dependencies": {
-      "@console/pluginAPI": "*"
+      "@console/pluginAPI": "=4.12.0-0.nightly-2022-07-21-144610",
+      "foo": "^1.0.0"
     },
we can see errors in javascript console:

Error while loading plugin console-demo-plugin from /api/plugins/console-demo-plugin/ Error: Dependent plugins are not available: foo

Comment 7 errata-xmlrpc 2023-01-17 19:46:45 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.12.0 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-2022:7399