Enable a dynamic plugin with the CLI

You can enable a dynamic plugin to extend the core web console with more features, such as additional pages, perspectives, or dashboard items. Use the OpenShift CLI (oc) after a scripted installation, such as an Operator or Helm-based install. Add the ConsolePlugin name to spec.plugins in the console Operator configuration (console.operator.openshift.io/cluster) so the web console loads it.

Prerequisites
  • You logged in to the cluster as a user with cluster-admin privileges.

  • You installed the dynamic plugin using a scripted installation, such as an Operator or Helm chart.

  • A ConsolePlugin custom resource (CR) exists on the cluster.

Procedure
  1. Confirm the name of the ConsolePlugin resource by running the following command:

    $ oc get consoleplugin
  2. Optional: View details for a specific ConsolePlugin resource by running the following commands:

    1. Set the plugin name as an environment variable:

      $ PLUGIN_NAME="<plugin_name>"

      where <plugin_name> is the name of the ConsolePlugin resource.

    2. Verify the plugin details:

      $ oc get consoleplugin "${PLUGIN_NAME}" -o yaml

      The following example shows a ConsolePlugin YAML with the plugin listed in spec.plugins:

      apiVersion: operator.openshift.io/v1
      kind: Console
      metadata:
        name: cluster
      spec:
        plugins:
          - <plugin_name>
          # ...

      Replace <plugin_name> with the name of your plugin.

  3. Enable the dynamic plugin by adding the ConsolePlugin name to the console Operator configuration.

    Note

    Make sure the Operator finishes installing the dynamic plugin before you run the following patch command.

    1. Set the plugin patch as an environment variable:

      $ PLUGIN_PATCH=$(cat <<EOF
      [
        {
          "op": "add",
          "path": "/spec/plugins/-",
          "value": "<plugin_name>"
        }
      ]
      EOF
      )
    2. Patch the console Operator configuration:

      $ oc patch consoles.operator.openshift.io cluster --type=json -p "${PLUGIN_PATCH}"
Verification
  1. Confirm that the console Operator configuration includes the ConsolePlugin name by running the following command:

    $ oc get console.operator.openshift.io cluster -o jsonpath='{.spec.plugins}{"\n"}'
  2. Refresh the Red Hat OpenShift Container Platform web console.

    The console can take a few minutes to apply the updated configuration.