7.5. Dynamic plugin example


Before working through the example, verify that the plugin is working by following the steps in Dynamic plugin development

7.5.1. Adding a tab to the pods page

There are different customizations you can make to the OpenShift Container Platform web console. The following procedure adds a tab to the Pod details page as an example extension to your plugin.

참고

The OpenShift Container Platform web console runs in a container connected to the cluster you have logged into. See "Dynamic plugin development" for information to test the plugin before creating your own.

Procedure

  1. Visit the console-plugin-template repository containing a template for creating plugins in a new tab.

    중요

    Custom plugin code is not supported by Red Hat. Only Cooperative community support is available for your plugin.

  2. Create a GitHub repository for the template by clicking Use this template Create new repository.
  3. Rename the new repository with the name of your plugin.
  4. Clone the new repository to your local machine so you can edit the code.
  5. Edit the package.json file, adding your plugin’s metadata to the consolePlugin declaration. For example:

    "consolePlugin": {
      "name": "my-plugin",
      "version": "0.0.1",
      "displayName": "My Plugin",
      "description": "Enjoy this shiny, new console plugin!",
      "exposedModules": {
        "ExamplePage": "./components/ExamplePage"
      },
      "dependencies": {
        "@console/pluginAPI": "/*"
      }
    }

    where:

    consolePlugin.name.my-plugin
    Update the name of your plugin.
    consolePlugin.version.0.0.1
    Update the version.
    consolePlugin.displayName.My Plugin
    Update the display name for your plugin.
    consolePlugin.description.Enjoy this shiny, new console plugin!
    Update the description with a synopsis about your plugin.
  6. Add the following to the console-extensions.json file:

    {
      "type": "console.tab/horizontalNav",
      "properties": {
        "page": {
          "name": "Example Tab",
          "href": "example"
        },
        "model": {
          "group": "core",
          "version": "v1",
          "kind": "Pod"
        },
        "component": { "$codeRef": "ExampleTab" }
      }
    }
  7. Edit the package.json file to include the following changes:

            "exposedModules": {
                "ExamplePage": "./components/ExamplePage",
                "ExampleTab": "./components/ExampleTab"
            }
  8. Write a message to display on a new custom tab on the Pods page by creating a new file src/components/ExampleTab.tsx and adding the following script:

    import * as React from 'react';
    
    export default function ExampleTab() {
        return (
            <p>This is a custom tab added to a resource using a dynamic plugin.</p>
        );
    }
  9. Install a Helm chart with the name of the plugin as the Helm release name into a new namespace or an existing namespace as specified by the -n command-line option to deploy your plugin on a cluster. Provide the location of the image within the plugin.image parameter by using the following command:

    $ helm upgrade -i  my-plugin charts/openshift-console-plugin -n my-plugin-namespace --create-namespace --set plugin.image=my-plugin-image-location
    참고

    For more information on deploying your plugin on a cluster, see "Deploy your plugin on a cluster".

Verification

  • Visit a Pod page to view the added tab.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동